View | Details | Raw Unified | Return to bug 11681
Collapse All | Expand All

(-)linux-2.6.26/drivers/mtd/maps/pxa2xx-flash.c (-18 / +20 lines)
Lines 41-49 Link Here
41
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
41
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
42
42
43
43
44
static int __init pxa2xx_flash_probe(struct device *dev)
44
static int __devinit pxa2xx_flash_probe(struct platform_device *pdev)
45
{
45
{
46
	struct platform_device *pdev = to_platform_device(dev);
47
	struct flash_platform_data *flash = pdev->dev.platform_data;
46
	struct flash_platform_data *flash = pdev->dev.platform_data;
48
	struct pxa2xx_flash_info *info;
47
	struct pxa2xx_flash_info *info;
49
	struct mtd_partition *parts;
48
	struct mtd_partition *parts;
Lines 114-128 Link Here
114
		add_mtd_device(info->mtd);
113
		add_mtd_device(info->mtd);
115
	}
114
	}
116
115
117
	dev_set_drvdata(dev, info);
116
	platform_set_drvdata(pdev, info);
118
	return 0;
117
	return 0;
119
}
118
}
120
119
121
static int __exit pxa2xx_flash_remove(struct device *dev)
120
static int __devexit pxa2xx_flash_remove(struct platform_device *pdev)
122
{
121
{
123
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);
122
	struct pxa2xx_flash_info *info = platform_get_drvdata(pdev);
124
123
125
	dev_set_drvdata(dev, NULL);
124
	platform_set_drvdata(pdev, NULL);
126
125
127
#ifdef CONFIG_MTD_PARTITIONS
126
#ifdef CONFIG_MTD_PARTITIONS
128
	if (info->nr_parts)
127
	if (info->nr_parts)
Lines 141-167 Link Here
141
}
140
}
142
141
143
#ifdef CONFIG_PM
142
#ifdef CONFIG_PM
144
static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state)
143
static int pxa2xx_flash_suspend(struct platform_device *pdev, pm_message_t state)
145
{
144
{
146
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);
145
	struct pxa2xx_flash_info *info = platform_get_drvdata(pdev);
147
	int ret = 0;
146
	int ret = 0;
148
147
148
printk(KERN_DEBUG "%s: \n", __FUNCTION__);
149
	if (info->mtd && info->mtd->suspend)
149
	if (info->mtd && info->mtd->suspend)
150
		ret = info->mtd->suspend(info->mtd);
150
		ret = info->mtd->suspend(info->mtd);
151
	return ret;
151
	return ret;
152
}
152
}
153
153
154
static int pxa2xx_flash_resume(struct device *dev)
154
static int pxa2xx_flash_resume(struct platform_device *pdev)
155
{
155
{
156
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);
156
	struct pxa2xx_flash_info *info = platform_get_drvdata(pdev);
157
157
158
printk(KERN_DEBUG "%s: \n", __FUNCTION__);
158
	if (info->mtd && info->mtd->resume)
159
	if (info->mtd && info->mtd->resume)
159
		info->mtd->resume(info->mtd);
160
		info->mtd->resume(info->mtd);
160
	return 0;
161
	return 0;
161
}
162
}
162
static void pxa2xx_flash_shutdown(struct device *dev)
163
static void pxa2xx_flash_shutdown(struct platform_device *pdev)
163
{
164
{
164
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);
165
	struct pxa2xx_flash_info *info = platform_get_drvdata(pdev);
165
166
166
	if (info && info->mtd->suspend(info->mtd) == 0)
167
	if (info && info->mtd->suspend(info->mtd) == 0)
167
		info->mtd->resume(info->mtd);
168
		info->mtd->resume(info->mtd);
Lines 172-182 Link Here
172
#define pxa2xx_flash_shutdown NULL
173
#define pxa2xx_flash_shutdown NULL
173
#endif
174
#endif
174
175
175
static struct device_driver pxa2xx_flash_driver = {
176
static struct platform_driver pxa2xx_flash_driver = {
176
	.name		= "pxa2xx-flash",
177
	.driver = {
177
	.bus		= &platform_bus_type,
178
		.name		= "pxa2xx-flash",
179
	},
178
	.probe		= pxa2xx_flash_probe,
180
	.probe		= pxa2xx_flash_probe,
179
	.remove		= __exit_p(pxa2xx_flash_remove),
181
	.remove		= __devexit_p(pxa2xx_flash_remove),
180
	.suspend	= pxa2xx_flash_suspend,
182
	.suspend	= pxa2xx_flash_suspend,
181
	.resume		= pxa2xx_flash_resume,
183
	.resume		= pxa2xx_flash_resume,
182
	.shutdown	= pxa2xx_flash_shutdown,
184
	.shutdown	= pxa2xx_flash_shutdown,
Lines 184-195 Link Here
184
186
185
static int __init init_pxa2xx_flash(void)
187
static int __init init_pxa2xx_flash(void)
186
{
188
{
187
	return driver_register(&pxa2xx_flash_driver);
189
	return platform_driver_register(&pxa2xx_flash_driver);
188
}
190
}
189
191
190
static void __exit cleanup_pxa2xx_flash(void)
192
static void __exit cleanup_pxa2xx_flash(void)
191
{
193
{
192
	driver_unregister(&pxa2xx_flash_driver);
194
	platform_driver_unregister(&pxa2xx_flash_driver);
193
}
195
}
194
196
195
module_init(init_pxa2xx_flash);
197
module_init(init_pxa2xx_flash);

Return to bug 11681