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/integrator-flash.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/integrator-flash.c')
-rw-r--r-- | drivers/mtd/maps/integrator-flash.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index fe738fd8d6f8..a3ba52fbd868 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c | |||
@@ -67,9 +67,8 @@ static void armflash_set_vpp(struct map_info *map, int on) | |||
67 | 67 | ||
68 | static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; | 68 | static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; |
69 | 69 | ||
70 | static int armflash_probe(struct device *_dev) | 70 | static int armflash_probe(struct platform_device *dev) |
71 | { | 71 | { |
72 | struct platform_device *dev = to_platform_device(_dev); | ||
73 | struct flash_platform_data *plat = dev->dev.platform_data; | 72 | struct flash_platform_data *plat = dev->dev.platform_data; |
74 | struct resource *res = dev->resource; | 73 | struct resource *res = dev->resource; |
75 | unsigned int size = res->end - res->start + 1; | 74 | unsigned int size = res->end - res->start + 1; |
@@ -138,7 +137,7 @@ static int armflash_probe(struct device *_dev) | |||
138 | } | 137 | } |
139 | 138 | ||
140 | if (err == 0) | 139 | if (err == 0) |
141 | dev_set_drvdata(&dev->dev, info); | 140 | platform_set_drvdata(dev, info); |
142 | 141 | ||
143 | /* | 142 | /* |
144 | * If we got an error, free all resources. | 143 | * If we got an error, free all resources. |
@@ -163,12 +162,11 @@ static int armflash_probe(struct device *_dev) | |||
163 | return err; | 162 | return err; |
164 | } | 163 | } |
165 | 164 | ||
166 | static int armflash_remove(struct device *_dev) | 165 | static int armflash_remove(struct platform_device *dev) |
167 | { | 166 | { |
168 | struct platform_device *dev = to_platform_device(_dev); | 167 | struct armflash_info *info = platform_get_drvdata(dev); |
169 | struct armflash_info *info = dev_get_drvdata(&dev->dev); | ||
170 | 168 | ||
171 | dev_set_drvdata(&dev->dev, NULL); | 169 | platform_set_drvdata(dev, NULL); |
172 | 170 | ||
173 | if (info) { | 171 | if (info) { |
174 | if (info->mtd) { | 172 | if (info->mtd) { |
@@ -190,21 +188,22 @@ static int armflash_remove(struct device *_dev) | |||
190 | return 0; | 188 | return 0; |
191 | } | 189 | } |
192 | 190 | ||
193 | static struct device_driver armflash_driver = { | 191 | static struct platform_driver armflash_driver = { |
194 | .name = "armflash", | ||
195 | .bus = &platform_bus_type, | ||
196 | .probe = armflash_probe, | 192 | .probe = armflash_probe, |
197 | .remove = armflash_remove, | 193 | .remove = armflash_remove, |
194 | .driver = { | ||
195 | .name = "armflash", | ||
196 | }, | ||
198 | }; | 197 | }; |
199 | 198 | ||
200 | static int __init armflash_init(void) | 199 | static int __init armflash_init(void) |
201 | { | 200 | { |
202 | return driver_register(&armflash_driver); | 201 | return platform_driver_register(&armflash_driver); |
203 | } | 202 | } |
204 | 203 | ||
205 | static void __exit armflash_exit(void) | 204 | static void __exit armflash_exit(void) |
206 | { | 205 | { |
207 | driver_unregister(&armflash_driver); | 206 | platform_driver_unregister(&armflash_driver); |
208 | } | 207 | } |
209 | 208 | ||
210 | module_init(armflash_init); | 209 | module_init(armflash_init); |