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 /arch/arm/common/locomo.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 'arch/arm/common/locomo.c')
-rw-r--r-- | arch/arm/common/locomo.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index ad55680726ed..557e52c1c869 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c | |||
@@ -550,9 +550,9 @@ struct locomo_save_data { | |||
550 | u16 LCM_SPIMD; | 550 | u16 LCM_SPIMD; |
551 | }; | 551 | }; |
552 | 552 | ||
553 | static int locomo_suspend(struct device *dev, pm_message_t state) | 553 | static int locomo_suspend(struct platform_device *dev, pm_message_t state) |
554 | { | 554 | { |
555 | struct locomo *lchip = dev_get_drvdata(dev); | 555 | struct locomo *lchip = platform_get_drvdata(dev); |
556 | struct locomo_save_data *save; | 556 | struct locomo_save_data *save; |
557 | unsigned long flags; | 557 | unsigned long flags; |
558 | 558 | ||
@@ -560,7 +560,7 @@ static int locomo_suspend(struct device *dev, pm_message_t state) | |||
560 | if (!save) | 560 | if (!save) |
561 | return -ENOMEM; | 561 | return -ENOMEM; |
562 | 562 | ||
563 | dev->power.saved_state = (void *) save; | 563 | dev->dev.power.saved_state = (void *) save; |
564 | 564 | ||
565 | spin_lock_irqsave(&lchip->lock, flags); | 565 | spin_lock_irqsave(&lchip->lock, flags); |
566 | 566 | ||
@@ -594,14 +594,14 @@ static int locomo_suspend(struct device *dev, pm_message_t state) | |||
594 | return 0; | 594 | return 0; |
595 | } | 595 | } |
596 | 596 | ||
597 | static int locomo_resume(struct device *dev) | 597 | static int locomo_resume(struct platform_device *dev) |
598 | { | 598 | { |
599 | struct locomo *lchip = dev_get_drvdata(dev); | 599 | struct locomo *lchip = platform_get_drvdata(dev); |
600 | struct locomo_save_data *save; | 600 | struct locomo_save_data *save; |
601 | unsigned long r; | 601 | unsigned long r; |
602 | unsigned long flags; | 602 | unsigned long flags; |
603 | 603 | ||
604 | save = (struct locomo_save_data *) dev->power.saved_state; | 604 | save = (struct locomo_save_data *) dev->dev.power.saved_state; |
605 | if (!save) | 605 | if (!save) |
606 | return 0; | 606 | return 0; |
607 | 607 | ||
@@ -760,27 +760,26 @@ static void __locomo_remove(struct locomo *lchip) | |||
760 | kfree(lchip); | 760 | kfree(lchip); |
761 | } | 761 | } |
762 | 762 | ||
763 | static int locomo_probe(struct device *dev) | 763 | static int locomo_probe(struct platform_device *dev) |
764 | { | 764 | { |
765 | struct platform_device *pdev = to_platform_device(dev); | ||
766 | struct resource *mem; | 765 | struct resource *mem; |
767 | int irq; | 766 | int irq; |
768 | 767 | ||
769 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 768 | mem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
770 | if (!mem) | 769 | if (!mem) |
771 | return -EINVAL; | 770 | return -EINVAL; |
772 | irq = platform_get_irq(pdev, 0); | 771 | irq = platform_get_irq(dev, 0); |
773 | 772 | ||
774 | return __locomo_probe(dev, mem, irq); | 773 | return __locomo_probe(&dev->dev, mem, irq); |
775 | } | 774 | } |
776 | 775 | ||
777 | static int locomo_remove(struct device *dev) | 776 | static int locomo_remove(struct platform_device *dev) |
778 | { | 777 | { |
779 | struct locomo *lchip = dev_get_drvdata(dev); | 778 | struct locomo *lchip = platform__get_drvdata(dev); |
780 | 779 | ||
781 | if (lchip) { | 780 | if (lchip) { |
782 | __locomo_remove(lchip); | 781 | __locomo_remove(lchip); |
783 | dev_set_drvdata(dev, NULL); | 782 | platform_set_drvdata(dev, NULL); |
784 | } | 783 | } |
785 | 784 | ||
786 | return 0; | 785 | return 0; |
@@ -792,15 +791,16 @@ static int locomo_remove(struct device *dev) | |||
792 | * the per-machine level, and then have this driver pick | 791 | * the per-machine level, and then have this driver pick |
793 | * up the registered devices. | 792 | * up the registered devices. |
794 | */ | 793 | */ |
795 | static struct device_driver locomo_device_driver = { | 794 | static struct platform_driver locomo_device_driver = { |
796 | .name = "locomo", | ||
797 | .bus = &platform_bus_type, | ||
798 | .probe = locomo_probe, | 795 | .probe = locomo_probe, |
799 | .remove = locomo_remove, | 796 | .remove = locomo_remove, |
800 | #ifdef CONFIG_PM | 797 | #ifdef CONFIG_PM |
801 | .suspend = locomo_suspend, | 798 | .suspend = locomo_suspend, |
802 | .resume = locomo_resume, | 799 | .resume = locomo_resume, |
803 | #endif | 800 | #endif |
801 | .driver = { | ||
802 | .name = "locomo", | ||
803 | }, | ||
804 | }; | 804 | }; |
805 | 805 | ||
806 | /* | 806 | /* |
@@ -1126,13 +1126,13 @@ static int __init locomo_init(void) | |||
1126 | { | 1126 | { |
1127 | int ret = bus_register(&locomo_bus_type); | 1127 | int ret = bus_register(&locomo_bus_type); |
1128 | if (ret == 0) | 1128 | if (ret == 0) |
1129 | driver_register(&locomo_device_driver); | 1129 | platform_driver_register(&locomo_device_driver); |
1130 | return ret; | 1130 | return ret; |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | static void __exit locomo_exit(void) | 1133 | static void __exit locomo_exit(void) |
1134 | { | 1134 | { |
1135 | driver_unregister(&locomo_device_driver); | 1135 | platform_driver_unregister(&locomo_device_driver); |
1136 | bus_unregister(&locomo_bus_type); | 1136 | bus_unregister(&locomo_bus_type); |
1137 | } | 1137 | } |
1138 | 1138 | ||