diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/mtd/maps/ixp2000.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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/ixp2000.c')
-rw-r--r-- | drivers/mtd/maps/ixp2000.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index 641eb2b55e9f..fc7a78e31735 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -111,13 +111,12 @@ static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, | |||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | static int ixp2000_flash_remove(struct device *_dev) | 114 | static int ixp2000_flash_remove(struct platform_device *dev) |
115 | { | 115 | { |
116 | struct platform_device *dev = to_platform_device(_dev); | ||
117 | struct flash_platform_data *plat = dev->dev.platform_data; | 116 | struct flash_platform_data *plat = dev->dev.platform_data; |
118 | struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); | 117 | struct ixp2000_flash_info *info = platform_get_drvdata(dev); |
119 | 118 | ||
120 | dev_set_drvdata(&dev->dev, NULL); | 119 | platform_set_drvdata(dev, NULL); |
121 | 120 | ||
122 | if(!info) | 121 | if(!info) |
123 | return 0; | 122 | return 0; |
@@ -143,10 +142,9 @@ static int ixp2000_flash_remove(struct device *_dev) | |||
143 | } | 142 | } |
144 | 143 | ||
145 | 144 | ||
146 | static int ixp2000_flash_probe(struct device *_dev) | 145 | static int ixp2000_flash_probe(struct platform_device *dev) |
147 | { | 146 | { |
148 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 147 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
149 | struct platform_device *dev = to_platform_device(_dev); | ||
150 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; | 148 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; |
151 | struct flash_platform_data *plat; | 149 | struct flash_platform_data *plat; |
152 | struct ixp2000_flash_info *info; | 150 | struct ixp2000_flash_info *info; |
@@ -177,7 +175,7 @@ static int ixp2000_flash_probe(struct device *_dev) | |||
177 | } | 175 | } |
178 | memzero(info, sizeof(struct ixp2000_flash_info)); | 176 | memzero(info, sizeof(struct ixp2000_flash_info)); |
179 | 177 | ||
180 | dev_set_drvdata(&dev->dev, info); | 178 | platform_set_drvdata(dev, info); |
181 | 179 | ||
182 | /* | 180 | /* |
183 | * Tell the MTD layer we're not 1:1 mapped so that it does | 181 | * Tell the MTD layer we're not 1:1 mapped so that it does |
@@ -248,25 +246,26 @@ static int ixp2000_flash_probe(struct device *_dev) | |||
248 | return 0; | 246 | return 0; |
249 | 247 | ||
250 | Error: | 248 | Error: |
251 | ixp2000_flash_remove(_dev); | 249 | ixp2000_flash_remove(dev); |
252 | return err; | 250 | return err; |
253 | } | 251 | } |
254 | 252 | ||
255 | static struct device_driver ixp2000_flash_driver = { | 253 | static struct platform_driver ixp2000_flash_driver = { |
256 | .name = "IXP2000-Flash", | ||
257 | .bus = &platform_bus_type, | ||
258 | .probe = &ixp2000_flash_probe, | 254 | .probe = &ixp2000_flash_probe, |
259 | .remove = &ixp2000_flash_remove | 255 | .remove = &ixp2000_flash_remove |
256 | .driver = { | ||
257 | .name = "IXP2000-Flash", | ||
258 | }, | ||
260 | }; | 259 | }; |
261 | 260 | ||
262 | static int __init ixp2000_flash_init(void) | 261 | static int __init ixp2000_flash_init(void) |
263 | { | 262 | { |
264 | return driver_register(&ixp2000_flash_driver); | 263 | return platform_driver_register(&ixp2000_flash_driver); |
265 | } | 264 | } |
266 | 265 | ||
267 | static void __exit ixp2000_flash_exit(void) | 266 | static void __exit ixp2000_flash_exit(void) |
268 | { | 267 | { |
269 | driver_unregister(&ixp2000_flash_driver); | 268 | platform_driver_unregister(&ixp2000_flash_driver); |
270 | } | 269 | } |
271 | 270 | ||
272 | module_init(ixp2000_flash_init); | 271 | module_init(ixp2000_flash_init); |