aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/sa1111.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 /arch/arm/common/sa1111.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 'arch/arm/common/sa1111.c')
-rw-r--r--arch/arm/common/sa1111.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 174aa86ee816..7b07acb03f3b 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -801,9 +801,9 @@ struct sa1111_save_data {
801 801
802#ifdef CONFIG_PM 802#ifdef CONFIG_PM
803 803
804static int sa1111_suspend(struct device *dev, pm_message_t state) 804static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
805{ 805{
806 struct sa1111 *sachip = dev_get_drvdata(dev); 806 struct sa1111 *sachip = platform_get_drvdata(dev);
807 struct sa1111_save_data *save; 807 struct sa1111_save_data *save;
808 unsigned long flags; 808 unsigned long flags;
809 unsigned int val; 809 unsigned int val;
@@ -812,7 +812,7 @@ static int sa1111_suspend(struct device *dev, pm_message_t state)
812 save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); 812 save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
813 if (!save) 813 if (!save)
814 return -ENOMEM; 814 return -ENOMEM;
815 dev->power.saved_state = save; 815 dev->dev.power.saved_state = save;
816 816
817 spin_lock_irqsave(&sachip->lock, flags); 817 spin_lock_irqsave(&sachip->lock, flags);
818 818
@@ -859,14 +859,14 @@ static int sa1111_suspend(struct device *dev, pm_message_t state)
859 * restored by their respective drivers, and must be called 859 * restored by their respective drivers, and must be called
860 * via LDM after this function. 860 * via LDM after this function.
861 */ 861 */
862static int sa1111_resume(struct device *dev) 862static int sa1111_resume(struct platform_device *dev)
863{ 863{
864 struct sa1111 *sachip = dev_get_drvdata(dev); 864 struct sa1111 *sachip = platform_get_drvdata(dev);
865 struct sa1111_save_data *save; 865 struct sa1111_save_data *save;
866 unsigned long flags, id; 866 unsigned long flags, id;
867 void __iomem *base; 867 void __iomem *base;
868 868
869 save = (struct sa1111_save_data *)dev->power.saved_state; 869 save = (struct sa1111_save_data *)dev->dev.power.saved_state;
870 if (!save) 870 if (!save)
871 return 0; 871 return 0;
872 872
@@ -879,7 +879,7 @@ static int sa1111_resume(struct device *dev)
879 id = sa1111_readl(sachip->base + SA1111_SKID); 879 id = sa1111_readl(sachip->base + SA1111_SKID);
880 if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { 880 if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
881 __sa1111_remove(sachip); 881 __sa1111_remove(sachip);
882 dev_set_drvdata(dev, NULL); 882 platform_set_drvdata(dev, NULL);
883 kfree(save); 883 kfree(save);
884 return 0; 884 return 0;
885 } 885 }
@@ -911,7 +911,7 @@ static int sa1111_resume(struct device *dev)
911 911
912 spin_unlock_irqrestore(&sachip->lock, flags); 912 spin_unlock_irqrestore(&sachip->lock, flags);
913 913
914 dev->power.saved_state = NULL; 914 dev->dev.power.saved_state = NULL;
915 kfree(save); 915 kfree(save);
916 916
917 return 0; 917 return 0;
@@ -922,9 +922,8 @@ static int sa1111_resume(struct device *dev)
922#define sa1111_resume NULL 922#define sa1111_resume NULL
923#endif 923#endif
924 924
925static int sa1111_probe(struct device *dev) 925static int sa1111_probe(struct platform_device *pdev)
926{ 926{
927 struct platform_device *pdev = to_platform_device(dev);
928 struct resource *mem; 927 struct resource *mem;
929 int irq; 928 int irq;
930 929
@@ -933,20 +932,20 @@ static int sa1111_probe(struct device *dev)
933 return -EINVAL; 932 return -EINVAL;
934 irq = platform_get_irq(pdev, 0); 933 irq = platform_get_irq(pdev, 0);
935 934
936 return __sa1111_probe(dev, mem, irq); 935 return __sa1111_probe(&pdev->dev, mem, irq);
937} 936}
938 937
939static int sa1111_remove(struct device *dev) 938static int sa1111_remove(struct platform_device *pdev)
940{ 939{
941 struct sa1111 *sachip = dev_get_drvdata(dev); 940 struct sa1111 *sachip = platform_get_drvdata(pdev);
942 941
943 if (sachip) { 942 if (sachip) {
944 __sa1111_remove(sachip); 943 __sa1111_remove(sachip);
945 dev_set_drvdata(dev, NULL); 944 platform_set_drvdata(pdev, NULL);
946 945
947#ifdef CONFIG_PM 946#ifdef CONFIG_PM
948 kfree(dev->power.saved_state); 947 kfree(pdev->dev.power.saved_state);
949 dev->power.saved_state = NULL; 948 pdev->dev.power.saved_state = NULL;
950#endif 949#endif
951 } 950 }
952 951
@@ -962,13 +961,14 @@ static int sa1111_remove(struct device *dev)
962 * We also need to handle the SDRAM configuration for 961 * We also need to handle the SDRAM configuration for
963 * PXA250/SA1110 machine classes. 962 * PXA250/SA1110 machine classes.
964 */ 963 */
965static struct device_driver sa1111_device_driver = { 964static struct platform_driver sa1111_device_driver = {
966 .name = "sa1111",
967 .bus = &platform_bus_type,
968 .probe = sa1111_probe, 965 .probe = sa1111_probe,
969 .remove = sa1111_remove, 966 .remove = sa1111_remove,
970 .suspend = sa1111_suspend, 967 .suspend = sa1111_suspend,
971 .resume = sa1111_resume, 968 .resume = sa1111_resume,
969 .driver = {
970 .name = "sa1111",
971 },
972}; 972};
973 973
974/* 974/*
@@ -1256,13 +1256,13 @@ static int __init sa1111_init(void)
1256{ 1256{
1257 int ret = bus_register(&sa1111_bus_type); 1257 int ret = bus_register(&sa1111_bus_type);
1258 if (ret == 0) 1258 if (ret == 0)
1259 driver_register(&sa1111_device_driver); 1259 platform_driver_register(&sa1111_device_driver);
1260 return ret; 1260 return ret;
1261} 1261}
1262 1262
1263static void __exit sa1111_exit(void) 1263static void __exit sa1111_exit(void)
1264{ 1264{
1265 driver_unregister(&sa1111_device_driver); 1265 platform_driver_unregister(&sa1111_device_driver);
1266 bus_unregister(&sa1111_bus_type); 1266 bus_unregister(&sa1111_bus_type);
1267} 1267}
1268 1268