aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/sa1100-flash.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/sa1100-flash.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/sa1100-flash.c')
-rw-r--r--drivers/mtd/maps/sa1100-flash.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 9e8bb1782be0..5cefb015633c 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -356,9 +356,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
356 356
357static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; 357static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
358 358
359static int __init sa1100_mtd_probe(struct device *dev) 359static int __init sa1100_mtd_probe(struct platform_device *pdev)
360{ 360{
361 struct platform_device *pdev = to_platform_device(dev);
362 struct flash_platform_data *plat = pdev->dev.platform_data; 361 struct flash_platform_data *plat = pdev->dev.platform_data;
363 struct mtd_partition *parts; 362 struct mtd_partition *parts;
364 const char *part_type = NULL; 363 const char *part_type = NULL;
@@ -402,28 +401,28 @@ static int __init sa1100_mtd_probe(struct device *dev)
402 401
403 info->nr_parts = nr_parts; 402 info->nr_parts = nr_parts;
404 403
405 dev_set_drvdata(dev, info); 404 platform_set_drvdata(pdev, info);
406 err = 0; 405 err = 0;
407 406
408 out: 407 out:
409 return err; 408 return err;
410} 409}
411 410
412static int __exit sa1100_mtd_remove(struct device *dev) 411static int __exit sa1100_mtd_remove(struct platform_device *pdev)
413{ 412{
414 struct sa_info *info = dev_get_drvdata(dev); 413 struct sa_info *info = platform_get_drvdata(pdev);
415 struct flash_platform_data *plat = dev->platform_data; 414 struct flash_platform_data *plat = pdev->dev.platform_data;
416 415
417 dev_set_drvdata(dev, NULL); 416 platform_set_drvdata(pdev, NULL);
418 sa1100_destroy(info, plat); 417 sa1100_destroy(info, plat);
419 418
420 return 0; 419 return 0;
421} 420}
422 421
423#ifdef CONFIG_PM 422#ifdef CONFIG_PM
424static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) 423static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state)
425{ 424{
426 struct sa_info *info = dev_get_drvdata(dev); 425 struct sa_info *info = platform_get_drvdata(dev);
427 int ret = 0; 426 int ret = 0;
428 427
429 if (info) 428 if (info)
@@ -432,17 +431,17 @@ static int sa1100_mtd_suspend(struct device *dev, pm_message_t state)
432 return ret; 431 return ret;
433} 432}
434 433
435static int sa1100_mtd_resume(struct device *dev) 434static int sa1100_mtd_resume(struct platform_device *dev)
436{ 435{
437 struct sa_info *info = dev_get_drvdata(dev); 436 struct sa_info *info = platform_get_drvdata(dev);
438 if (info) 437 if (info)
439 info->mtd->resume(info->mtd); 438 info->mtd->resume(info->mtd);
440 return 0; 439 return 0;
441} 440}
442 441
443static void sa1100_mtd_shutdown(struct device *dev) 442static void sa1100_mtd_shutdown(struct platform_device *dev)
444{ 443{
445 struct sa_info *info = dev_get_drvdata(dev); 444 struct sa_info *info = platform_get_drvdata(dev);
446 if (info && info->mtd->suspend(info->mtd) == 0) 445 if (info && info->mtd->suspend(info->mtd) == 0)
447 info->mtd->resume(info->mtd); 446 info->mtd->resume(info->mtd);
448} 447}
@@ -452,24 +451,25 @@ static void sa1100_mtd_shutdown(struct device *dev)
452#define sa1100_mtd_shutdown NULL 451#define sa1100_mtd_shutdown NULL
453#endif 452#endif
454 453
455static struct device_driver sa1100_mtd_driver = { 454static struct platform_driver sa1100_mtd_driver = {
456 .name = "flash",
457 .bus = &platform_bus_type,
458 .probe = sa1100_mtd_probe, 455 .probe = sa1100_mtd_probe,
459 .remove = __exit_p(sa1100_mtd_remove), 456 .remove = __exit_p(sa1100_mtd_remove),
460 .suspend = sa1100_mtd_suspend, 457 .suspend = sa1100_mtd_suspend,
461 .resume = sa1100_mtd_resume, 458 .resume = sa1100_mtd_resume,
462 .shutdown = sa1100_mtd_shutdown, 459 .shutdown = sa1100_mtd_shutdown,
460 .driver = {
461 .name = "flash",
462 },
463}; 463};
464 464
465static int __init sa1100_mtd_init(void) 465static int __init sa1100_mtd_init(void)
466{ 466{
467 return driver_register(&sa1100_mtd_driver); 467 return platform_driver_register(&sa1100_mtd_driver);
468} 468}
469 469
470static void __exit sa1100_mtd_exit(void) 470static void __exit sa1100_mtd_exit(void)
471{ 471{
472 driver_unregister(&sa1100_mtd_driver); 472 platform_driver_unregister(&sa1100_mtd_driver);
473} 473}
474 474
475module_init(sa1100_mtd_init); 475module_init(sa1100_mtd_init);