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/video/gbefb.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/video/gbefb.c')
-rw-r--r-- | drivers/video/gbefb.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 9d5e4f342110..d744c51807b7 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -1105,12 +1105,11 @@ int __init gbefb_setup(char *options) | |||
1105 | return 0; | 1105 | return 0; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static int __init gbefb_probe(struct device *dev) | 1108 | static int __init gbefb_probe(struct platform_device *p_dev) |
1109 | { | 1109 | { |
1110 | int i, ret = 0; | 1110 | int i, ret = 0; |
1111 | struct fb_info *info; | 1111 | struct fb_info *info; |
1112 | struct gbefb_par *par; | 1112 | struct gbefb_par *par; |
1113 | struct platform_device *p_dev = to_platform_device(dev); | ||
1114 | #ifndef MODULE | 1113 | #ifndef MODULE |
1115 | char *options = NULL; | 1114 | char *options = NULL; |
1116 | #endif | 1115 | #endif |
@@ -1204,8 +1203,8 @@ static int __init gbefb_probe(struct device *dev) | |||
1204 | goto out_gbe_unmap; | 1203 | goto out_gbe_unmap; |
1205 | } | 1204 | } |
1206 | 1205 | ||
1207 | dev_set_drvdata(&p_dev->dev, info); | 1206 | platform_set_drvdata(p_dev, info); |
1208 | gbefb_create_sysfs(dev); | 1207 | gbefb_create_sysfs(&p_dev->dev); |
1209 | 1208 | ||
1210 | printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n", | 1209 | printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n", |
1211 | info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE, | 1210 | info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE, |
@@ -1231,10 +1230,9 @@ out_release_framebuffer: | |||
1231 | return ret; | 1230 | return ret; |
1232 | } | 1231 | } |
1233 | 1232 | ||
1234 | static int __devexit gbefb_remove(struct device* dev) | 1233 | static int __devexit gbefb_remove(struct platform_device* p_dev) |
1235 | { | 1234 | { |
1236 | struct platform_device *p_dev = to_platform_device(dev); | 1235 | struct fb_info *info = platform_get_drvdata(p_dev); |
1237 | struct fb_info *info = dev_get_drvdata(&p_dev->dev); | ||
1238 | 1236 | ||
1239 | unregister_framebuffer(info); | 1237 | unregister_framebuffer(info); |
1240 | gbe_turn_off(); | 1238 | gbe_turn_off(); |
@@ -1252,18 +1250,19 @@ static int __devexit gbefb_remove(struct device* dev) | |||
1252 | return 0; | 1250 | return 0; |
1253 | } | 1251 | } |
1254 | 1252 | ||
1255 | static struct device_driver gbefb_driver = { | 1253 | static struct platform_driver gbefb_driver = { |
1256 | .name = "gbefb", | ||
1257 | .bus = &platform_bus_type, | ||
1258 | .probe = gbefb_probe, | 1254 | .probe = gbefb_probe, |
1259 | .remove = __devexit_p(gbefb_remove), | 1255 | .remove = __devexit_p(gbefb_remove), |
1256 | .driver = { | ||
1257 | .name = "gbefb", | ||
1258 | }, | ||
1260 | }; | 1259 | }; |
1261 | 1260 | ||
1262 | static struct platform_device *gbefb_device; | 1261 | static struct platform_device *gbefb_device; |
1263 | 1262 | ||
1264 | int __init gbefb_init(void) | 1263 | int __init gbefb_init(void) |
1265 | { | 1264 | { |
1266 | int ret = driver_register(&gbefb_driver); | 1265 | int ret = platform_driver_register(&gbefb_driver); |
1267 | if (!ret) { | 1266 | if (!ret) { |
1268 | gbefb_device = platform_device_alloc("gbefb", 0); | 1267 | gbefb_device = platform_device_alloc("gbefb", 0); |
1269 | if (gbefb_device) { | 1268 | if (gbefb_device) { |
@@ -1273,7 +1272,7 @@ int __init gbefb_init(void) | |||
1273 | } | 1272 | } |
1274 | if (ret) { | 1273 | if (ret) { |
1275 | platform_device_put(gbefb_device); | 1274 | platform_device_put(gbefb_device); |
1276 | driver_unregister(&gbefb_driver); | 1275 | platform_driver_unregister(&gbefb_driver); |
1277 | } | 1276 | } |
1278 | } | 1277 | } |
1279 | return ret; | 1278 | return ret; |
@@ -1282,7 +1281,7 @@ int __init gbefb_init(void) | |||
1282 | void __exit gbefb_exit(void) | 1281 | void __exit gbefb_exit(void) |
1283 | { | 1282 | { |
1284 | platform_device_unregister(gbefb_device); | 1283 | platform_device_unregister(gbefb_device); |
1285 | driver_unregister(&gbefb_driver); | 1284 | platform_driver_unregister(&gbefb_driver); |
1286 | } | 1285 | } |
1287 | 1286 | ||
1288 | module_init(gbefb_init); | 1287 | module_init(gbefb_init); |