aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/ixp4xx.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/mtd/maps/ixp4xx.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff)
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually remove the use of the device_driver function pointer methods for platform device drivers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/mtd/maps/ixp4xx.c')
-rw-r--r--drivers/mtd/maps/ixp4xx.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 56b3a355bf7b..a59f8027903c 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -99,13 +99,12 @@ struct ixp4xx_flash_info {
99 99
100static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 100static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
101 101
102static int ixp4xx_flash_remove(struct device *_dev) 102static int ixp4xx_flash_remove(struct platform_device *dev)
103{ 103{
104 struct platform_device *dev = to_platform_device(_dev);
105 struct flash_platform_data *plat = dev->dev.platform_data; 104 struct flash_platform_data *plat = dev->dev.platform_data;
106 struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); 105 struct ixp4xx_flash_info *info = platform_get_drvdata(dev);
107 106
108 dev_set_drvdata(&dev->dev, NULL); 107 platform_set_drvdata(dev, NULL);
109 108
110 if(!info) 109 if(!info)
111 return 0; 110 return 0;
@@ -130,9 +129,8 @@ static int ixp4xx_flash_remove(struct device *_dev)
130 return 0; 129 return 0;
131} 130}
132 131
133static int ixp4xx_flash_probe(struct device *_dev) 132static int ixp4xx_flash_probe(struct platform_device *dev)
134{ 133{
135 struct platform_device *dev = to_platform_device(_dev);
136 struct flash_platform_data *plat = dev->dev.platform_data; 134 struct flash_platform_data *plat = dev->dev.platform_data;
137 struct ixp4xx_flash_info *info; 135 struct ixp4xx_flash_info *info;
138 int err = -1; 136 int err = -1;
@@ -153,7 +151,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
153 } 151 }
154 memzero(info, sizeof(struct ixp4xx_flash_info)); 152 memzero(info, sizeof(struct ixp4xx_flash_info));
155 153
156 dev_set_drvdata(&dev->dev, info); 154 platform_set_drvdata(dev, info);
157 155
158 /* 156 /*
159 * Tell the MTD layer we're not 1:1 mapped so that it does 157 * Tell the MTD layer we're not 1:1 mapped so that it does
@@ -214,25 +212,26 @@ static int ixp4xx_flash_probe(struct device *_dev)
214 return 0; 212 return 0;
215 213
216Error: 214Error:
217 ixp4xx_flash_remove(_dev); 215 ixp4xx_flash_remove(dev);
218 return err; 216 return err;
219} 217}
220 218
221static struct device_driver ixp4xx_flash_driver = { 219static struct platform_driver ixp4xx_flash_driver = {
222 .name = "IXP4XX-Flash",
223 .bus = &platform_bus_type,
224 .probe = ixp4xx_flash_probe, 220 .probe = ixp4xx_flash_probe,
225 .remove = ixp4xx_flash_remove, 221 .remove = ixp4xx_flash_remove,
222 .driver = {
223 .name = "IXP4XX-Flash",
224 },
226}; 225};
227 226
228static int __init ixp4xx_flash_init(void) 227static int __init ixp4xx_flash_init(void)
229{ 228{
230 return driver_register(&ixp4xx_flash_driver); 229 return platform_driver_register(&ixp4xx_flash_driver);
231} 230}
232 231
233static void __exit ixp4xx_flash_exit(void) 232static void __exit ixp4xx_flash_exit(void)
234{ 233{
235 driver_unregister(&ixp4xx_flash_driver); 234 platform_driver_unregister(&ixp4xx_flash_driver);
236} 235}
237 236
238 237