aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/arm/common/locomo.c38
-rw-r--r--arch/arm/common/sa1111.c42
-rw-r--r--arch/arm/common/scoop.c30
-rw-r--r--arch/arm/mach-pxa/corgi_ssp.c17
-rw-r--r--arch/arm/mach-sa1100/neponset.c31
-rw-r--r--arch/um/drivers/net_kern.c9
-rw-r--r--arch/um/drivers/ubd_kern.c9
-rw-r--r--arch/xtensa/platform-iss/network.c9
-rw-r--r--drivers/char/s3c2410-rtc.c50
-rw-r--r--drivers/char/sonypi.c19
-rw-r--r--drivers/char/tb0219.c15
-rw-r--r--drivers/char/vr41xx_giu.c15
-rw-r--r--drivers/char/vr41xx_rtc.c17
-rw-r--r--drivers/char/watchdog/mpcore_wdt.c30
-rw-r--r--drivers/char/watchdog/mv64x60_wdt.c20
-rw-r--r--drivers/char/watchdog/s3c2410_wdt.c30
-rw-r--r--drivers/hwmon/hdaps.c21
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c27
-rw-r--r--drivers/i2c/busses/i2c-ixp2000.c25
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c25
-rw-r--r--drivers/i2c/busses/i2c-mpc.c24
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c24
-rw-r--r--drivers/i2c/busses/i2c-pxa.c25
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c71
-rw-r--r--drivers/i2c/chips/isp1301_omap.c21
-rw-r--r--drivers/input/keyboard/corgikbd.c29
-rw-r--r--drivers/input/keyboard/spitzkbd.c29
-rw-r--r--drivers/input/serio/i8042.c19
-rw-r--r--drivers/input/serio/rpckbd.c21
-rw-r--r--drivers/input/touchscreen/corgi_ts.c32
-rw-r--r--drivers/mfd/mcp-sa11x0.c32
-rw-r--r--drivers/misc/hdpuftrs/hdpu_cpustate.c20
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c20
-rw-r--r--drivers/mmc/pxamci.c42
-rw-r--r--drivers/mmc/wbsd.c27
-rw-r--r--drivers/mtd/maps/bast-flash.c33
-rw-r--r--drivers/mtd/maps/integrator-flash.c23
-rw-r--r--drivers/mtd/maps/ixp2000.c25
-rw-r--r--drivers/mtd/maps/ixp4xx.c25
-rw-r--r--drivers/mtd/maps/omap_nor.c23
-rw-r--r--drivers/mtd/maps/plat-ram.c68
-rw-r--r--drivers/mtd/maps/sa1100-flash.c36
-rw-r--r--drivers/mtd/nand/s3c2410.c77
-rw-r--r--drivers/net/depca.c26
-rw-r--r--drivers/net/dm9000.c35
-rw-r--r--drivers/net/gianfar.c28
-rw-r--r--drivers/net/irda/sa1100_ir.c28
-rw-r--r--drivers/net/irda/smsc-ircc2.c27
-rw-r--r--drivers/net/jazzsonic.c21
-rw-r--r--drivers/net/macsonic.c21
-rw-r--r--drivers/net/mv643xx_eth.c40
-rw-r--r--drivers/net/smc91x.c38
-rw-r--r--drivers/net/tokenring/proteon.c17
-rw-r--r--drivers/net/tokenring/skisa.c17
-rw-r--r--drivers/serial/8250.c31
-rw-r--r--drivers/serial/imx.c31
-rw-r--r--drivers/serial/mpc52xx_uart.c32
-rw-r--r--drivers/serial/mpsc.c65
-rw-r--r--drivers/serial/pxa.c33
-rw-r--r--drivers/serial/s3c2410.c62
-rw-r--r--drivers/serial/sa1100.c32
-rw-r--r--drivers/serial/vr41xx_siu.c27
-rw-r--r--drivers/usb/gadget/dummy_hcd.c76
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c31
-rw-r--r--drivers/usb/gadget/omap_udc.c61
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c41
-rw-r--r--drivers/usb/host/isp116x-hcd.c37
-rw-r--r--drivers/usb/host/ohci-au1xxx.c31
-rw-r--r--drivers/usb/host/ohci-lh7a404.c31
-rw-r--r--drivers/usb/host/ohci-omap.c35
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c21
-rw-r--r--drivers/usb/host/ohci-pxa27x.c31
-rw-r--r--drivers/usb/host/ohci-s3c2410.c21
-rw-r--r--drivers/usb/host/sl811-hcd.c61
-rw-r--r--drivers/video/acornfb.c13
-rw-r--r--drivers/video/arcfb.c22
-rw-r--r--drivers/video/backlight/corgi_bl.c21
-rw-r--r--drivers/video/dnfb.c16
-rw-r--r--drivers/video/epson1355fb.c24
-rw-r--r--drivers/video/gbefb.c25
-rw-r--r--drivers/video/imxfb.c45
-rw-r--r--drivers/video/pxafb.c51
-rw-r--r--drivers/video/q40fb.c14
-rw-r--r--drivers/video/s1d13xxxfb.c49
-rw-r--r--drivers/video/s3c2410fb.c47
-rw-r--r--drivers/video/sa1100fb.c25
-rw-r--r--drivers/video/sgivwfb.c22
-rw-r--r--drivers/video/vesafb.c14
-rw-r--r--drivers/video/vfb.c22
-rw-r--r--drivers/video/w100fb.c46
-rw-r--r--sound/arm/pxa2xx-ac97.c35
-rw-r--r--sound/core/init.c17
-rw-r--r--sound/core/sound.c8
93 files changed, 1413 insertions, 1416 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
553static int locomo_suspend(struct device *dev, pm_message_t state) 553static 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
597static int locomo_resume(struct device *dev) 597static 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
763static int locomo_probe(struct device *dev) 763static 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
777static int locomo_remove(struct device *dev) 776static 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 */
795static struct device_driver locomo_device_driver = { 794static 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
1133static void __exit locomo_exit(void) 1133static 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
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
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index c7fdf390cef9..32924c6714fe 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -98,9 +98,9 @@ static void check_scoop_reg(struct scoop_dev *sdev)
98} 98}
99 99
100#ifdef CONFIG_PM 100#ifdef CONFIG_PM
101static int scoop_suspend(struct device *dev, pm_message_t state) 101static int scoop_suspend(struct platform_device *dev, pm_message_t state)
102{ 102{
103 struct scoop_dev *sdev = dev_get_drvdata(dev); 103 struct scoop_dev *sdev = platform_get_drvdata(dev);
104 104
105 check_scoop_reg(sdev); 105 check_scoop_reg(sdev);
106 sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); 106 sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
@@ -109,9 +109,9 @@ static int scoop_suspend(struct device *dev, pm_message_t state)
109 return 0; 109 return 0;
110} 110}
111 111
112static int scoop_resume(struct device *dev) 112static int scoop_resume(struct platform_device *dev)
113{ 113{
114 struct scoop_dev *sdev = dev_get_drvdata(dev); 114 struct scoop_dev *sdev = platform_get_drvdata(dev);
115 115
116 check_scoop_reg(sdev); 116 check_scoop_reg(sdev);
117 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; 117 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
@@ -123,11 +123,10 @@ static int scoop_resume(struct device *dev)
123#define scoop_resume NULL 123#define scoop_resume NULL
124#endif 124#endif
125 125
126int __init scoop_probe(struct device *dev) 126int __init scoop_probe(struct platform_device *pdev)
127{ 127{
128 struct scoop_dev *devptr; 128 struct scoop_dev *devptr;
129 struct scoop_config *inf; 129 struct scoop_config *inf;
130 struct platform_device *pdev = to_platform_device(dev);
131 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 130 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
132 131
133 if (!mem) 132 if (!mem)
@@ -141,7 +140,7 @@ int __init scoop_probe(struct device *dev)
141 memset(devptr, 0, sizeof(struct scoop_dev)); 140 memset(devptr, 0, sizeof(struct scoop_dev));
142 spin_lock_init(&devptr->scoop_lock); 141 spin_lock_init(&devptr->scoop_lock);
143 142
144 inf = dev->platform_data; 143 inf = pdev->dev.platform_data;
145 devptr->base = ioremap(mem->start, mem->end - mem->start + 1); 144 devptr->base = ioremap(mem->start, mem->end - mem->start + 1);
146 145
147 if (!devptr->base) { 146 if (!devptr->base) {
@@ -149,7 +148,7 @@ int __init scoop_probe(struct device *dev)
149 return -ENOMEM; 148 return -ENOMEM;
150 } 149 }
151 150
152 dev_set_drvdata(dev, devptr); 151 platform_set_drvdata(pdev, devptr);
153 152
154 printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base); 153 printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
155 154
@@ -164,29 +163,30 @@ int __init scoop_probe(struct device *dev)
164 return 0; 163 return 0;
165} 164}
166 165
167static int scoop_remove(struct device *dev) 166static int scoop_remove(struct platform_device *pdev)
168{ 167{
169 struct scoop_dev *sdev = dev_get_drvdata(dev); 168 struct scoop_dev *sdev = platform_get_drvdata(pdev);
170 if (sdev) { 169 if (sdev) {
171 iounmap(sdev->base); 170 iounmap(sdev->base);
172 kfree(sdev); 171 kfree(sdev);
173 dev_set_drvdata(dev, NULL); 172 platform_set_drvdata(pdev, NULL);
174 } 173 }
175 return 0; 174 return 0;
176} 175}
177 176
178static struct device_driver scoop_driver = { 177static struct platform_driver scoop_driver = {
179 .name = "sharp-scoop",
180 .bus = &platform_bus_type,
181 .probe = scoop_probe, 178 .probe = scoop_probe,
182 .remove = scoop_remove, 179 .remove = scoop_remove,
183 .suspend = scoop_suspend, 180 .suspend = scoop_suspend,
184 .resume = scoop_resume, 181 .resume = scoop_resume,
182 .driver = {
183 .name = "sharp-scoop",
184 },
185}; 185};
186 186
187int __init scoop_init(void) 187int __init scoop_init(void)
188{ 188{
189 return driver_register(&scoop_driver); 189 return platform_driver_register(&scoop_driver);
190} 190}
191 191
192subsys_initcall(scoop_init); 192subsys_initcall(scoop_init);
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c
index 591e5f32dbec..9f835f32b938 100644
--- a/arch/arm/mach-pxa/corgi_ssp.c
+++ b/arch/arm/mach-pxa/corgi_ssp.c
@@ -191,7 +191,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo)
191 ssp_machinfo = machinfo; 191 ssp_machinfo = machinfo;
192} 192}
193 193
194static int __init corgi_ssp_probe(struct device *dev) 194static int __init corgi_ssp_probe(struct platform_device *dev)
195{ 195{
196 int ret; 196 int ret;
197 197
@@ -216,13 +216,13 @@ static int __init corgi_ssp_probe(struct device *dev)
216 return ret; 216 return ret;
217} 217}
218 218
219static int corgi_ssp_remove(struct device *dev) 219static int corgi_ssp_remove(struct platform_device *dev)
220{ 220{
221 ssp_exit(&corgi_ssp_dev); 221 ssp_exit(&corgi_ssp_dev);
222 return 0; 222 return 0;
223} 223}
224 224
225static int corgi_ssp_suspend(struct device *dev, pm_message_t state) 225static int corgi_ssp_suspend(struct platform_device *dev, pm_message_t state)
226{ 226{
227 ssp_flush(&corgi_ssp_dev); 227 ssp_flush(&corgi_ssp_dev);
228 ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state); 228 ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state);
@@ -230,7 +230,7 @@ static int corgi_ssp_suspend(struct device *dev, pm_message_t state)
230 return 0; 230 return 0;
231} 231}
232 232
233static int corgi_ssp_resume(struct device *dev) 233static int corgi_ssp_resume(struct platform_device *dev)
234{ 234{
235 GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ 235 GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */
236 GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/ 236 GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
@@ -241,18 +241,19 @@ static int corgi_ssp_resume(struct device *dev)
241 return 0; 241 return 0;
242} 242}
243 243
244static struct device_driver corgissp_driver = { 244static struct platform_driver corgissp_driver = {
245 .name = "corgi-ssp",
246 .bus = &platform_bus_type,
247 .probe = corgi_ssp_probe, 245 .probe = corgi_ssp_probe,
248 .remove = corgi_ssp_remove, 246 .remove = corgi_ssp_remove,
249 .suspend = corgi_ssp_suspend, 247 .suspend = corgi_ssp_suspend,
250 .resume = corgi_ssp_resume, 248 .resume = corgi_ssp_resume,
249 .driver = {
250 .name = "corgi-ssp",
251 },
251}; 252};
252 253
253int __init corgi_ssp_init(void) 254int __init corgi_ssp_init(void)
254{ 255{
255 return driver_register(&corgissp_driver); 256 return platform_driver_register(&corgissp_driver);
256} 257}
257 258
258arch_initcall(corgi_ssp_init); 259arch_initcall(corgi_ssp_init);
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 69f1970646c6..9e02bc3712a0 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -137,7 +137,7 @@ static struct sa1100_port_fns neponset_port_fns __initdata = {
137 .get_mctrl = neponset_get_mctrl, 137 .get_mctrl = neponset_get_mctrl,
138}; 138};
139 139
140static int neponset_probe(struct device *dev) 140static int neponset_probe(struct platform_device *dev)
141{ 141{
142 sa1100_register_uart_fns(&neponset_port_fns); 142 sa1100_register_uart_fns(&neponset_port_fns);
143 143
@@ -178,27 +178,27 @@ static int neponset_probe(struct device *dev)
178/* 178/*
179 * LDM power management. 179 * LDM power management.
180 */ 180 */
181static int neponset_suspend(struct device *dev, pm_message_t state) 181static int neponset_suspend(struct platform_device *dev, pm_message_t state)
182{ 182{
183 /* 183 /*
184 * Save state. 184 * Save state.
185 */ 185 */
186 if (!dev->power.saved_state) 186 if (!dev->dev.power.saved_state)
187 dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); 187 dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
188 if (!dev->power.saved_state) 188 if (!dev->dev.power.saved_state)
189 return -ENOMEM; 189 return -ENOMEM;
190 190
191 *(unsigned int *)dev->power.saved_state = NCR_0; 191 *(unsigned int *)dev->dev.power.saved_state = NCR_0;
192 192
193 return 0; 193 return 0;
194} 194}
195 195
196static int neponset_resume(struct device *dev) 196static int neponset_resume(struct platform_device *dev)
197{ 197{
198 if (dev->power.saved_state) { 198 if (dev->dev.power.saved_state) {
199 NCR_0 = *(unsigned int *)dev->power.saved_state; 199 NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
200 kfree(dev->power.saved_state); 200 kfree(dev->dev.power.saved_state);
201 dev->power.saved_state = NULL; 201 dev->dev.power.saved_state = NULL;
202 } 202 }
203 203
204 return 0; 204 return 0;
@@ -209,12 +209,13 @@ static int neponset_resume(struct device *dev)
209#define neponset_resume NULL 209#define neponset_resume NULL
210#endif 210#endif
211 211
212static struct device_driver neponset_device_driver = { 212static struct platform_driver neponset_device_driver = {
213 .name = "neponset",
214 .bus = &platform_bus_type,
215 .probe = neponset_probe, 213 .probe = neponset_probe,
216 .suspend = neponset_suspend, 214 .suspend = neponset_suspend,
217 .resume = neponset_resume, 215 .resume = neponset_resume,
216 .driver = {
217 .name = "neponset",
218 },
218}; 219};
219 220
220static struct resource neponset_resources[] = { 221static struct resource neponset_resources[] = {
@@ -293,7 +294,7 @@ static struct platform_device *devices[] __initdata = {
293 294
294static int __init neponset_init(void) 295static int __init neponset_init(void)
295{ 296{
296 driver_register(&neponset_device_driver); 297 platform_driver_register(&neponset_device_driver);
297 298
298 /* 299 /*
299 * The Neponset is only present on the Assabet machine type. 300 * The Neponset is only present on the Assabet machine type.
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index fe865d9a3721..b489aad12853 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -284,9 +284,10 @@ void uml_net_user_timer_expire(unsigned long _conn)
284static DEFINE_SPINLOCK(devices_lock); 284static DEFINE_SPINLOCK(devices_lock);
285static struct list_head devices = LIST_HEAD_INIT(devices); 285static struct list_head devices = LIST_HEAD_INIT(devices);
286 286
287static struct device_driver uml_net_driver = { 287static struct platform_driver uml_net_driver = {
288 .name = DRIVER_NAME, 288 .driver = {
289 .bus = &platform_bus_type, 289 .name = DRIVER_NAME,
290 },
290}; 291};
291static int driver_registered; 292static int driver_registered;
292 293
@@ -333,7 +334,7 @@ static int eth_configure(int n, void *init, char *mac,
333 334
334 /* sysfs register */ 335 /* sysfs register */
335 if (!driver_registered) { 336 if (!driver_registered) {
336 driver_register(&uml_net_driver); 337 platform_driver_register(&uml_net_driver);
337 driver_registered = 1; 338 driver_registered = 1;
338 } 339 }
339 device->pdev.id = n; 340 device->pdev.id = n;
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index b2c86257b0f8..93898917cbe5 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -823,9 +823,10 @@ static int ubd_mc_init(void)
823 823
824__initcall(ubd_mc_init); 824__initcall(ubd_mc_init);
825 825
826static struct device_driver ubd_driver = { 826static struct platform_driver ubd_driver = {
827 .name = DRIVER_NAME, 827 .driver = {
828 .bus = &platform_bus_type, 828 .name = DRIVER_NAME,
829 },
829}; 830};
830 831
831int ubd_init(void) 832int ubd_init(void)
@@ -850,7 +851,7 @@ int ubd_init(void)
850 if (register_blkdev(fake_major, "ubd")) 851 if (register_blkdev(fake_major, "ubd"))
851 return -1; 852 return -1;
852 } 853 }
853 driver_register(&ubd_driver); 854 platform_driver_register(&ubd_driver);
854 for (i = 0; i < MAX_DEV; i++) 855 for (i = 0; i < MAX_DEV; i++)
855 ubd_add(i); 856 ubd_add(i);
856 return 0; 857 return 0;
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c
index 0682ffd38175..58e782e5c42d 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platform-iss/network.c
@@ -648,9 +648,10 @@ void iss_net_user_timer_expire(unsigned long _conn)
648} 648}
649 649
650 650
651static struct device_driver iss_net_driver = { 651static struct platform_driver iss_net_driver = {
652 .name = DRIVER_NAME, 652 .driver = {
653 .bus = &platform_bus_type, 653 .name = DRIVER_NAME,
654 },
654}; 655};
655 656
656static int driver_registered; 657static int driver_registered;
@@ -701,7 +702,7 @@ static int iss_net_configure(int index, char *init)
701 /* sysfs register */ 702 /* sysfs register */
702 703
703 if (!driver_registered) { 704 if (!driver_registered) {
704 driver_register(&iss_net_driver); 705 platform_driver_register(&iss_net_driver);
705 driver_registered = 1; 706 driver_registered = 1;
706 } 707 }
707 708
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
index d724c0de4f28..3df7a574267b 100644
--- a/drivers/char/s3c2410-rtc.c
+++ b/drivers/char/s3c2410-rtc.c
@@ -382,7 +382,7 @@ static struct rtc_ops s3c2410_rtcops = {
382 .proc = s3c2410_rtc_proc, 382 .proc = s3c2410_rtc_proc,
383}; 383};
384 384
385static void s3c2410_rtc_enable(struct device *dev, int en) 385static void s3c2410_rtc_enable(struct platform_device *pdev, int en)
386{ 386{
387 unsigned int tmp; 387 unsigned int tmp;
388 388
@@ -399,21 +399,21 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
399 /* re-enable the device, and check it is ok */ 399 /* re-enable the device, and check it is ok */
400 400
401 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ 401 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){
402 dev_info(dev, "rtc disabled, re-enabling\n"); 402 dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
403 403
404 tmp = readb(S3C2410_RTCCON); 404 tmp = readb(S3C2410_RTCCON);
405 writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); 405 writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON);
406 } 406 }
407 407
408 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ 408 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){
409 dev_info(dev, "removing S3C2410_RTCCON_CNTSEL\n"); 409 dev_info(&pdev->dev, "removing S3C2410_RTCCON_CNTSEL\n");
410 410
411 tmp = readb(S3C2410_RTCCON); 411 tmp = readb(S3C2410_RTCCON);
412 writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); 412 writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON);
413 } 413 }
414 414
415 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ 415 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){
416 dev_info(dev, "removing S3C2410_RTCCON_CLKRST\n"); 416 dev_info(&pdev->dev, "removing S3C2410_RTCCON_CLKRST\n");
417 417
418 tmp = readb(S3C2410_RTCCON); 418 tmp = readb(S3C2410_RTCCON);
419 writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); 419 writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON);
@@ -421,7 +421,7 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
421 } 421 }
422} 422}
423 423
424static int s3c2410_rtc_remove(struct device *dev) 424static int s3c2410_rtc_remove(struct platform_device *dev)
425{ 425{
426 unregister_rtc(&s3c2410_rtcops); 426 unregister_rtc(&s3c2410_rtcops);
427 427
@@ -438,25 +438,24 @@ static int s3c2410_rtc_remove(struct device *dev)
438 return 0; 438 return 0;
439} 439}
440 440
441static int s3c2410_rtc_probe(struct device *dev) 441static int s3c2410_rtc_probe(struct platform_device *pdev)
442{ 442{
443 struct platform_device *pdev = to_platform_device(dev);
444 struct resource *res; 443 struct resource *res;
445 int ret; 444 int ret;
446 445
447 pr_debug("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); 446 pr_debug("%s: probe=%p\n", __FUNCTION__, pdev);
448 447
449 /* find the IRQs */ 448 /* find the IRQs */
450 449
451 s3c2410_rtc_tickno = platform_get_irq(pdev, 1); 450 s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
452 if (s3c2410_rtc_tickno <= 0) { 451 if (s3c2410_rtc_tickno <= 0) {
453 dev_err(dev, "no irq for rtc tick\n"); 452 dev_err(&pdev->dev, "no irq for rtc tick\n");
454 return -ENOENT; 453 return -ENOENT;
455 } 454 }
456 455
457 s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); 456 s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
458 if (s3c2410_rtc_alarmno <= 0) { 457 if (s3c2410_rtc_alarmno <= 0) {
459 dev_err(dev, "no irq for alarm\n"); 458 dev_err(&pdev->dev, "no irq for alarm\n");
460 return -ENOENT; 459 return -ENOENT;
461 } 460 }
462 461
@@ -467,7 +466,7 @@ static int s3c2410_rtc_probe(struct device *dev)
467 466
468 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 467 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
469 if (res == NULL) { 468 if (res == NULL) {
470 dev_err(dev, "failed to get memory region resource\n"); 469 dev_err(&pdev->dev, "failed to get memory region resource\n");
471 return -ENOENT; 470 return -ENOENT;
472 } 471 }
473 472
@@ -475,14 +474,14 @@ static int s3c2410_rtc_probe(struct device *dev)
475 pdev->name); 474 pdev->name);
476 475
477 if (s3c2410_rtc_mem == NULL) { 476 if (s3c2410_rtc_mem == NULL) {
478 dev_err(dev, "failed to reserve memory region\n"); 477 dev_err(&pdev->dev, "failed to reserve memory region\n");
479 ret = -ENOENT; 478 ret = -ENOENT;
480 goto exit_err; 479 goto exit_err;
481 } 480 }
482 481
483 s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1); 482 s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1);
484 if (s3c2410_rtc_base == NULL) { 483 if (s3c2410_rtc_base == NULL) {
485 dev_err(dev, "failed ioremap()\n"); 484 dev_err(&pdev->dev, "failed ioremap()\n");
486 ret = -EINVAL; 485 ret = -EINVAL;
487 goto exit_err; 486 goto exit_err;
488 } 487 }
@@ -494,7 +493,7 @@ static int s3c2410_rtc_probe(struct device *dev)
494 493
495 /* check to see if everything is setup correctly */ 494 /* check to see if everything is setup correctly */
496 495
497 s3c2410_rtc_enable(dev, 1); 496 s3c2410_rtc_enable(pdev, 1);
498 497
499 pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); 498 pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON));
500 499
@@ -506,7 +505,7 @@ static int s3c2410_rtc_probe(struct device *dev)
506 return 0; 505 return 0;
507 506
508 exit_err: 507 exit_err:
509 dev_err(dev, "error %d during initialisation\n", ret); 508 dev_err(&pdev->dev, "error %d during initialisation\n", ret);
510 509
511 return ret; 510 return ret;
512} 511}
@@ -519,7 +518,7 @@ static struct timespec s3c2410_rtc_delta;
519 518
520static int ticnt_save; 519static int ticnt_save;
521 520
522static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state) 521static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state)
523{ 522{
524 struct rtc_time tm; 523 struct rtc_time tm;
525 struct timespec time; 524 struct timespec time;
@@ -535,19 +534,19 @@ static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state)
535 s3c2410_rtc_gettime(&tm); 534 s3c2410_rtc_gettime(&tm);
536 rtc_tm_to_time(&tm, &time.tv_sec); 535 rtc_tm_to_time(&tm, &time.tv_sec);
537 save_time_delta(&s3c2410_rtc_delta, &time); 536 save_time_delta(&s3c2410_rtc_delta, &time);
538 s3c2410_rtc_enable(dev, 0); 537 s3c2410_rtc_enable(pdev, 0);
539 538
540 return 0; 539 return 0;
541} 540}
542 541
543static int s3c2410_rtc_resume(struct device *dev) 542static int s3c2410_rtc_resume(struct platform_device *pdev)
544{ 543{
545 struct rtc_time tm; 544 struct rtc_time tm;
546 struct timespec time; 545 struct timespec time;
547 546
548 time.tv_nsec = 0; 547 time.tv_nsec = 0;
549 548
550 s3c2410_rtc_enable(dev, 1); 549 s3c2410_rtc_enable(pdev, 1);
551 s3c2410_rtc_gettime(&tm); 550 s3c2410_rtc_gettime(&tm);
552 rtc_tm_to_time(&tm, &time.tv_sec); 551 rtc_tm_to_time(&tm, &time.tv_sec);
553 restore_time_delta(&s3c2410_rtc_delta, &time); 552 restore_time_delta(&s3c2410_rtc_delta, &time);
@@ -560,14 +559,15 @@ static int s3c2410_rtc_resume(struct device *dev)
560#define s3c2410_rtc_resume NULL 559#define s3c2410_rtc_resume NULL
561#endif 560#endif
562 561
563static struct device_driver s3c2410_rtcdrv = { 562static struct platform_driver s3c2410_rtcdrv = {
564 .name = "s3c2410-rtc",
565 .owner = THIS_MODULE,
566 .bus = &platform_bus_type,
567 .probe = s3c2410_rtc_probe, 563 .probe = s3c2410_rtc_probe,
568 .remove = s3c2410_rtc_remove, 564 .remove = s3c2410_rtc_remove,
569 .suspend = s3c2410_rtc_suspend, 565 .suspend = s3c2410_rtc_suspend,
570 .resume = s3c2410_rtc_resume, 566 .resume = s3c2410_rtc_resume,
567 .driver = {
568 .name = "s3c2410-rtc",
569 .owner = THIS_MODULE,
570 },
571}; 571};
572 572
573static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; 573static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
@@ -575,12 +575,12 @@ static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
575static int __init s3c2410_rtc_init(void) 575static int __init s3c2410_rtc_init(void)
576{ 576{
577 printk(banner); 577 printk(banner);
578 return driver_register(&s3c2410_rtcdrv); 578 return platform_driver_register(&s3c2410_rtcdrv);
579} 579}
580 580
581static void __exit s3c2410_rtc_exit(void) 581static void __exit s3c2410_rtc_exit(void)
582{ 582{
583 driver_unregister(&s3c2410_rtcdrv); 583 platform_driver_unregister(&s3c2410_rtcdrv);
584} 584}
585 585
586module_init(s3c2410_rtc_init); 586module_init(s3c2410_rtc_init);
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index d05067dcea01..51a07370e636 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1168,7 +1168,7 @@ static int sonypi_disable(void)
1168#ifdef CONFIG_PM 1168#ifdef CONFIG_PM
1169static int old_camera_power; 1169static int old_camera_power;
1170 1170
1171static int sonypi_suspend(struct device *dev, pm_message_t state) 1171static int sonypi_suspend(struct platform_device *dev, pm_message_t state)
1172{ 1172{
1173 old_camera_power = sonypi_device.camera_power; 1173 old_camera_power = sonypi_device.camera_power;
1174 sonypi_disable(); 1174 sonypi_disable();
@@ -1176,26 +1176,27 @@ static int sonypi_suspend(struct device *dev, pm_message_t state)
1176 return 0; 1176 return 0;
1177} 1177}
1178 1178
1179static int sonypi_resume(struct device *dev) 1179static int sonypi_resume(struct platform_device *dev)
1180{ 1180{
1181 sonypi_enable(old_camera_power); 1181 sonypi_enable(old_camera_power);
1182 return 0; 1182 return 0;
1183} 1183}
1184#endif 1184#endif
1185 1185
1186static void sonypi_shutdown(struct device *dev) 1186static void sonypi_shutdown(struct platform_device *dev)
1187{ 1187{
1188 sonypi_disable(); 1188 sonypi_disable();
1189} 1189}
1190 1190
1191static struct device_driver sonypi_driver = { 1191static struct platform_driver sonypi_driver = {
1192 .name = "sonypi",
1193 .bus = &platform_bus_type,
1194#ifdef CONFIG_PM 1192#ifdef CONFIG_PM
1195 .suspend = sonypi_suspend, 1193 .suspend = sonypi_suspend,
1196 .resume = sonypi_resume, 1194 .resume = sonypi_resume,
1197#endif 1195#endif
1198 .shutdown = sonypi_shutdown, 1196 .shutdown = sonypi_shutdown,
1197 .driver = {
1198 .name = "sonypi",
1199 },
1199}; 1200};
1200 1201
1201static int __devinit sonypi_create_input_devices(void) 1202static int __devinit sonypi_create_input_devices(void)
@@ -1455,20 +1456,20 @@ static int __init sonypi_init(void)
1455 if (!dmi_check_system(sonypi_dmi_table)) 1456 if (!dmi_check_system(sonypi_dmi_table))
1456 return -ENODEV; 1457 return -ENODEV;
1457 1458
1458 ret = driver_register(&sonypi_driver); 1459 ret = platform_driver_register(&sonypi_driver);
1459 if (ret) 1460 if (ret)
1460 return ret; 1461 return ret;
1461 1462
1462 ret = sonypi_probe(); 1463 ret = sonypi_probe();
1463 if (ret) 1464 if (ret)
1464 driver_unregister(&sonypi_driver); 1465 platform_driver_unregister(&sonypi_driver);
1465 1466
1466 return ret; 1467 return ret;
1467} 1468}
1468 1469
1469static void __exit sonypi_exit(void) 1470static void __exit sonypi_exit(void)
1470{ 1471{
1471 driver_unregister(&sonypi_driver); 1472 platform_driver_unregister(&sonypi_driver);
1472 sonypi_remove(); 1473 sonypi_remove();
1473} 1474}
1474 1475
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c
index 24355b23b2ca..b3d411a756fe 100644
--- a/drivers/char/tb0219.c
+++ b/drivers/char/tb0219.c
@@ -283,7 +283,7 @@ static void tb0219_pci_irq_init(void)
283 vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW); 283 vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW);
284} 284}
285 285
286static int tb0219_probe(struct device *dev) 286static int tb0219_probe(struct platform_device *dev)
287{ 287{
288 int retval; 288 int retval;
289 289
@@ -319,7 +319,7 @@ static int tb0219_probe(struct device *dev)
319 return 0; 319 return 0;
320} 320}
321 321
322static int tb0219_remove(struct device *dev) 322static int tb0219_remove(struct platform_device *dev)
323{ 323{
324 _machine_restart = old_machine_restart; 324 _machine_restart = old_machine_restart;
325 325
@@ -333,11 +333,12 @@ static int tb0219_remove(struct device *dev)
333 333
334static struct platform_device *tb0219_platform_device; 334static struct platform_device *tb0219_platform_device;
335 335
336static struct device_driver tb0219_device_driver = { 336static struct platform_driver tb0219_device_driver = {
337 .name = "TB0219",
338 .bus = &platform_bus_type,
339 .probe = tb0219_probe, 337 .probe = tb0219_probe,
340 .remove = tb0219_remove, 338 .remove = tb0219_remove,
339 .driver = {
340 .name = "TB0219",
341 },
341}; 342};
342 343
343static int __devinit tanbac_tb0219_init(void) 344static int __devinit tanbac_tb0219_init(void)
@@ -348,7 +349,7 @@ static int __devinit tanbac_tb0219_init(void)
348 if (IS_ERR(tb0219_platform_device)) 349 if (IS_ERR(tb0219_platform_device))
349 return PTR_ERR(tb0219_platform_device); 350 return PTR_ERR(tb0219_platform_device);
350 351
351 retval = driver_register(&tb0219_device_driver); 352 retval = platform_driver_register(&tb0219_device_driver);
352 if (retval < 0) 353 if (retval < 0)
353 platform_device_unregister(tb0219_platform_device); 354 platform_device_unregister(tb0219_platform_device);
354 355
@@ -357,7 +358,7 @@ static int __devinit tanbac_tb0219_init(void)
357 358
358static void __devexit tanbac_tb0219_exit(void) 359static void __devexit tanbac_tb0219_exit(void)
359{ 360{
360 driver_unregister(&tb0219_device_driver); 361 platform_driver_unregister(&tb0219_device_driver);
361 362
362 platform_device_unregister(tb0219_platform_device); 363 platform_device_unregister(tb0219_platform_device);
363} 364}
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index 94641085faf8..9ac6d43437b3 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -613,7 +613,7 @@ static struct file_operations gpio_fops = {
613 .release = gpio_release, 613 .release = gpio_release,
614}; 614};
615 615
616static int giu_probe(struct device *dev) 616static int giu_probe(struct platform_device *dev)
617{ 617{
618 unsigned long start, size, flags = 0; 618 unsigned long start, size, flags = 0;
619 unsigned int nr_pins = 0; 619 unsigned int nr_pins = 0;
@@ -697,7 +697,7 @@ static int giu_probe(struct device *dev)
697 return cascade_irq(GIUINT_IRQ, giu_get_irq); 697 return cascade_irq(GIUINT_IRQ, giu_get_irq);
698} 698}
699 699
700static int giu_remove(struct device *dev) 700static int giu_remove(struct platform_device *dev)
701{ 701{
702 iounmap(giu_base); 702 iounmap(giu_base);
703 703
@@ -710,11 +710,12 @@ static int giu_remove(struct device *dev)
710 710
711static struct platform_device *giu_platform_device; 711static struct platform_device *giu_platform_device;
712 712
713static struct device_driver giu_device_driver = { 713static struct platform_driver giu_device_driver = {
714 .name = "GIU",
715 .bus = &platform_bus_type,
716 .probe = giu_probe, 714 .probe = giu_probe,
717 .remove = giu_remove, 715 .remove = giu_remove,
716 .driver = {
717 .name = "GIU",
718 },
718}; 719};
719 720
720static int __devinit vr41xx_giu_init(void) 721static int __devinit vr41xx_giu_init(void)
@@ -725,7 +726,7 @@ static int __devinit vr41xx_giu_init(void)
725 if (IS_ERR(giu_platform_device)) 726 if (IS_ERR(giu_platform_device))
726 return PTR_ERR(giu_platform_device); 727 return PTR_ERR(giu_platform_device);
727 728
728 retval = driver_register(&giu_device_driver); 729 retval = platform_driver_register(&giu_device_driver);
729 if (retval < 0) 730 if (retval < 0)
730 platform_device_unregister(giu_platform_device); 731 platform_device_unregister(giu_platform_device);
731 732
@@ -734,7 +735,7 @@ static int __devinit vr41xx_giu_init(void)
734 735
735static void __devexit vr41xx_giu_exit(void) 736static void __devexit vr41xx_giu_exit(void)
736{ 737{
737 driver_unregister(&giu_device_driver); 738 platform_driver_unregister(&giu_device_driver);
738 739
739 platform_device_unregister(giu_platform_device); 740 platform_device_unregister(giu_platform_device);
740} 741}
diff --git a/drivers/char/vr41xx_rtc.c b/drivers/char/vr41xx_rtc.c
index 5e3292df69d8..435b30748e23 100644
--- a/drivers/char/vr41xx_rtc.c
+++ b/drivers/char/vr41xx_rtc.c
@@ -560,13 +560,11 @@ static struct miscdevice rtc_miscdevice = {
560 .fops = &rtc_fops, 560 .fops = &rtc_fops,
561}; 561};
562 562
563static int rtc_probe(struct device *dev) 563static int rtc_probe(struct platform_device *pdev)
564{ 564{
565 struct platform_device *pdev;
566 unsigned int irq; 565 unsigned int irq;
567 int retval; 566 int retval;
568 567
569 pdev = to_platform_device(dev);
570 if (pdev->num_resources != 2) 568 if (pdev->num_resources != 2)
571 return -EBUSY; 569 return -EBUSY;
572 570
@@ -635,7 +633,7 @@ static int rtc_probe(struct device *dev)
635 return 0; 633 return 0;
636} 634}
637 635
638static int rtc_remove(struct device *dev) 636static int rtc_remove(struct platform_device *dev)
639{ 637{
640 int retval; 638 int retval;
641 639
@@ -655,11 +653,12 @@ static int rtc_remove(struct device *dev)
655 653
656static struct platform_device *rtc_platform_device; 654static struct platform_device *rtc_platform_device;
657 655
658static struct device_driver rtc_device_driver = { 656static struct platform_driver rtc_device_driver = {
659 .name = rtc_name,
660 .bus = &platform_bus_type,
661 .probe = rtc_probe, 657 .probe = rtc_probe,
662 .remove = rtc_remove, 658 .remove = rtc_remove,
659 .driver = {
660 .name = rtc_name,
661 },
663}; 662};
664 663
665static int __devinit vr41xx_rtc_init(void) 664static int __devinit vr41xx_rtc_init(void)
@@ -691,7 +690,7 @@ static int __devinit vr41xx_rtc_init(void)
691 if (IS_ERR(rtc_platform_device)) 690 if (IS_ERR(rtc_platform_device))
692 return PTR_ERR(rtc_platform_device); 691 return PTR_ERR(rtc_platform_device);
693 692
694 retval = driver_register(&rtc_device_driver); 693 retval = platform_driver_register(&rtc_device_driver);
695 if (retval < 0) 694 if (retval < 0)
696 platform_device_unregister(rtc_platform_device); 695 platform_device_unregister(rtc_platform_device);
697 696
@@ -700,7 +699,7 @@ static int __devinit vr41xx_rtc_init(void)
700 699
701static void __devexit vr41xx_rtc_exit(void) 700static void __devexit vr41xx_rtc_exit(void)
702{ 701{
703 driver_unregister(&rtc_device_driver); 702 platform_driver_unregister(&rtc_device_driver);
704 703
705 platform_device_unregister(rtc_platform_device); 704 platform_device_unregister(rtc_platform_device);
706} 705}
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c
index da631c114fd1..9defcf861b67 100644
--- a/drivers/char/watchdog/mpcore_wdt.c
+++ b/drivers/char/watchdog/mpcore_wdt.c
@@ -139,7 +139,7 @@ static int mpcore_wdt_set_heartbeat(int t)
139 */ 139 */
140static int mpcore_wdt_open(struct inode *inode, struct file *file) 140static int mpcore_wdt_open(struct inode *inode, struct file *file)
141{ 141{
142 struct mpcore_wdt *wdt = dev_get_drvdata(&mpcore_wdt_dev->dev); 142 struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_dev);
143 143
144 if (test_and_set_bit(0, &wdt->timer_alive)) 144 if (test_and_set_bit(0, &wdt->timer_alive))
145 return -EBUSY; 145 return -EBUSY;
@@ -291,9 +291,9 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
291 * System shutdown handler. Turn off the watchdog if we're 291 * System shutdown handler. Turn off the watchdog if we're
292 * restarting or halting the system. 292 * restarting or halting the system.
293 */ 293 */
294static void mpcore_wdt_shutdown(struct device *_dev) 294static void mpcore_wdt_shutdown(struct platform_device *dev)
295{ 295{
296 struct mpcore_wdt *wdt = dev_get_drvdata(_dev); 296 struct mpcore_wdt *wdt = platform_get_drvdata(dev);
297 297
298 if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) 298 if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT)
299 mpcore_wdt_stop(wdt); 299 mpcore_wdt_stop(wdt);
@@ -317,9 +317,8 @@ static struct miscdevice mpcore_wdt_miscdev = {
317 .fops = &mpcore_wdt_fops, 317 .fops = &mpcore_wdt_fops,
318}; 318};
319 319
320static int __devinit mpcore_wdt_probe(struct device *_dev) 320static int __devinit mpcore_wdt_probe(struct platform_device *dev)
321{ 321{
322 struct platform_device *dev = to_platform_device(_dev);
323 struct mpcore_wdt *wdt; 322 struct mpcore_wdt *wdt;
324 struct resource *res; 323 struct resource *res;
325 int ret; 324 int ret;
@@ -364,7 +363,7 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
364 } 363 }
365 364
366 mpcore_wdt_stop(wdt); 365 mpcore_wdt_stop(wdt);
367 dev_set_drvdata(&dev->dev, wdt); 366 platform_set_drvdata(&dev->dev, wdt);
368 mpcore_wdt_dev = dev; 367 mpcore_wdt_dev = dev;
369 368
370 return 0; 369 return 0;
@@ -379,11 +378,11 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
379 return ret; 378 return ret;
380} 379}
381 380
382static int __devexit mpcore_wdt_remove(struct device *dev) 381static int __devexit mpcore_wdt_remove(struct platform_device *dev)
383{ 382{
384 struct mpcore_wdt *wdt = dev_get_drvdata(dev); 383 struct mpcore_wdt *wdt = platform_get_drvdata(dev);
385 384
386 dev_set_drvdata(dev, NULL); 385 platform_set_drvdata(dev, NULL);
387 386
388 misc_deregister(&mpcore_wdt_miscdev); 387 misc_deregister(&mpcore_wdt_miscdev);
389 388
@@ -395,13 +394,14 @@ static int __devexit mpcore_wdt_remove(struct device *dev)
395 return 0; 394 return 0;
396} 395}
397 396
398static struct device_driver mpcore_wdt_driver = { 397static struct platform_driver mpcore_wdt_driver = {
399 .owner = THIS_MODULE,
400 .name = "mpcore_wdt",
401 .bus = &platform_bus_type,
402 .probe = mpcore_wdt_probe, 398 .probe = mpcore_wdt_probe,
403 .remove = __devexit_p(mpcore_wdt_remove), 399 .remove = __devexit_p(mpcore_wdt_remove),
404 .shutdown = mpcore_wdt_shutdown, 400 .shutdown = mpcore_wdt_shutdown,
401 .driver = {
402 .owner = THIS_MODULE,
403 .name = "mpcore_wdt",
404 },
405}; 405};
406 406
407static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; 407static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n";
@@ -420,12 +420,12 @@ static int __init mpcore_wdt_init(void)
420 420
421 printk(banner, mpcore_noboot, mpcore_margin, nowayout); 421 printk(banner, mpcore_noboot, mpcore_margin, nowayout);
422 422
423 return driver_register(&mpcore_wdt_driver); 423 return platform_driver_register(&mpcore_wdt_driver);
424} 424}
425 425
426static void __exit mpcore_wdt_exit(void) 426static void __exit mpcore_wdt_exit(void)
427{ 427{
428 driver_unregister(&mpcore_wdt_driver); 428 platform_driver_unregister(&mpcore_wdt_driver);
429} 429}
430 430
431module_init(mpcore_wdt_init); 431module_init(mpcore_wdt_init);
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c
index 119b3c541d95..00d9ef04a369 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/char/watchdog/mv64x60_wdt.c
@@ -182,10 +182,9 @@ static struct miscdevice mv64x60_wdt_miscdev = {
182 .fops = &mv64x60_wdt_fops, 182 .fops = &mv64x60_wdt_fops,
183}; 183};
184 184
185static int __devinit mv64x60_wdt_probe(struct device *dev) 185static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
186{ 186{
187 struct platform_device *pd = to_platform_device(dev); 187 struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
188 struct mv64x60_wdt_pdata *pdata = pd->dev.platform_data;
189 int bus_clk = 133; 188 int bus_clk = 133;
190 189
191 mv64x60_wdt_timeout = 10; 190 mv64x60_wdt_timeout = 10;
@@ -202,7 +201,7 @@ static int __devinit mv64x60_wdt_probe(struct device *dev)
202 return misc_register(&mv64x60_wdt_miscdev); 201 return misc_register(&mv64x60_wdt_miscdev);
203} 202}
204 203
205static int __devexit mv64x60_wdt_remove(struct device *dev) 204static int __devexit mv64x60_wdt_remove(struct platform_device *dev)
206{ 205{
207 misc_deregister(&mv64x60_wdt_miscdev); 206 misc_deregister(&mv64x60_wdt_miscdev);
208 207
@@ -212,12 +211,13 @@ static int __devexit mv64x60_wdt_remove(struct device *dev)
212 return 0; 211 return 0;
213} 212}
214 213
215static struct device_driver mv64x60_wdt_driver = { 214static struct platform_driver mv64x60_wdt_driver = {
216 .owner = THIS_MODULE,
217 .name = MV64x60_WDT_NAME,
218 .bus = &platform_bus_type,
219 .probe = mv64x60_wdt_probe, 215 .probe = mv64x60_wdt_probe,
220 .remove = __devexit_p(mv64x60_wdt_remove), 216 .remove = __devexit_p(mv64x60_wdt_remove),
217 .driver = {
218 .owner = THIS_MODULE,
219 .name = MV64x60_WDT_NAME,
220 },
221}; 221};
222 222
223static struct platform_device *mv64x60_wdt_dev; 223static struct platform_device *mv64x60_wdt_dev;
@@ -235,14 +235,14 @@ static int __init mv64x60_wdt_init(void)
235 goto out; 235 goto out;
236 } 236 }
237 237
238 ret = driver_register(&mv64x60_wdt_driver); 238 ret = platform_driver_register(&mv64x60_wdt_driver);
239 out: 239 out:
240 return ret; 240 return ret;
241} 241}
242 242
243static void __exit mv64x60_wdt_exit(void) 243static void __exit mv64x60_wdt_exit(void)
244{ 244{
245 driver_unregister(&mv64x60_wdt_driver); 245 platform_driver_unregister(&mv64x60_wdt_driver);
246 platform_device_unregister(mv64x60_wdt_dev); 246 platform_device_unregister(mv64x60_wdt_dev);
247} 247}
248 248
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c
index 751cb77b0715..eb667daee19b 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/char/watchdog/s3c2410_wdt.c
@@ -347,15 +347,14 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
347} 347}
348/* device interface */ 348/* device interface */
349 349
350static int s3c2410wdt_probe(struct device *dev) 350static int s3c2410wdt_probe(struct platform_device *pdev)
351{ 351{
352 struct platform_device *pdev = to_platform_device(dev);
353 struct resource *res; 352 struct resource *res;
354 int started = 0; 353 int started = 0;
355 int ret; 354 int ret;
356 int size; 355 int size;
357 356
358 DBG("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); 357 DBG("%s: probe=%p\n", __FUNCTION__, pdev);
359 358
360 /* get the memory region for the watchdog timer */ 359 /* get the memory region for the watchdog timer */
361 360
@@ -386,13 +385,13 @@ static int s3c2410wdt_probe(struct device *dev)
386 return -ENOENT; 385 return -ENOENT;
387 } 386 }
388 387
389 ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, dev); 388 ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev);
390 if (ret != 0) { 389 if (ret != 0) {
391 printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); 390 printk(KERN_INFO PFX "failed to install irq (%d)\n", ret);
392 return ret; 391 return ret;
393 } 392 }
394 393
395 wdt_clock = clk_get(dev, "watchdog"); 394 wdt_clock = clk_get(&pdev->dev, "watchdog");
396 if (wdt_clock == NULL) { 395 if (wdt_clock == NULL) {
397 printk(KERN_INFO PFX "failed to find watchdog clock source\n"); 396 printk(KERN_INFO PFX "failed to find watchdog clock source\n");
398 return -ENOENT; 397 return -ENOENT;
@@ -430,7 +429,7 @@ static int s3c2410wdt_probe(struct device *dev)
430 return 0; 429 return 0;
431} 430}
432 431
433static int s3c2410wdt_remove(struct device *dev) 432static int s3c2410wdt_remove(struct platform_device *dev)
434{ 433{
435 if (wdt_mem != NULL) { 434 if (wdt_mem != NULL) {
436 release_resource(wdt_mem); 435 release_resource(wdt_mem);
@@ -454,7 +453,7 @@ static int s3c2410wdt_remove(struct device *dev)
454 return 0; 453 return 0;
455} 454}
456 455
457static void s3c2410wdt_shutdown(struct device *dev) 456static void s3c2410wdt_shutdown(struct platform_device *dev)
458{ 457{
459 s3c2410wdt_stop(); 458 s3c2410wdt_stop();
460} 459}
@@ -464,7 +463,7 @@ static void s3c2410wdt_shutdown(struct device *dev)
464static unsigned long wtcon_save; 463static unsigned long wtcon_save;
465static unsigned long wtdat_save; 464static unsigned long wtdat_save;
466 465
467static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) 466static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state)
468{ 467{
469 /* Save watchdog state, and turn it off. */ 468 /* Save watchdog state, and turn it off. */
470 wtcon_save = readl(wdt_base + S3C2410_WTCON); 469 wtcon_save = readl(wdt_base + S3C2410_WTCON);
@@ -476,7 +475,7 @@ static int s3c2410wdt_suspend(struct device *dev, pm_message_t state)
476 return 0; 475 return 0;
477} 476}
478 477
479static int s3c2410wdt_resume(struct device *dev) 478static int s3c2410wdt_resume(struct platform_device *dev)
480{ 479{
481 /* Restore watchdog state. */ 480 /* Restore watchdog state. */
482 481
@@ -496,15 +495,16 @@ static int s3c2410wdt_resume(struct device *dev)
496#endif /* CONFIG_PM */ 495#endif /* CONFIG_PM */
497 496
498 497
499static struct device_driver s3c2410wdt_driver = { 498static struct platform_driver s3c2410wdt_driver = {
500 .owner = THIS_MODULE,
501 .name = "s3c2410-wdt",
502 .bus = &platform_bus_type,
503 .probe = s3c2410wdt_probe, 499 .probe = s3c2410wdt_probe,
504 .remove = s3c2410wdt_remove, 500 .remove = s3c2410wdt_remove,
505 .shutdown = s3c2410wdt_shutdown, 501 .shutdown = s3c2410wdt_shutdown,
506 .suspend = s3c2410wdt_suspend, 502 .suspend = s3c2410wdt_suspend,
507 .resume = s3c2410wdt_resume, 503 .resume = s3c2410wdt_resume,
504 .driver = {
505 .owner = THIS_MODULE,
506 .name = "s3c2410-wdt",
507 },
508}; 508};
509 509
510 510
@@ -513,12 +513,12 @@ static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Si
513static int __init watchdog_init(void) 513static int __init watchdog_init(void)
514{ 514{
515 printk(banner); 515 printk(banner);
516 return driver_register(&s3c2410wdt_driver); 516 return platform_driver_register(&s3c2410wdt_driver);
517} 517}
518 518
519static void __exit watchdog_exit(void) 519static void __exit watchdog_exit(void)
520{ 520{
521 driver_unregister(&s3c2410wdt_driver); 521 platform_driver_unregister(&s3c2410wdt_driver);
522} 522}
523 523
524module_init(watchdog_init); 524module_init(watchdog_init);
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index 1e5dfc7805e2..3bf05d5d0c82 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -284,7 +284,7 @@ out:
284 284
285/* Device model stuff */ 285/* Device model stuff */
286 286
287static int hdaps_probe(struct device *dev) 287static int hdaps_probe(struct platform_device *dev)
288{ 288{
289 int ret; 289 int ret;
290 290
@@ -296,17 +296,18 @@ static int hdaps_probe(struct device *dev)
296 return 0; 296 return 0;
297} 297}
298 298
299static int hdaps_resume(struct device *dev) 299static int hdaps_resume(struct platform_device *dev)
300{ 300{
301 return hdaps_device_init(); 301 return hdaps_device_init();
302} 302}
303 303
304static struct device_driver hdaps_driver = { 304static struct platform_driver hdaps_driver = {
305 .name = "hdaps",
306 .bus = &platform_bus_type,
307 .owner = THIS_MODULE,
308 .probe = hdaps_probe, 305 .probe = hdaps_probe,
309 .resume = hdaps_resume 306 .resume = hdaps_resume,
307 .driver = {
308 .name = "hdaps",
309 .owner = THIS_MODULE,
310 },
310}; 311};
311 312
312/* Input class stuff */ 313/* Input class stuff */
@@ -550,7 +551,7 @@ static int __init hdaps_init(void)
550 goto out; 551 goto out;
551 } 552 }
552 553
553 ret = driver_register(&hdaps_driver); 554 ret = platform_driver_register(&hdaps_driver);
554 if (ret) 555 if (ret)
555 goto out_region; 556 goto out_region;
556 557
@@ -583,7 +584,7 @@ static int __init hdaps_init(void)
583out_device: 584out_device:
584 platform_device_unregister(pdev); 585 platform_device_unregister(pdev);
585out_driver: 586out_driver:
586 driver_unregister(&hdaps_driver); 587 platform_driver_unregister(&hdaps_driver);
587out_region: 588out_region:
588 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); 589 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
589out: 590out:
@@ -597,7 +598,7 @@ static void __exit hdaps_exit(void)
597 input_unregister_device(&hdaps_idev); 598 input_unregister_device(&hdaps_idev);
598 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); 599 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
599 platform_device_unregister(pdev); 600 platform_device_unregister(pdev);
600 driver_unregister(&hdaps_driver); 601 platform_driver_unregister(&hdaps_driver);
601 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); 602 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
602 603
603 printk(KERN_INFO "hdaps: driver unloaded.\n"); 604 printk(KERN_INFO "hdaps: driver unloaded.\n");
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index cfae4ad00fae..1414851a17b8 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -405,10 +405,9 @@ static struct i2c_algorithm iop3xx_i2c_algo = {
405}; 405};
406 406
407static int 407static int
408iop3xx_i2c_remove(struct device *device) 408iop3xx_i2c_remove(struct platform_device *pdev)
409{ 409{
410 struct platform_device *pdev = to_platform_device(device); 410 struct i2c_adapter *padapter = platform_get_drvdata(pdev);
411 struct i2c_adapter *padapter = dev_get_drvdata(&pdev->dev);
412 struct i2c_algo_iop3xx_data *adapter_data = 411 struct i2c_algo_iop3xx_data *adapter_data =
413 (struct i2c_algo_iop3xx_data *)padapter->algo_data; 412 (struct i2c_algo_iop3xx_data *)padapter->algo_data;
414 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 413 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -426,15 +425,14 @@ iop3xx_i2c_remove(struct device *device)
426 kfree(adapter_data); 425 kfree(adapter_data);
427 kfree(padapter); 426 kfree(padapter);
428 427
429 dev_set_drvdata(&pdev->dev, NULL); 428 platform_set_drvdata(pdev, NULL);
430 429
431 return 0; 430 return 0;
432} 431}
433 432
434static int 433static int
435iop3xx_i2c_probe(struct device *dev) 434iop3xx_i2c_probe(struct platform_device *pdev)
436{ 435{
437 struct platform_device *pdev = to_platform_device(dev);
438 struct resource *res; 436 struct resource *res;
439 int ret; 437 int ret;
440 struct i2c_adapter *new_adapter; 438 struct i2c_adapter *new_adapter;
@@ -499,7 +497,7 @@ iop3xx_i2c_probe(struct device *dev)
499 iop3xx_i2c_set_slave_addr(adapter_data); 497 iop3xx_i2c_set_slave_addr(adapter_data);
500 iop3xx_i2c_enable(adapter_data); 498 iop3xx_i2c_enable(adapter_data);
501 499
502 dev_set_drvdata(&pdev->dev, new_adapter); 500 platform_set_drvdata(pdev, new_adapter);
503 new_adapter->algo_data = adapter_data; 501 new_adapter->algo_data = adapter_data;
504 502
505 i2c_add_adapter(new_adapter); 503 i2c_add_adapter(new_adapter);
@@ -523,24 +521,25 @@ out:
523} 521}
524 522
525 523
526static struct device_driver iop3xx_i2c_driver = { 524static struct platform_driver iop3xx_i2c_driver = {
527 .owner = THIS_MODULE,
528 .name = "IOP3xx-I2C",
529 .bus = &platform_bus_type,
530 .probe = iop3xx_i2c_probe, 525 .probe = iop3xx_i2c_probe,
531 .remove = iop3xx_i2c_remove 526 .remove = iop3xx_i2c_remove,
527 .driver = {
528 .owner = THIS_MODULE,
529 .name = "IOP3xx-I2C",
530 },
532}; 531};
533 532
534static int __init 533static int __init
535i2c_iop3xx_init (void) 534i2c_iop3xx_init (void)
536{ 535{
537 return driver_register(&iop3xx_i2c_driver); 536 return platform_driver_register(&iop3xx_i2c_driver);
538} 537}
539 538
540static void __exit 539static void __exit
541i2c_iop3xx_exit (void) 540i2c_iop3xx_exit (void)
542{ 541{
543 driver_unregister(&iop3xx_i2c_driver); 542 platform_driver_unregister(&iop3xx_i2c_driver);
544 return; 543 return;
545} 544}
546 545
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
index 64552a376f2d..cef024a7d048 100644
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -86,12 +86,11 @@ struct ixp2000_i2c_data {
86 struct i2c_algo_bit_data algo_data; 86 struct i2c_algo_bit_data algo_data;
87}; 87};
88 88
89static int ixp2000_i2c_remove(struct device *dev) 89static int ixp2000_i2c_remove(struct platform_device *plat_dev)
90{ 90{
91 struct platform_device *plat_dev = to_platform_device(dev); 91 struct ixp2000_i2c_data *drv_data = platform_get_drvdata(plat_dev);
92 struct ixp2000_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
93 92
94 dev_set_drvdata(&plat_dev->dev, NULL); 93 platform_set_drvdata(plat_dev, NULL);
95 94
96 i2c_bit_del_bus(&drv_data->adapter); 95 i2c_bit_del_bus(&drv_data->adapter);
97 96
@@ -100,10 +99,9 @@ static int ixp2000_i2c_remove(struct device *dev)
100 return 0; 99 return 0;
101} 100}
102 101
103static int ixp2000_i2c_probe(struct device *dev) 102static int ixp2000_i2c_probe(struct platform_device *plat_dev)
104{ 103{
105 int err; 104 int err;
106 struct platform_device *plat_dev = to_platform_device(dev);
107 struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; 105 struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data;
108 struct ixp2000_i2c_data *drv_data = 106 struct ixp2000_i2c_data *drv_data =
109 kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); 107 kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL);
@@ -139,27 +137,28 @@ static int ixp2000_i2c_probe(struct device *dev)
139 return err; 137 return err;
140 } 138 }
141 139
142 dev_set_drvdata(&plat_dev->dev, drv_data); 140 platform_set_drvdata(plat_dev, drv_data);
143 141
144 return 0; 142 return 0;
145} 143}
146 144
147static struct device_driver ixp2000_i2c_driver = { 145static struct platform_driver ixp2000_i2c_driver = {
148 .owner = THIS_MODULE,
149 .name = "IXP2000-I2C",
150 .bus = &platform_bus_type,
151 .probe = ixp2000_i2c_probe, 146 .probe = ixp2000_i2c_probe,
152 .remove = ixp2000_i2c_remove, 147 .remove = ixp2000_i2c_remove,
148 .driver = {
149 .name = "IXP2000-I2C",
150 .owner = THIS_MODULE,
151 },
153}; 152};
154 153
155static int __init ixp2000_i2c_init(void) 154static int __init ixp2000_i2c_init(void)
156{ 155{
157 return driver_register(&ixp2000_i2c_driver); 156 return platform_driver_register(&ixp2000_i2c_driver);
158} 157}
159 158
160static void __exit ixp2000_i2c_exit(void) 159static void __exit ixp2000_i2c_exit(void)
161{ 160{
162 driver_unregister(&ixp2000_i2c_driver); 161 platform_driver_unregister(&ixp2000_i2c_driver);
163} 162}
164 163
165module_init(ixp2000_i2c_init); 164module_init(ixp2000_i2c_init);
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index cc652c350814..aa36855fa995 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -87,12 +87,11 @@ struct ixp4xx_i2c_data {
87 struct i2c_algo_bit_data algo_data; 87 struct i2c_algo_bit_data algo_data;
88}; 88};
89 89
90static int ixp4xx_i2c_remove(struct device *dev) 90static int ixp4xx_i2c_remove(struct platform_device *plat_dev)
91{ 91{
92 struct platform_device *plat_dev = to_platform_device(dev); 92 struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev);
93 struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
94 93
95 dev_set_drvdata(&plat_dev->dev, NULL); 94 platform_set_drvdata(plat_dev, NULL);
96 95
97 i2c_bit_del_bus(&drv_data->adapter); 96 i2c_bit_del_bus(&drv_data->adapter);
98 97
@@ -101,10 +100,9 @@ static int ixp4xx_i2c_remove(struct device *dev)
101 return 0; 100 return 0;
102} 101}
103 102
104static int ixp4xx_i2c_probe(struct device *dev) 103static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
105{ 104{
106 int err; 105 int err;
107 struct platform_device *plat_dev = to_platform_device(dev);
108 struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; 106 struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
109 struct ixp4xx_i2c_data *drv_data = 107 struct ixp4xx_i2c_data *drv_data =
110 kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); 108 kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
@@ -148,27 +146,28 @@ static int ixp4xx_i2c_probe(struct device *dev)
148 return err; 146 return err;
149 } 147 }
150 148
151 dev_set_drvdata(&plat_dev->dev, drv_data); 149 platform_set_drvdata(plat_dev, drv_data);
152 150
153 return 0; 151 return 0;
154} 152}
155 153
156static struct device_driver ixp4xx_i2c_driver = { 154static struct platform_driver ixp4xx_i2c_driver = {
157 .owner = THIS_MODULE,
158 .name = "IXP4XX-I2C",
159 .bus = &platform_bus_type,
160 .probe = ixp4xx_i2c_probe, 155 .probe = ixp4xx_i2c_probe,
161 .remove = ixp4xx_i2c_remove, 156 .remove = ixp4xx_i2c_remove,
157 .driver = {
158 .name = "IXP4XX-I2C",
159 .owner = THIS_MODULE,
160 },
162}; 161};
163 162
164static int __init ixp4xx_i2c_init(void) 163static int __init ixp4xx_i2c_init(void)
165{ 164{
166 return driver_register(&ixp4xx_i2c_driver); 165 return platform_driver_register(&ixp4xx_i2c_driver);
167} 166}
168 167
169static void __exit ixp4xx_i2c_exit(void) 168static void __exit ixp4xx_i2c_exit(void)
170{ 169{
171 driver_unregister(&ixp4xx_i2c_driver); 170 platform_driver_unregister(&ixp4xx_i2c_driver);
172} 171}
173 172
174module_init(ixp4xx_i2c_init); 173module_init(ixp4xx_i2c_init);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 65b939a059e9..5ccd338a9dc9 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -288,11 +288,10 @@ static struct i2c_adapter mpc_ops = {
288 .retries = 1 288 .retries = 1
289}; 289};
290 290
291static int fsl_i2c_probe(struct device *device) 291static int fsl_i2c_probe(struct platform_device *pdev)
292{ 292{
293 int result = 0; 293 int result = 0;
294 struct mpc_i2c *i2c; 294 struct mpc_i2c *i2c;
295 struct platform_device *pdev = to_platform_device(device);
296 struct fsl_i2c_platform_data *pdata; 295 struct fsl_i2c_platform_data *pdata;
297 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 296 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
298 297
@@ -323,7 +322,7 @@ static int fsl_i2c_probe(struct device *device)
323 } 322 }
324 323
325 mpc_i2c_setclock(i2c); 324 mpc_i2c_setclock(i2c);
326 dev_set_drvdata(device, i2c); 325 platform_set_drvdata(pdev, i2c);
327 326
328 i2c->adap = mpc_ops; 327 i2c->adap = mpc_ops;
329 i2c_set_adapdata(&i2c->adap, i2c); 328 i2c_set_adapdata(&i2c->adap, i2c);
@@ -345,12 +344,12 @@ static int fsl_i2c_probe(struct device *device)
345 return result; 344 return result;
346}; 345};
347 346
348static int fsl_i2c_remove(struct device *device) 347static int fsl_i2c_remove(struct platform_device *pdev)
349{ 348{
350 struct mpc_i2c *i2c = dev_get_drvdata(device); 349 struct mpc_i2c *i2c = platform_get_drvdata(pdev);
351 350
352 i2c_del_adapter(&i2c->adap); 351 i2c_del_adapter(&i2c->adap);
353 dev_set_drvdata(device, NULL); 352 platform_set_drvdata(pdev, NULL);
354 353
355 if (i2c->irq != 0) 354 if (i2c->irq != 0)
356 free_irq(i2c->irq, i2c); 355 free_irq(i2c->irq, i2c);
@@ -361,22 +360,23 @@ static int fsl_i2c_remove(struct device *device)
361}; 360};
362 361
363/* Structure for a device driver */ 362/* Structure for a device driver */
364static struct device_driver fsl_i2c_driver = { 363static struct platform_driver fsl_i2c_driver = {
365 .owner = THIS_MODULE,
366 .name = "fsl-i2c",
367 .bus = &platform_bus_type,
368 .probe = fsl_i2c_probe, 364 .probe = fsl_i2c_probe,
369 .remove = fsl_i2c_remove, 365 .remove = fsl_i2c_remove,
366 .driver = {
367 .owner = THIS_MODULE,
368 .name = "fsl-i2c",
369 },
370}; 370};
371 371
372static int __init fsl_i2c_init(void) 372static int __init fsl_i2c_init(void)
373{ 373{
374 return driver_register(&fsl_i2c_driver); 374 return platform_driver_register(&fsl_i2c_driver);
375} 375}
376 376
377static void __exit fsl_i2c_exit(void) 377static void __exit fsl_i2c_exit(void)
378{ 378{
379 driver_unregister(&fsl_i2c_driver); 379 platform_driver_unregister(&fsl_i2c_driver);
380} 380}
381 381
382module_init(fsl_i2c_init); 382module_init(fsl_i2c_init);
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 6b48027b2ee3..afd7634e5cc9 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -492,11 +492,10 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
492} 492}
493 493
494static int __devinit 494static int __devinit
495mv64xxx_i2c_probe(struct device *dev) 495mv64xxx_i2c_probe(struct platform_device *pd)
496{ 496{
497 struct platform_device *pd = to_platform_device(dev);
498 struct mv64xxx_i2c_data *drv_data; 497 struct mv64xxx_i2c_data *drv_data;
499 struct mv64xxx_i2c_pdata *pdata = dev->platform_data; 498 struct mv64xxx_i2c_pdata *pdata = pd->dev.platform_data;
500 int rc; 499 int rc;
501 500
502 if ((pd->id != 0) || !pdata) 501 if ((pd->id != 0) || !pdata)
@@ -526,7 +525,7 @@ mv64xxx_i2c_probe(struct device *dev)
526 drv_data->adapter.class = I2C_CLASS_HWMON; 525 drv_data->adapter.class = I2C_CLASS_HWMON;
527 drv_data->adapter.timeout = pdata->timeout; 526 drv_data->adapter.timeout = pdata->timeout;
528 drv_data->adapter.retries = pdata->retries; 527 drv_data->adapter.retries = pdata->retries;
529 dev_set_drvdata(dev, drv_data); 528 platform_set_drvdata(pd, drv_data);
530 i2c_set_adapdata(&drv_data->adapter, drv_data); 529 i2c_set_adapdata(&drv_data->adapter, drv_data);
531 530
532 if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, 531 if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
@@ -555,9 +554,9 @@ mv64xxx_i2c_probe(struct device *dev)
555} 554}
556 555
557static int __devexit 556static int __devexit
558mv64xxx_i2c_remove(struct device *dev) 557mv64xxx_i2c_remove(struct platform_device *dev)
559{ 558{
560 struct mv64xxx_i2c_data *drv_data = dev_get_drvdata(dev); 559 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev);
561 int rc; 560 int rc;
562 561
563 rc = i2c_del_adapter(&drv_data->adapter); 562 rc = i2c_del_adapter(&drv_data->adapter);
@@ -568,24 +567,25 @@ mv64xxx_i2c_remove(struct device *dev)
568 return rc; 567 return rc;
569} 568}
570 569
571static struct device_driver mv64xxx_i2c_driver = { 570static struct platform_driver mv64xxx_i2c_driver = {
572 .owner = THIS_MODULE,
573 .name = MV64XXX_I2C_CTLR_NAME,
574 .bus = &platform_bus_type,
575 .probe = mv64xxx_i2c_probe, 571 .probe = mv64xxx_i2c_probe,
576 .remove = mv64xxx_i2c_remove, 572 .remove = mv64xxx_i2c_remove,
573 .driver = {
574 .owner = THIS_MODULE,
575 .name = MV64XXX_I2C_CTLR_NAME,
576 },
577}; 577};
578 578
579static int __init 579static int __init
580mv64xxx_i2c_init(void) 580mv64xxx_i2c_init(void)
581{ 581{
582 return driver_register(&mv64xxx_i2c_driver); 582 return platform_driver_register(&mv64xxx_i2c_driver);
583} 583}
584 584
585static void __exit 585static void __exit
586mv64xxx_i2c_exit(void) 586mv64xxx_i2c_exit(void)
587{ 587{
588 driver_unregister(&mv64xxx_i2c_driver); 588 platform_driver_unregister(&mv64xxx_i2c_driver);
589} 589}
590 590
591module_init(mv64xxx_i2c_init); 591module_init(mv64xxx_i2c_init);
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 67ccbea24ba4..70f7ab829d36 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -936,10 +936,10 @@ static struct pxa_i2c i2c_pxa = {
936 }, 936 },
937}; 937};
938 938
939static int i2c_pxa_probe(struct device *dev) 939static int i2c_pxa_probe(struct platform_device *dev)
940{ 940{
941 struct pxa_i2c *i2c = &i2c_pxa; 941 struct pxa_i2c *i2c = &i2c_pxa;
942 struct i2c_pxa_platform_data *plat = dev->platform_data; 942 struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
943 int ret; 943 int ret;
944 944
945#ifdef CONFIG_PXA27x 945#ifdef CONFIG_PXA27x
@@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct device *dev)
968 i2c_pxa_reset(i2c); 968 i2c_pxa_reset(i2c);
969 969
970 i2c->adap.algo_data = i2c; 970 i2c->adap.algo_data = i2c;
971 i2c->adap.dev.parent = dev; 971 i2c->adap.dev.parent = &dev->dev;
972 972
973 ret = i2c_add_adapter(&i2c->adap); 973 ret = i2c_add_adapter(&i2c->adap);
974 if (ret < 0) { 974 if (ret < 0) {
@@ -976,7 +976,7 @@ static int i2c_pxa_probe(struct device *dev)
976 goto err_irq; 976 goto err_irq;
977 } 977 }
978 978
979 dev_set_drvdata(dev, i2c); 979 platform_set_drvdata(dev, i2c);
980 980
981#ifdef CONFIG_I2C_PXA_SLAVE 981#ifdef CONFIG_I2C_PXA_SLAVE
982 printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", 982 printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
@@ -993,11 +993,11 @@ static int i2c_pxa_probe(struct device *dev)
993 return ret; 993 return ret;
994} 994}
995 995
996static int i2c_pxa_remove(struct device *dev) 996static int i2c_pxa_remove(struct platform_device *dev)
997{ 997{
998 struct pxa_i2c *i2c = dev_get_drvdata(dev); 998 struct pxa_i2c *i2c = platform_get_drvdata(dev);
999 999
1000 dev_set_drvdata(dev, NULL); 1000 platform_set_drvdata(dev, NULL);
1001 1001
1002 i2c_del_adapter(&i2c->adap); 1002 i2c_del_adapter(&i2c->adap);
1003 free_irq(IRQ_I2C, i2c); 1003 free_irq(IRQ_I2C, i2c);
@@ -1006,21 +1006,22 @@ static int i2c_pxa_remove(struct device *dev)
1006 return 0; 1006 return 0;
1007} 1007}
1008 1008
1009static struct device_driver i2c_pxa_driver = { 1009static struct platform_driver i2c_pxa_driver = {
1010 .name = "pxa2xx-i2c",
1011 .bus = &platform_bus_type,
1012 .probe = i2c_pxa_probe, 1010 .probe = i2c_pxa_probe,
1013 .remove = i2c_pxa_remove, 1011 .remove = i2c_pxa_remove,
1012 .driver = {
1013 .name = "pxa2xx-i2c",
1014 },
1014}; 1015};
1015 1016
1016static int __init i2c_adap_pxa_init(void) 1017static int __init i2c_adap_pxa_init(void)
1017{ 1018{
1018 return driver_register(&i2c_pxa_driver); 1019 return platform_driver_register(&i2c_pxa_driver);
1019} 1020}
1020 1021
1021static void i2c_adap_pxa_exit(void) 1022static void i2c_adap_pxa_exit(void)
1022{ 1023{
1023 return driver_unregister(&i2c_pxa_driver); 1024 return platform_driver_unregister(&i2c_pxa_driver);
1024} 1025}
1025 1026
1026module_init(i2c_adap_pxa_init); 1027module_init(i2c_adap_pxa_init);
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 1b582262e677..58cfd3111ef6 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -760,24 +760,23 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
760 * called by the bus driver when a suitable device is found 760 * called by the bus driver when a suitable device is found
761*/ 761*/
762 762
763static int s3c24xx_i2c_probe(struct device *dev) 763static int s3c24xx_i2c_probe(struct platform_device *pdev)
764{ 764{
765 struct platform_device *pdev = to_platform_device(dev);
766 struct s3c24xx_i2c *i2c = &s3c24xx_i2c; 765 struct s3c24xx_i2c *i2c = &s3c24xx_i2c;
767 struct resource *res; 766 struct resource *res;
768 int ret; 767 int ret;
769 768
770 /* find the clock and enable it */ 769 /* find the clock and enable it */
771 770
772 i2c->dev = dev; 771 i2c->dev = &pdev->dev;
773 i2c->clk = clk_get(dev, "i2c"); 772 i2c->clk = clk_get(&pdev->dev, "i2c");
774 if (IS_ERR(i2c->clk)) { 773 if (IS_ERR(i2c->clk)) {
775 dev_err(dev, "cannot get clock\n"); 774 dev_err(&pdev->dev, "cannot get clock\n");
776 ret = -ENOENT; 775 ret = -ENOENT;
777 goto out; 776 goto out;
778 } 777 }
779 778
780 dev_dbg(dev, "clock source %p\n", i2c->clk); 779 dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
781 780
782 clk_use(i2c->clk); 781 clk_use(i2c->clk);
783 clk_enable(i2c->clk); 782 clk_enable(i2c->clk);
@@ -786,7 +785,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
786 785
787 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 786 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
788 if (res == NULL) { 787 if (res == NULL) {
789 dev_err(dev, "cannot find IO resource\n"); 788 dev_err(&pdev->dev, "cannot find IO resource\n");
790 ret = -ENOENT; 789 ret = -ENOENT;
791 goto out; 790 goto out;
792 } 791 }
@@ -795,7 +794,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
795 pdev->name); 794 pdev->name);
796 795
797 if (i2c->ioarea == NULL) { 796 if (i2c->ioarea == NULL) {
798 dev_err(dev, "cannot request IO\n"); 797 dev_err(&pdev->dev, "cannot request IO\n");
799 ret = -ENXIO; 798 ret = -ENXIO;
800 goto out; 799 goto out;
801 } 800 }
@@ -803,17 +802,17 @@ static int s3c24xx_i2c_probe(struct device *dev)
803 i2c->regs = ioremap(res->start, (res->end-res->start)+1); 802 i2c->regs = ioremap(res->start, (res->end-res->start)+1);
804 803
805 if (i2c->regs == NULL) { 804 if (i2c->regs == NULL) {
806 dev_err(dev, "cannot map IO\n"); 805 dev_err(&pdev->dev, "cannot map IO\n");
807 ret = -ENXIO; 806 ret = -ENXIO;
808 goto out; 807 goto out;
809 } 808 }
810 809
811 dev_dbg(dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); 810 dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res);
812 811
813 /* setup info block for the i2c core */ 812 /* setup info block for the i2c core */
814 813
815 i2c->adap.algo_data = i2c; 814 i2c->adap.algo_data = i2c;
816 i2c->adap.dev.parent = dev; 815 i2c->adap.dev.parent = &pdev->dev;
817 816
818 /* initialise the i2c controller */ 817 /* initialise the i2c controller */
819 818
@@ -827,7 +826,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
827 826
828 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 827 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
829 if (res == NULL) { 828 if (res == NULL) {
830 dev_err(dev, "cannot find IRQ\n"); 829 dev_err(&pdev->dev, "cannot find IRQ\n");
831 ret = -ENOENT; 830 ret = -ENOENT;
832 goto out; 831 goto out;
833 } 832 }
@@ -836,23 +835,23 @@ static int s3c24xx_i2c_probe(struct device *dev)
836 pdev->name, i2c); 835 pdev->name, i2c);
837 836
838 if (ret != 0) { 837 if (ret != 0) {
839 dev_err(dev, "cannot claim IRQ\n"); 838 dev_err(&pdev->dev, "cannot claim IRQ\n");
840 goto out; 839 goto out;
841 } 840 }
842 841
843 i2c->irq = res; 842 i2c->irq = res;
844 843
845 dev_dbg(dev, "irq resource %p (%ld)\n", res, res->start); 844 dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start);
846 845
847 ret = i2c_add_adapter(&i2c->adap); 846 ret = i2c_add_adapter(&i2c->adap);
848 if (ret < 0) { 847 if (ret < 0) {
849 dev_err(dev, "failed to add bus to i2c core\n"); 848 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
850 goto out; 849 goto out;
851 } 850 }
852 851
853 dev_set_drvdata(dev, i2c); 852 platform_set_drvdata(pdev, i2c);
854 853
855 dev_info(dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); 854 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
856 855
857 out: 856 out:
858 if (ret < 0) 857 if (ret < 0)
@@ -866,22 +865,22 @@ static int s3c24xx_i2c_probe(struct device *dev)
866 * called when device is removed from the bus 865 * called when device is removed from the bus
867*/ 866*/
868 867
869static int s3c24xx_i2c_remove(struct device *dev) 868static int s3c24xx_i2c_remove(struct platform_device *pdev)
870{ 869{
871 struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); 870 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
872 871
873 if (i2c != NULL) { 872 if (i2c != NULL) {
874 s3c24xx_i2c_free(i2c); 873 s3c24xx_i2c_free(i2c);
875 dev_set_drvdata(dev, NULL); 874 platform_set_drvdata(pdev, NULL);
876 } 875 }
877 876
878 return 0; 877 return 0;
879} 878}
880 879
881#ifdef CONFIG_PM 880#ifdef CONFIG_PM
882static int s3c24xx_i2c_resume(struct device *dev) 881static int s3c24xx_i2c_resume(struct platform_device *dev)
883{ 882{
884 struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); 883 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
885 884
886 if (i2c != NULL) 885 if (i2c != NULL)
887 s3c24xx_i2c_init(i2c); 886 s3c24xx_i2c_init(i2c);
@@ -895,33 +894,35 @@ static int s3c24xx_i2c_resume(struct device *dev)
895 894
896/* device driver for platform bus bits */ 895/* device driver for platform bus bits */
897 896
898static struct device_driver s3c2410_i2c_driver = { 897static struct platform_driver s3c2410_i2c_driver = {
899 .owner = THIS_MODULE,
900 .name = "s3c2410-i2c",
901 .bus = &platform_bus_type,
902 .probe = s3c24xx_i2c_probe, 898 .probe = s3c24xx_i2c_probe,
903 .remove = s3c24xx_i2c_remove, 899 .remove = s3c24xx_i2c_remove,
904 .resume = s3c24xx_i2c_resume, 900 .resume = s3c24xx_i2c_resume,
901 .driver = {
902 .owner = THIS_MODULE,
903 .name = "s3c2410-i2c",
904 },
905}; 905};
906 906
907static struct device_driver s3c2440_i2c_driver = { 907static struct platform_driver s3c2440_i2c_driver = {
908 .owner = THIS_MODULE,
909 .name = "s3c2440-i2c",
910 .bus = &platform_bus_type,
911 .probe = s3c24xx_i2c_probe, 908 .probe = s3c24xx_i2c_probe,
912 .remove = s3c24xx_i2c_remove, 909 .remove = s3c24xx_i2c_remove,
913 .resume = s3c24xx_i2c_resume, 910 .resume = s3c24xx_i2c_resume,
911 .driver = {
912 .owner = THIS_MODULE,
913 .name = "s3c2440-i2c",
914 },
914}; 915};
915 916
916static int __init i2c_adap_s3c_init(void) 917static int __init i2c_adap_s3c_init(void)
917{ 918{
918 int ret; 919 int ret;
919 920
920 ret = driver_register(&s3c2410_i2c_driver); 921 ret = platform_driver_register(&s3c2410_i2c_driver);
921 if (ret == 0) { 922 if (ret == 0) {
922 ret = driver_register(&s3c2440_i2c_driver); 923 ret = platform_driver_register(&s3c2440_i2c_driver);
923 if (ret) 924 if (ret)
924 driver_unregister(&s3c2410_i2c_driver); 925 platform_driver_unregister(&s3c2410_i2c_driver);
925 } 926 }
926 927
927 return ret; 928 return ret;
@@ -929,8 +930,8 @@ static int __init i2c_adap_s3c_init(void)
929 930
930static void __exit i2c_adap_s3c_exit(void) 931static void __exit i2c_adap_s3c_exit(void)
931{ 932{
932 driver_unregister(&s3c2410_i2c_driver); 933 platform_driver_unregister(&s3c2410_i2c_driver);
933 driver_unregister(&s3c2440_i2c_driver); 934 platform_driver_unregister(&s3c2440_i2c_driver);
934} 935}
935 936
936module_init(i2c_adap_s3c_init); 937module_init(i2c_adap_s3c_init);
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index 9dbb72fffbe2..d2a100d77839 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -873,26 +873,27 @@ static int otg_init(struct isp1301 *isp)
873 return 0; 873 return 0;
874} 874}
875 875
876static int otg_probe(struct device *dev) 876static int otg_probe(struct platform_device *dev)
877{ 877{
878 // struct omap_usb_config *config = dev->platform_data; 878 // struct omap_usb_config *config = dev->platform_data;
879 879
880 otg_dev = to_platform_device(dev); 880 otg_dev = dev;
881 return 0; 881 return 0;
882} 882}
883 883
884static int otg_remove(struct device *dev) 884static int otg_remove(struct platform_device *dev)
885{ 885{
886 otg_dev = 0; 886 otg_dev = 0;
887 return 0; 887 return 0;
888} 888}
889 889
890struct device_driver omap_otg_driver = { 890struct platform_driver omap_otg_driver = {
891 .owner = THIS_MODULE,
892 .name = "omap_otg",
893 .bus = &platform_bus_type,
894 .probe = otg_probe, 891 .probe = otg_probe,
895 .remove = otg_remove, 892 .remove = otg_remove,
893 .driver = {
894 .owner = THIS_MODULE,
895 .name = "omap_otg",
896 },
896}; 897};
897 898
898static int otg_bind(struct isp1301 *isp) 899static int otg_bind(struct isp1301 *isp)
@@ -902,7 +903,7 @@ static int otg_bind(struct isp1301 *isp)
902 if (otg_dev) 903 if (otg_dev)
903 return -EBUSY; 904 return -EBUSY;
904 905
905 status = driver_register(&omap_otg_driver); 906 status = platform_driver_register(&omap_otg_driver);
906 if (status < 0) 907 if (status < 0)
907 return status; 908 return status;
908 909
@@ -913,7 +914,7 @@ static int otg_bind(struct isp1301 *isp)
913 status = -ENODEV; 914 status = -ENODEV;
914 915
915 if (status < 0) 916 if (status < 0)
916 driver_unregister(&omap_otg_driver); 917 platform_driver_unregister(&omap_otg_driver);
917 return status; 918 return status;
918} 919}
919 920
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index d00d14bb637a..64672d491222 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -259,17 +259,17 @@ static void corgikbd_hinge_timer(unsigned long data)
259} 259}
260 260
261#ifdef CONFIG_PM 261#ifdef CONFIG_PM
262static int corgikbd_suspend(struct device *dev, pm_message_t state) 262static int corgikbd_suspend(struct platform_device *dev, pm_message_t state)
263{ 263{
264 struct corgikbd *corgikbd = dev_get_drvdata(dev); 264 struct corgikbd *corgikbd = platform_get_drvdata(dev);
265 corgikbd->suspended = 1; 265 corgikbd->suspended = 1;
266 266
267 return 0; 267 return 0;
268} 268}
269 269
270static int corgikbd_resume(struct device *dev) 270static int corgikbd_resume(struct platform_device *dev)
271{ 271{
272 struct corgikbd *corgikbd = dev_get_drvdata(dev); 272 struct corgikbd *corgikbd = platform_get_drvdata(dev);
273 273
274 /* Upon resume, ignore the suspend key for a short while */ 274 /* Upon resume, ignore the suspend key for a short while */
275 corgikbd->suspend_jiffies=jiffies; 275 corgikbd->suspend_jiffies=jiffies;
@@ -282,7 +282,7 @@ static int corgikbd_resume(struct device *dev)
282#define corgikbd_resume NULL 282#define corgikbd_resume NULL
283#endif 283#endif
284 284
285static int __init corgikbd_probe(struct device *dev) 285static int __init corgikbd_probe(struct platform_device *pdev)
286{ 286{
287 struct corgikbd *corgikbd; 287 struct corgikbd *corgikbd;
288 struct input_dev *input_dev; 288 struct input_dev *input_dev;
@@ -296,7 +296,7 @@ static int __init corgikbd_probe(struct device *dev)
296 return -ENOMEM; 296 return -ENOMEM;
297 } 297 }
298 298
299 dev_set_drvdata(dev, corgikbd); 299 platform_set_drvdata(pdev, corgikbd);
300 300
301 corgikbd->input = input_dev; 301 corgikbd->input = input_dev;
302 spin_lock_init(&corgikbd->lock); 302 spin_lock_init(&corgikbd->lock);
@@ -321,7 +321,7 @@ static int __init corgikbd_probe(struct device *dev)
321 input_dev->id.vendor = 0x0001; 321 input_dev->id.vendor = 0x0001;
322 input_dev->id.product = 0x0001; 322 input_dev->id.product = 0x0001;
323 input_dev->id.version = 0x0100; 323 input_dev->id.version = 0x0100;
324 input_dev->cdev.dev = dev; 324 input_dev->cdev.dev = &pdev->dev;
325 input_dev->private = corgikbd; 325 input_dev->private = corgikbd;
326 326
327 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); 327 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
@@ -356,10 +356,10 @@ static int __init corgikbd_probe(struct device *dev)
356 return 0; 356 return 0;
357} 357}
358 358
359static int corgikbd_remove(struct device *dev) 359static int corgikbd_remove(struct platform_device *pdev)
360{ 360{
361 int i; 361 int i;
362 struct corgikbd *corgikbd = dev_get_drvdata(dev); 362 struct corgikbd *corgikbd = platform_get_drvdata(pdev);
363 363
364 for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) 364 for (i = 0; i < CORGI_KEY_SENSE_NUM; i++)
365 free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); 365 free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd);
@@ -374,23 +374,24 @@ static int corgikbd_remove(struct device *dev)
374 return 0; 374 return 0;
375} 375}
376 376
377static struct device_driver corgikbd_driver = { 377static struct platform_driver corgikbd_driver = {
378 .name = "corgi-keyboard",
379 .bus = &platform_bus_type,
380 .probe = corgikbd_probe, 378 .probe = corgikbd_probe,
381 .remove = corgikbd_remove, 379 .remove = corgikbd_remove,
382 .suspend = corgikbd_suspend, 380 .suspend = corgikbd_suspend,
383 .resume = corgikbd_resume, 381 .resume = corgikbd_resume,
382 .driver = {
383 .name = "corgi-keyboard",
384 },
384}; 385};
385 386
386static int __devinit corgikbd_init(void) 387static int __devinit corgikbd_init(void)
387{ 388{
388 return driver_register(&corgikbd_driver); 389 return platform_driver_register(&corgikbd_driver);
389} 390}
390 391
391static void __exit corgikbd_exit(void) 392static void __exit corgikbd_exit(void)
392{ 393{
393 driver_unregister(&corgikbd_driver); 394 platform_driver_unregister(&corgikbd_driver);
394} 395}
395 396
396module_init(corgikbd_init); 397module_init(corgikbd_init);
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 0fa38a559cdf..6a15fe3bc527 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -309,10 +309,10 @@ static void spitzkbd_hinge_timer(unsigned long data)
309} 309}
310 310
311#ifdef CONFIG_PM 311#ifdef CONFIG_PM
312static int spitzkbd_suspend(struct device *dev, pm_message_t state) 312static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state)
313{ 313{
314 int i; 314 int i;
315 struct spitzkbd *spitzkbd = dev_get_drvdata(dev); 315 struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
316 spitzkbd->suspended = 1; 316 spitzkbd->suspended = 1;
317 317
318 /* Set Strobe lines as inputs - *except* strobe line 0 leave this 318 /* Set Strobe lines as inputs - *except* strobe line 0 leave this
@@ -323,10 +323,10 @@ static int spitzkbd_suspend(struct device *dev, pm_message_t state)
323 return 0; 323 return 0;
324} 324}
325 325
326static int spitzkbd_resume(struct device *dev) 326static int spitzkbd_resume(struct platform_device *dev)
327{ 327{
328 int i; 328 int i;
329 struct spitzkbd *spitzkbd = dev_get_drvdata(dev); 329 struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
330 330
331 for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) 331 for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
332 pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); 332 pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
@@ -342,7 +342,7 @@ static int spitzkbd_resume(struct device *dev)
342#define spitzkbd_resume NULL 342#define spitzkbd_resume NULL
343#endif 343#endif
344 344
345static int __init spitzkbd_probe(struct device *dev) 345static int __init spitzkbd_probe(struct platform_device *dev)
346{ 346{
347 struct spitzkbd *spitzkbd; 347 struct spitzkbd *spitzkbd;
348 struct input_dev *input_dev; 348 struct input_dev *input_dev;
@@ -358,7 +358,7 @@ static int __init spitzkbd_probe(struct device *dev)
358 return -ENOMEM; 358 return -ENOMEM;
359 } 359 }
360 360
361 dev_set_drvdata(dev, spitzkbd); 361 platform_set_drvdata(dev, spitzkbd);
362 strcpy(spitzkbd->phys, "spitzkbd/input0"); 362 strcpy(spitzkbd->phys, "spitzkbd/input0");
363 363
364 spin_lock_init(&spitzkbd->lock); 364 spin_lock_init(&spitzkbd->lock);
@@ -380,7 +380,7 @@ static int __init spitzkbd_probe(struct device *dev)
380 input_dev->private = spitzkbd; 380 input_dev->private = spitzkbd;
381 input_dev->name = "Spitz Keyboard"; 381 input_dev->name = "Spitz Keyboard";
382 input_dev->phys = spitzkbd->phys; 382 input_dev->phys = spitzkbd->phys;
383 input_dev->cdev.dev = dev; 383 input_dev->cdev.dev = &dev->dev;
384 384
385 input_dev->id.bustype = BUS_HOST; 385 input_dev->id.bustype = BUS_HOST;
386 input_dev->id.vendor = 0x0001; 386 input_dev->id.vendor = 0x0001;
@@ -437,10 +437,10 @@ static int __init spitzkbd_probe(struct device *dev)
437 return 0; 437 return 0;
438} 438}
439 439
440static int spitzkbd_remove(struct device *dev) 440static int spitzkbd_remove(struct platform_device *dev)
441{ 441{
442 int i; 442 int i;
443 struct spitzkbd *spitzkbd = dev_get_drvdata(dev); 443 struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
444 444
445 for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) 445 for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++)
446 free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); 446 free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd);
@@ -460,23 +460,24 @@ static int spitzkbd_remove(struct device *dev)
460 return 0; 460 return 0;
461} 461}
462 462
463static struct device_driver spitzkbd_driver = { 463static struct platform_driver spitzkbd_driver = {
464 .name = "spitz-keyboard",
465 .bus = &platform_bus_type,
466 .probe = spitzkbd_probe, 464 .probe = spitzkbd_probe,
467 .remove = spitzkbd_remove, 465 .remove = spitzkbd_remove,
468 .suspend = spitzkbd_suspend, 466 .suspend = spitzkbd_suspend,
469 .resume = spitzkbd_resume, 467 .resume = spitzkbd_resume,
468 .driver = {
469 .name = "spitz-keyboard",
470 },
470}; 471};
471 472
472static int __devinit spitzkbd_init(void) 473static int __devinit spitzkbd_init(void)
473{ 474{
474 return driver_register(&spitzkbd_driver); 475 return platform_driver_register(&spitzkbd_driver);
475} 476}
476 477
477static void __exit spitzkbd_exit(void) 478static void __exit spitzkbd_exit(void)
478{ 479{
479 driver_unregister(&spitzkbd_driver); 480 platform_driver_unregister(&spitzkbd_driver);
480} 481}
481 482
482module_init(spitzkbd_init); 483module_init(spitzkbd_init);
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 01e186422021..ac86c1d1d83e 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -912,7 +912,7 @@ static long i8042_panic_blink(long count)
912 * Here we try to restore the original BIOS settings 912 * Here we try to restore the original BIOS settings
913 */ 913 */
914 914
915static int i8042_suspend(struct device *dev, pm_message_t state) 915static int i8042_suspend(struct platform_device *dev, pm_message_t state)
916{ 916{
917 del_timer_sync(&i8042_timer); 917 del_timer_sync(&i8042_timer);
918 i8042_controller_reset(); 918 i8042_controller_reset();
@@ -925,7 +925,7 @@ static int i8042_suspend(struct device *dev, pm_message_t state)
925 * Here we try to reset everything back to a state in which suspended 925 * Here we try to reset everything back to a state in which suspended
926 */ 926 */
927 927
928static int i8042_resume(struct device *dev) 928static int i8042_resume(struct platform_device *dev)
929{ 929{
930 int i; 930 int i;
931 931
@@ -964,17 +964,18 @@ static int i8042_resume(struct device *dev)
964 * because otherwise BIOSes will be confused. 964 * because otherwise BIOSes will be confused.
965 */ 965 */
966 966
967static void i8042_shutdown(struct device *dev) 967static void i8042_shutdown(struct platform_device *dev)
968{ 968{
969 i8042_controller_cleanup(); 969 i8042_controller_cleanup();
970} 970}
971 971
972static struct device_driver i8042_driver = { 972static struct platform_driver i8042_driver = {
973 .name = "i8042",
974 .bus = &platform_bus_type,
975 .suspend = i8042_suspend, 973 .suspend = i8042_suspend,
976 .resume = i8042_resume, 974 .resume = i8042_resume,
977 .shutdown = i8042_shutdown, 975 .shutdown = i8042_shutdown,
976 .driver = {
977 .name = "i8042",
978 },
978}; 979};
979 980
980static int __init i8042_create_kbd_port(void) 981static int __init i8042_create_kbd_port(void)
@@ -1078,7 +1079,7 @@ static int __init i8042_init(void)
1078 goto err_platform_exit; 1079 goto err_platform_exit;
1079 } 1080 }
1080 1081
1081 err = driver_register(&i8042_driver); 1082 err = platform_driver_register(&i8042_driver);
1082 if (err) 1083 if (err)
1083 goto err_controller_cleanup; 1084 goto err_controller_cleanup;
1084 1085
@@ -1126,7 +1127,7 @@ static int __init i8042_init(void)
1126 err_unregister_device: 1127 err_unregister_device:
1127 platform_device_unregister(i8042_platform_device); 1128 platform_device_unregister(i8042_platform_device);
1128 err_unregister_driver: 1129 err_unregister_driver:
1129 driver_unregister(&i8042_driver); 1130 platform_driver_unregister(&i8042_driver);
1130 err_controller_cleanup: 1131 err_controller_cleanup:
1131 i8042_controller_cleanup(); 1132 i8042_controller_cleanup();
1132 err_platform_exit: 1133 err_platform_exit:
@@ -1148,7 +1149,7 @@ static void __exit i8042_exit(void)
1148 del_timer_sync(&i8042_timer); 1149 del_timer_sync(&i8042_timer);
1149 1150
1150 platform_device_unregister(i8042_platform_device); 1151 platform_device_unregister(i8042_platform_device);
1151 driver_unregister(&i8042_driver); 1152 platform_driver_unregister(&i8042_driver);
1152 1153
1153 i8042_platform_exit(); 1154 i8042_platform_exit();
1154 1155
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c
index 52c49258f8a4..a3bd11589bc3 100644
--- a/drivers/input/serio/rpckbd.c
+++ b/drivers/input/serio/rpckbd.c
@@ -107,7 +107,7 @@ static void rpckbd_close(struct serio *port)
107 * Allocate and initialize serio structure for subsequent registration 107 * Allocate and initialize serio structure for subsequent registration
108 * with serio core. 108 * with serio core.
109 */ 109 */
110static int __devinit rpckbd_probe(struct device *dev) 110static int __devinit rpckbd_probe(struct platform_device *dev)
111{ 111{
112 struct serio *serio; 112 struct serio *serio;
113 113
@@ -120,37 +120,38 @@ static int __devinit rpckbd_probe(struct device *dev)
120 serio->write = rpckbd_write; 120 serio->write = rpckbd_write;
121 serio->open = rpckbd_open; 121 serio->open = rpckbd_open;
122 serio->close = rpckbd_close; 122 serio->close = rpckbd_close;
123 serio->dev.parent = dev; 123 serio->dev.parent = &dev->dev;
124 strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); 124 strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name));
125 strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); 125 strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys));
126 126
127 dev_set_drvdata(dev, serio); 127 platform_set_drvdata(dev, serio);
128 serio_register_port(serio); 128 serio_register_port(serio);
129 return 0; 129 return 0;
130} 130}
131 131
132static int __devexit rpckbd_remove(struct device *dev) 132static int __devexit rpckbd_remove(struct platform_device *dev)
133{ 133{
134 struct serio *serio = dev_get_drvdata(dev); 134 struct serio *serio = platform_get_drvdata(dev);
135 serio_unregister_port(serio); 135 serio_unregister_port(serio);
136 return 0; 136 return 0;
137} 137}
138 138
139static struct device_driver rpckbd_driver = { 139static struct platform_driver rpckbd_driver = {
140 .name = "kart",
141 .bus = &platform_bus_type,
142 .probe = rpckbd_probe, 140 .probe = rpckbd_probe,
143 .remove = __devexit_p(rpckbd_remove), 141 .remove = __devexit_p(rpckbd_remove),
142 .driver = {
143 .name = "kart",
144 },
144}; 145};
145 146
146static int __init rpckbd_init(void) 147static int __init rpckbd_init(void)
147{ 148{
148 return driver_register(&rpckbd_driver); 149 return platform_driver_register(&rpckbd_driver);
149} 150}
150 151
151static void __exit rpckbd_exit(void) 152static void __exit rpckbd_exit(void)
152{ 153{
153 driver_unregister(&rpckbd_driver); 154 platform_driver_unregister(&rpckbd_driver);
154} 155}
155 156
156module_init(rpckbd_init); 157module_init(rpckbd_init);
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index 15e88eeae8d6..1042987856f7 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -231,9 +231,9 @@ static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs)
231} 231}
232 232
233#ifdef CONFIG_PM 233#ifdef CONFIG_PM
234static int corgits_suspend(struct device *dev, pm_message_t state) 234static int corgits_suspend(struct platform_device *dev, pm_message_t state)
235{ 235{
236 struct corgi_ts *corgi_ts = dev_get_drvdata(dev); 236 struct corgi_ts *corgi_ts = platform_get_drvdata(dev);
237 237
238 if (corgi_ts->pendown) { 238 if (corgi_ts->pendown) {
239 del_timer_sync(&corgi_ts->timer); 239 del_timer_sync(&corgi_ts->timer);
@@ -248,9 +248,9 @@ static int corgits_suspend(struct device *dev, pm_message_t state)
248 return 0; 248 return 0;
249} 249}
250 250
251static int corgits_resume(struct device *dev) 251static int corgits_resume(struct platform_device *dev)
252{ 252{
253 struct corgi_ts *corgi_ts = dev_get_drvdata(dev); 253 struct corgi_ts *corgi_ts = platform_get_drvdata(dev);
254 254
255 corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS); 255 corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
256 /* Enable Falling Edge */ 256 /* Enable Falling Edge */
@@ -264,10 +264,9 @@ static int corgits_resume(struct device *dev)
264#define corgits_resume NULL 264#define corgits_resume NULL
265#endif 265#endif
266 266
267static int __init corgits_probe(struct device *dev) 267static int __init corgits_probe(struct platform_device *pdev)
268{ 268{
269 struct corgi_ts *corgi_ts; 269 struct corgi_ts *corgi_ts;
270 struct platform_device *pdev = to_platform_device(dev);
271 struct input_dev *input_dev; 270 struct input_dev *input_dev;
272 int err = -ENOMEM; 271 int err = -ENOMEM;
273 272
@@ -276,9 +275,9 @@ static int __init corgits_probe(struct device *dev)
276 if (!corgi_ts || !input_dev) 275 if (!corgi_ts || !input_dev)
277 goto fail; 276 goto fail;
278 277
279 dev_set_drvdata(dev, corgi_ts); 278 platform_set_drvdata(pdev, corgi_ts);
280 279
281 corgi_ts->machinfo = dev->platform_data; 280 corgi_ts->machinfo = pdev->dev.platform_data;
282 corgi_ts->irq_gpio = platform_get_irq(pdev, 0); 281 corgi_ts->irq_gpio = platform_get_irq(pdev, 0);
283 282
284 if (corgi_ts->irq_gpio < 0) { 283 if (corgi_ts->irq_gpio < 0) {
@@ -298,7 +297,7 @@ static int __init corgits_probe(struct device *dev)
298 input_dev->id.vendor = 0x0001; 297 input_dev->id.vendor = 0x0001;
299 input_dev->id.product = 0x0002; 298 input_dev->id.product = 0x0002;
300 input_dev->id.version = 0x0100; 299 input_dev->id.version = 0x0100;
301 input_dev->cdev.dev = dev; 300 input_dev->cdev.dev = &pdev->dev;
302 input_dev->private = corgi_ts; 301 input_dev->private = corgi_ts;
303 302
304 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 303 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
@@ -339,9 +338,9 @@ static int __init corgits_probe(struct device *dev)
339 338
340} 339}
341 340
342static int corgits_remove(struct device *dev) 341static int corgits_remove(struct platform_device *pdev)
343{ 342{
344 struct corgi_ts *corgi_ts = dev_get_drvdata(dev); 343 struct corgi_ts *corgi_ts = platform_get_drvdata(pdev);
345 344
346 free_irq(corgi_ts->irq_gpio, NULL); 345 free_irq(corgi_ts->irq_gpio, NULL);
347 del_timer_sync(&corgi_ts->timer); 346 del_timer_sync(&corgi_ts->timer);
@@ -351,23 +350,24 @@ static int corgits_remove(struct device *dev)
351 return 0; 350 return 0;
352} 351}
353 352
354static struct device_driver corgits_driver = { 353static struct platform_driver corgits_driver = {
355 .name = "corgi-ts",
356 .bus = &platform_bus_type,
357 .probe = corgits_probe, 354 .probe = corgits_probe,
358 .remove = corgits_remove, 355 .remove = corgits_remove,
359 .suspend = corgits_suspend, 356 .suspend = corgits_suspend,
360 .resume = corgits_resume, 357 .resume = corgits_resume,
358 .driver = {
359 .name = "corgi-ts",
360 },
361}; 361};
362 362
363static int __devinit corgits_init(void) 363static int __devinit corgits_init(void)
364{ 364{
365 return driver_register(&corgits_driver); 365 return platform_driver_register(&corgits_driver);
366} 366}
367 367
368static void __exit corgits_exit(void) 368static void __exit corgits_exit(void)
369{ 369{
370 driver_unregister(&corgits_driver); 370 platform_driver_unregister(&corgits_driver);
371} 371}
372 372
373module_init(corgits_init); 373module_init(corgits_init);
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c
index 7daa0ed7331c..1eab7cffceaa 100644
--- a/drivers/mfd/mcp-sa11x0.c
+++ b/drivers/mfd/mcp-sa11x0.c
@@ -138,9 +138,8 @@ static struct mcp_ops mcp_sa11x0 = {
138 .disable = mcp_sa11x0_disable, 138 .disable = mcp_sa11x0_disable,
139}; 139};
140 140
141static int mcp_sa11x0_probe(struct device *dev) 141static int mcp_sa11x0_probe(struct platform_device *pdev)
142{ 142{
143 struct platform_device *pdev = to_platform_device(dev);
144 struct mcp_plat_data *data = pdev->dev.platform_data; 143 struct mcp_plat_data *data = pdev->dev.platform_data;
145 struct mcp *mcp; 144 struct mcp *mcp;
146 int ret; 145 int ret;
@@ -165,7 +164,7 @@ static int mcp_sa11x0_probe(struct device *dev)
165 mcp->dma_telco_rd = DMA_Ser4MCP1Rd; 164 mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
166 mcp->dma_telco_wr = DMA_Ser4MCP1Wr; 165 mcp->dma_telco_wr = DMA_Ser4MCP1Wr;
167 166
168 dev_set_drvdata(dev, mcp); 167 platform_set_drvdata(pdev, mcp);
169 168
170 if (machine_is_assabet()) { 169 if (machine_is_assabet()) {
171 ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); 170 ASSABET_BCR_set(ASSABET_BCR_CODEC_RST);
@@ -202,26 +201,26 @@ static int mcp_sa11x0_probe(struct device *dev)
202 201
203 release: 202 release:
204 release_mem_region(0x80060000, 0x60); 203 release_mem_region(0x80060000, 0x60);
205 dev_set_drvdata(dev, NULL); 204 platform_set_drvdata(pdev, NULL);
206 205
207 out: 206 out:
208 return ret; 207 return ret;
209} 208}
210 209
211static int mcp_sa11x0_remove(struct device *dev) 210static int mcp_sa11x0_remove(struct platform_device *dev)
212{ 211{
213 struct mcp *mcp = dev_get_drvdata(dev); 212 struct mcp *mcp = platform_get_drvdata(dev);
214 213
215 dev_set_drvdata(dev, NULL); 214 platform_set_drvdata(dev, NULL);
216 mcp_host_unregister(mcp); 215 mcp_host_unregister(mcp);
217 release_mem_region(0x80060000, 0x60); 216 release_mem_region(0x80060000, 0x60);
218 217
219 return 0; 218 return 0;
220} 219}
221 220
222static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state) 221static int mcp_sa11x0_suspend(struct platform_device *dev, pm_message_t state)
223{ 222{
224 struct mcp *mcp = dev_get_drvdata(dev); 223 struct mcp *mcp = platform_get_drvdata(dev);
225 224
226 priv(mcp)->mccr0 = Ser4MCCR0; 225 priv(mcp)->mccr0 = Ser4MCCR0;
227 priv(mcp)->mccr1 = Ser4MCCR1; 226 priv(mcp)->mccr1 = Ser4MCCR1;
@@ -230,9 +229,9 @@ static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state)
230 return 0; 229 return 0;
231} 230}
232 231
233static int mcp_sa11x0_resume(struct device *dev) 232static int mcp_sa11x0_resume(struct platform_device *dev)
234{ 233{
235 struct mcp *mcp = dev_get_drvdata(dev); 234 struct mcp *mcp = platform_get_drvdata(dev);
236 235
237 Ser4MCCR1 = priv(mcp)->mccr1; 236 Ser4MCCR1 = priv(mcp)->mccr1;
238 Ser4MCCR0 = priv(mcp)->mccr0; 237 Ser4MCCR0 = priv(mcp)->mccr0;
@@ -243,13 +242,14 @@ static int mcp_sa11x0_resume(struct device *dev)
243/* 242/*
244 * The driver for the SA11x0 MCP port. 243 * The driver for the SA11x0 MCP port.
245 */ 244 */
246static struct device_driver mcp_sa11x0_driver = { 245static struct platform_driver mcp_sa11x0_driver = {
247 .name = "sa11x0-mcp",
248 .bus = &platform_bus_type,
249 .probe = mcp_sa11x0_probe, 246 .probe = mcp_sa11x0_probe,
250 .remove = mcp_sa11x0_remove, 247 .remove = mcp_sa11x0_remove,
251 .suspend = mcp_sa11x0_suspend, 248 .suspend = mcp_sa11x0_suspend,
252 .resume = mcp_sa11x0_resume, 249 .resume = mcp_sa11x0_resume,
250 .driver = {
251 .name = "sa11x0-mcp",
252 },
253}; 253};
254 254
255/* 255/*
@@ -257,12 +257,12 @@ static struct device_driver mcp_sa11x0_driver = {
257 */ 257 */
258static int __init mcp_sa11x0_init(void) 258static int __init mcp_sa11x0_init(void)
259{ 259{
260 return driver_register(&mcp_sa11x0_driver); 260 return platform_driver_register(&mcp_sa11x0_driver);
261} 261}
262 262
263static void __exit mcp_sa11x0_exit(void) 263static void __exit mcp_sa11x0_exit(void)
264{ 264{
265 driver_unregister(&mcp_sa11x0_driver); 265 platform_driver_unregister(&mcp_sa11x0_driver);
266} 266}
267 267
268module_init(mcp_sa11x0_init); 268module_init(mcp_sa11x0_init);
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
index 9c4dd682ac74..226a7cd4ee3d 100644
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -27,8 +27,8 @@
27 27
28#define SKY_CPUSTATE_VERSION "1.1" 28#define SKY_CPUSTATE_VERSION "1.1"
29 29
30static int hdpu_cpustate_probe(struct device *ddev); 30static int hdpu_cpustate_probe(struct platform_device *pdev);
31static int hdpu_cpustate_remove(struct device *ddev); 31static int hdpu_cpustate_remove(struct platform_device *pdev);
32 32
33struct cpustate_t cpustate; 33struct cpustate_t cpustate;
34 34
@@ -159,11 +159,12 @@ static int cpustate_read_proc(char *page, char **start, off_t off,
159 return len; 159 return len;
160} 160}
161 161
162static struct device_driver hdpu_cpustate_driver = { 162static struct platform_driver hdpu_cpustate_driver = {
163 .name = HDPU_CPUSTATE_NAME,
164 .bus = &platform_bus_type,
165 .probe = hdpu_cpustate_probe, 163 .probe = hdpu_cpustate_probe,
166 .remove = hdpu_cpustate_remove, 164 .remove = hdpu_cpustate_remove,
165 .driver = {
166 .name = HDPU_CPUSTATE_NAME,
167 },
167}; 168};
168 169
169/* 170/*
@@ -188,9 +189,8 @@ static struct miscdevice cpustate_dev = {
188 &cpustate_fops 189 &cpustate_fops
189}; 190};
190 191
191static int hdpu_cpustate_probe(struct device *ddev) 192static int hdpu_cpustate_probe(struct platform_device *pdev)
192{ 193{
193 struct platform_device *pdev = to_platform_device(ddev);
194 struct resource *res; 194 struct resource *res;
195 struct proc_dir_entry *proc_de; 195 struct proc_dir_entry *proc_de;
196 int ret; 196 int ret;
@@ -218,7 +218,7 @@ static int hdpu_cpustate_probe(struct device *ddev)
218 return 0; 218 return 0;
219} 219}
220 220
221static int hdpu_cpustate_remove(struct device *ddev) 221static int hdpu_cpustate_remove(struct platform_device *pdev)
222{ 222{
223 223
224 cpustate.set_addr = NULL; 224 cpustate.set_addr = NULL;
@@ -233,13 +233,13 @@ static int hdpu_cpustate_remove(struct device *ddev)
233static int __init cpustate_init(void) 233static int __init cpustate_init(void)
234{ 234{
235 int rc; 235 int rc;
236 rc = driver_register(&hdpu_cpustate_driver); 236 rc = platform_driver_register(&hdpu_cpustate_driver);
237 return rc; 237 return rc;
238} 238}
239 239
240static void __exit cpustate_exit(void) 240static void __exit cpustate_exit(void)
241{ 241{
242 driver_unregister(&hdpu_cpustate_driver); 242 platform_driver_unregister(&hdpu_cpustate_driver);
243} 243}
244 244
245module_init(cpustate_init); 245module_init(cpustate_init);
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 165f3405df27..21da8a6ff8a1 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -23,19 +23,20 @@
23 23
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26static int hdpu_nexus_probe(struct device *ddev); 26static int hdpu_nexus_probe(struct platform_device *pdev);
27static int hdpu_nexus_remove(struct device *ddev); 27static int hdpu_nexus_remove(struct platform_device *pdev);
28 28
29static struct proc_dir_entry *hdpu_slot_id; 29static struct proc_dir_entry *hdpu_slot_id;
30static struct proc_dir_entry *hdpu_chassis_id; 30static struct proc_dir_entry *hdpu_chassis_id;
31static int slot_id = -1; 31static int slot_id = -1;
32static int chassis_id = -1; 32static int chassis_id = -1;
33 33
34static struct device_driver hdpu_nexus_driver = { 34static struct platform_driver hdpu_nexus_driver = {
35 .name = HDPU_NEXUS_NAME,
36 .bus = &platform_bus_type,
37 .probe = hdpu_nexus_probe, 35 .probe = hdpu_nexus_probe,
38 .remove = hdpu_nexus_remove, 36 .remove = hdpu_nexus_remove,
37 .driver = {
38 .name = HDPU_NEXUS_NAME,
39 },
39}; 40};
40 41
41int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, 42int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset,
@@ -56,9 +57,8 @@ int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset,
56 return sprintf(buffer, "%d\n", chassis_id); 57 return sprintf(buffer, "%d\n", chassis_id);
57} 58}
58 59
59static int hdpu_nexus_probe(struct device *ddev) 60static int hdpu_nexus_probe(struct platform_device *pdev)
60{ 61{
61 struct platform_device *pdev = to_platform_device(ddev);
62 struct resource *res; 62 struct resource *res;
63 63
64 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 64 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -81,7 +81,7 @@ static int hdpu_nexus_probe(struct device *ddev)
81 return 0; 81 return 0;
82} 82}
83 83
84static int hdpu_nexus_remove(struct device *ddev) 84static int hdpu_nexus_remove(struct platform_device *pdev)
85{ 85{
86 slot_id = -1; 86 slot_id = -1;
87 chassis_id = -1; 87 chassis_id = -1;
@@ -95,13 +95,13 @@ static int hdpu_nexus_remove(struct device *ddev)
95static int __init nexus_init(void) 95static int __init nexus_init(void)
96{ 96{
97 int rc; 97 int rc;
98 rc = driver_register(&hdpu_nexus_driver); 98 rc = platform_driver_register(&hdpu_nexus_driver);
99 return rc; 99 return rc;
100} 100}
101 101
102static void __exit nexus_exit(void) 102static void __exit nexus_exit(void)
103{ 103{
104 driver_unregister(&hdpu_nexus_driver); 104 platform_driver_unregister(&hdpu_nexus_driver);
105} 105}
106 106
107module_init(nexus_init); 107module_init(nexus_init);
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index f31e247b2cbe..ee8f8a0420d1 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -428,9 +428,8 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs)
428 return IRQ_HANDLED; 428 return IRQ_HANDLED;
429} 429}
430 430
431static int pxamci_probe(struct device *dev) 431static int pxamci_probe(struct platform_device *pdev)
432{ 432{
433 struct platform_device *pdev = to_platform_device(dev);
434 struct mmc_host *mmc; 433 struct mmc_host *mmc;
435 struct pxamci_host *host = NULL; 434 struct pxamci_host *host = NULL;
436 struct resource *r; 435 struct resource *r;
@@ -445,7 +444,7 @@ static int pxamci_probe(struct device *dev)
445 if (!r) 444 if (!r)
446 return -EBUSY; 445 return -EBUSY;
447 446
448 mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev); 447 mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev);
449 if (!mmc) { 448 if (!mmc) {
450 ret = -ENOMEM; 449 ret = -ENOMEM;
451 goto out; 450 goto out;
@@ -474,7 +473,7 @@ static int pxamci_probe(struct device *dev)
474 host->pdata->ocr_mask : 473 host->pdata->ocr_mask :
475 MMC_VDD_32_33|MMC_VDD_33_34; 474 MMC_VDD_32_33|MMC_VDD_33_34;
476 475
477 host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); 476 host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL);
478 if (!host->sg_cpu) { 477 if (!host->sg_cpu) {
479 ret = -ENOMEM; 478 ret = -ENOMEM;
480 goto out; 479 goto out;
@@ -511,10 +510,10 @@ static int pxamci_probe(struct device *dev)
511 if (ret) 510 if (ret)
512 goto out; 511 goto out;
513 512
514 dev_set_drvdata(dev, mmc); 513 platform_set_drvdata(pdev, mmc);
515 514
516 if (host->pdata && host->pdata->init) 515 if (host->pdata && host->pdata->init)
517 host->pdata->init(dev, pxamci_detect_irq, mmc); 516 host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc);
518 517
519 mmc_add_host(mmc); 518 mmc_add_host(mmc);
520 519
@@ -527,7 +526,7 @@ static int pxamci_probe(struct device *dev)
527 if (host->base) 526 if (host->base)
528 iounmap(host->base); 527 iounmap(host->base);
529 if (host->sg_cpu) 528 if (host->sg_cpu)
530 dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); 529 dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
531 } 530 }
532 if (mmc) 531 if (mmc)
533 mmc_free_host(mmc); 532 mmc_free_host(mmc);
@@ -535,17 +534,17 @@ static int pxamci_probe(struct device *dev)
535 return ret; 534 return ret;
536} 535}
537 536
538static int pxamci_remove(struct device *dev) 537static int pxamci_remove(struct platform_device *pdev)
539{ 538{
540 struct mmc_host *mmc = dev_get_drvdata(dev); 539 struct mmc_host *mmc = platform_get_drvdata(pdev);
541 540
542 dev_set_drvdata(dev, NULL); 541 platform_set_drvdata(pdev, NULL);
543 542
544 if (mmc) { 543 if (mmc) {
545 struct pxamci_host *host = mmc_priv(mmc); 544 struct pxamci_host *host = mmc_priv(mmc);
546 545
547 if (host->pdata && host->pdata->exit) 546 if (host->pdata && host->pdata->exit)
548 host->pdata->exit(dev, mmc); 547 host->pdata->exit(&pdev->dev, mmc);
549 548
550 mmc_remove_host(mmc); 549 mmc_remove_host(mmc);
551 550
@@ -560,7 +559,7 @@ static int pxamci_remove(struct device *dev)
560 free_irq(host->irq, host); 559 free_irq(host->irq, host);
561 pxa_free_dma(host->dma); 560 pxa_free_dma(host->dma);
562 iounmap(host->base); 561 iounmap(host->base);
563 dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); 562 dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
564 563
565 release_resource(host->res); 564 release_resource(host->res);
566 565
@@ -570,9 +569,9 @@ static int pxamci_remove(struct device *dev)
570} 569}
571 570
572#ifdef CONFIG_PM 571#ifdef CONFIG_PM
573static int pxamci_suspend(struct device *dev, pm_message_t state) 572static int pxamci_suspend(struct platform_device *dev, pm_message_t state)
574{ 573{
575 struct mmc_host *mmc = dev_get_drvdata(dev); 574 struct mmc_host *mmc = platform_get_drvdata(dev);
576 int ret = 0; 575 int ret = 0;
577 576
578 if (mmc) 577 if (mmc)
@@ -581,9 +580,9 @@ static int pxamci_suspend(struct device *dev, pm_message_t state)
581 return ret; 580 return ret;
582} 581}
583 582
584static int pxamci_resume(struct device *dev) 583static int pxamci_resume(struct platform_device *dev)
585{ 584{
586 struct mmc_host *mmc = dev_get_drvdata(dev); 585 struct mmc_host *mmc = platform_get_drvdata(dev);
587 int ret = 0; 586 int ret = 0;
588 587
589 if (mmc) 588 if (mmc)
@@ -596,23 +595,24 @@ static int pxamci_resume(struct device *dev)
596#define pxamci_resume NULL 595#define pxamci_resume NULL
597#endif 596#endif
598 597
599static struct device_driver pxamci_driver = { 598static struct platform_driver pxamci_driver = {
600 .name = DRIVER_NAME,
601 .bus = &platform_bus_type,
602 .probe = pxamci_probe, 599 .probe = pxamci_probe,
603 .remove = pxamci_remove, 600 .remove = pxamci_remove,
604 .suspend = pxamci_suspend, 601 .suspend = pxamci_suspend,
605 .resume = pxamci_resume, 602 .resume = pxamci_resume,
603 .driver = {
604 .name = DRIVER_NAME,
605 },
606}; 606};
607 607
608static int __init pxamci_init(void) 608static int __init pxamci_init(void)
609{ 609{
610 return driver_register(&pxamci_driver); 610 return platform_driver_register(&pxamci_driver);
611} 611}
612 612
613static void __exit pxamci_exit(void) 613static void __exit pxamci_exit(void)
614{ 614{
615 driver_unregister(&pxamci_driver); 615 platform_driver_unregister(&pxamci_driver);
616} 616}
617 617
618module_init(pxamci_init); 618module_init(pxamci_init);
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index e954b8354fef..ea23a31fac90 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -1932,14 +1932,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp)
1932 * Non-PnP 1932 * Non-PnP
1933 */ 1933 */
1934 1934
1935static int __devinit wbsd_probe(struct device* dev) 1935static int __devinit wbsd_probe(struct platform_device* dev)
1936{ 1936{
1937 return wbsd_init(dev, io, irq, dma, 0); 1937 return wbsd_init(&dev->dev, io, irq, dma, 0);
1938} 1938}
1939 1939
1940static int __devexit wbsd_remove(struct device* dev) 1940static int __devexit wbsd_remove(struct platform_device* dev)
1941{ 1941{
1942 wbsd_shutdown(dev, 0); 1942 wbsd_shutdown(&dev->dev, 0);
1943 1943
1944 return 0; 1944 return 0;
1945} 1945}
@@ -1983,9 +1983,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev)
1983 1983
1984#ifdef CONFIG_PM 1984#ifdef CONFIG_PM
1985 1985
1986static int wbsd_suspend(struct device *dev, pm_message_t state) 1986static int wbsd_suspend(struct platform_device *dev, pm_message_t state)
1987{ 1987{
1988 struct mmc_host *mmc = dev_get_drvdata(dev); 1988 struct mmc_host *mmc = platform_get_drvdata(dev);
1989 struct wbsd_host *host; 1989 struct wbsd_host *host;
1990 int ret; 1990 int ret;
1991 1991
@@ -2005,9 +2005,9 @@ static int wbsd_suspend(struct device *dev, pm_message_t state)
2005 return 0; 2005 return 0;
2006} 2006}
2007 2007
2008static int wbsd_resume(struct device *dev) 2008static int wbsd_resume(struct platform_device *dev)
2009{ 2009{
2010 struct mmc_host *mmc = dev_get_drvdata(dev); 2010 struct mmc_host *mmc = platform_get_drvdata(dev);
2011 struct wbsd_host *host; 2011 struct wbsd_host *host;
2012 2012
2013 if (!mmc) 2013 if (!mmc)
@@ -2038,14 +2038,15 @@ static int wbsd_resume(struct device *dev)
2038 2038
2039static struct platform_device *wbsd_device; 2039static struct platform_device *wbsd_device;
2040 2040
2041static struct device_driver wbsd_driver = { 2041static struct platform_driver wbsd_driver = {
2042 .name = DRIVER_NAME,
2043 .bus = &platform_bus_type,
2044 .probe = wbsd_probe, 2042 .probe = wbsd_probe,
2045 .remove = wbsd_remove, 2043 .remove = wbsd_remove,
2046 2044
2047 .suspend = wbsd_suspend, 2045 .suspend = wbsd_suspend,
2048 .resume = wbsd_resume, 2046 .resume = wbsd_resume,
2047 .driver = {
2048 .name = DRIVER_NAME,
2049 },
2049}; 2050};
2050 2051
2051#ifdef CONFIG_PNP 2052#ifdef CONFIG_PNP
@@ -2085,7 +2086,7 @@ static int __init wbsd_drv_init(void)
2085 2086
2086 if (nopnp) 2087 if (nopnp)
2087 { 2088 {
2088 result = driver_register(&wbsd_driver); 2089 result = platform_driver_register(&wbsd_driver);
2089 if (result < 0) 2090 if (result < 0)
2090 return result; 2091 return result;
2091 2092
@@ -2111,7 +2112,7 @@ static void __exit wbsd_drv_exit(void)
2111 { 2112 {
2112 platform_device_unregister(wbsd_device); 2113 platform_device_unregister(wbsd_device);
2113 2114
2114 driver_unregister(&wbsd_driver); 2115 platform_driver_unregister(&wbsd_driver);
2115 } 2116 }
2116 2117
2117 DBG("unloaded\n"); 2118 DBG("unloaded\n");
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c
index b7858eb93534..51f962dd7e31 100644
--- a/drivers/mtd/maps/bast-flash.c
+++ b/drivers/mtd/maps/bast-flash.c
@@ -63,11 +63,6 @@ struct bast_flash_info {
63 63
64static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 64static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
65 65
66static struct bast_flash_info *to_bast_info(struct device *dev)
67{
68 return (struct bast_flash_info *)dev_get_drvdata(dev);
69}
70
71static void bast_flash_setrw(int to) 66static void bast_flash_setrw(int to)
72{ 67{
73 unsigned int val; 68 unsigned int val;
@@ -87,11 +82,11 @@ static void bast_flash_setrw(int to)
87 local_irq_restore(flags); 82 local_irq_restore(flags);
88} 83}
89 84
90static int bast_flash_remove(struct device *dev) 85static int bast_flash_remove(struct platform_device *pdev)
91{ 86{
92 struct bast_flash_info *info = to_bast_info(dev); 87 struct bast_flash_info *info = platform_get_drvdata(pdev);
93 88
94 dev_set_drvdata(dev, NULL); 89 platform_set_drvdata(pdev, NULL);
95 90
96 if (info == NULL) 91 if (info == NULL)
97 return 0; 92 return 0;
@@ -116,9 +111,8 @@ static int bast_flash_remove(struct device *dev)
116 return 0; 111 return 0;
117} 112}
118 113
119static int bast_flash_probe(struct device *dev) 114static int bast_flash_probe(struct platform_device *pdev)
120{ 115{
121 struct platform_device *pdev = to_platform_device(dev);
122 struct bast_flash_info *info; 116 struct bast_flash_info *info;
123 struct resource *res; 117 struct resource *res;
124 int err = 0; 118 int err = 0;
@@ -131,13 +125,13 @@ static int bast_flash_probe(struct device *dev)
131 } 125 }
132 126
133 memzero(info, sizeof(*info)); 127 memzero(info, sizeof(*info));
134 dev_set_drvdata(dev, info); 128 platform_set_drvdata(pdev, info);
135 129
136 res = pdev->resource; /* assume that the flash has one resource */ 130 res = pdev->resource; /* assume that the flash has one resource */
137 131
138 info->map.phys = res->start; 132 info->map.phys = res->start;
139 info->map.size = res->end - res->start + 1; 133 info->map.size = res->end - res->start + 1;
140 info->map.name = dev->bus_id; 134 info->map.name = pdev->dev.bus_id;
141 info->map.bankwidth = 2; 135 info->map.bankwidth = 2;
142 136
143 if (info->map.size > AREA_MAXSIZE) 137 if (info->map.size > AREA_MAXSIZE)
@@ -199,27 +193,28 @@ static int bast_flash_probe(struct device *dev)
199 /* fall through to exit error */ 193 /* fall through to exit error */
200 194
201 exit_error: 195 exit_error:
202 bast_flash_remove(dev); 196 bast_flash_remove(pdev);
203 return err; 197 return err;
204} 198}
205 199
206static struct device_driver bast_flash_driver = { 200static struct platform_driver bast_flash_driver = {
207 .name = "bast-nor",
208 .owner = THIS_MODULE,
209 .bus = &platform_bus_type,
210 .probe = bast_flash_probe, 201 .probe = bast_flash_probe,
211 .remove = bast_flash_remove, 202 .remove = bast_flash_remove,
203 .driver = {
204 .name = "bast-nor",
205 .owner = THIS_MODULE,
206 },
212}; 207};
213 208
214static int __init bast_flash_init(void) 209static int __init bast_flash_init(void)
215{ 210{
216 printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); 211 printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n");
217 return driver_register(&bast_flash_driver); 212 return platform_driver_register(&bast_flash_driver);
218} 213}
219 214
220static void __exit bast_flash_exit(void) 215static void __exit bast_flash_exit(void)
221{ 216{
222 driver_unregister(&bast_flash_driver); 217 platform_driver_unregister(&bast_flash_driver);
223} 218}
224 219
225module_init(bast_flash_init); 220module_init(bast_flash_init);
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
68static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; 68static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL };
69 69
70static int armflash_probe(struct device *_dev) 70static 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
166static int armflash_remove(struct device *_dev) 165static 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
193static struct device_driver armflash_driver = { 191static 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
200static int __init armflash_init(void) 199static int __init armflash_init(void)
201{ 200{
202 return driver_register(&armflash_driver); 201 return platform_driver_register(&armflash_driver);
203} 202}
204 203
205static void __exit armflash_exit(void) 204static void __exit armflash_exit(void)
206{ 205{
207 driver_unregister(&armflash_driver); 206 platform_driver_unregister(&armflash_driver);
208} 207}
209 208
210module_init(armflash_init); 209module_init(armflash_init);
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index 641eb2b55e9f..fc7a78e31735 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -111,13 +111,12 @@ static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to,
111} 111}
112 112
113 113
114static int ixp2000_flash_remove(struct device *_dev) 114static int ixp2000_flash_remove(struct platform_device *dev)
115{ 115{
116 struct platform_device *dev = to_platform_device(_dev);
117 struct flash_platform_data *plat = dev->dev.platform_data; 116 struct flash_platform_data *plat = dev->dev.platform_data;
118 struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); 117 struct ixp2000_flash_info *info = platform_get_drvdata(dev);
119 118
120 dev_set_drvdata(&dev->dev, NULL); 119 platform_set_drvdata(dev, NULL);
121 120
122 if(!info) 121 if(!info)
123 return 0; 122 return 0;
@@ -143,10 +142,9 @@ static int ixp2000_flash_remove(struct device *_dev)
143} 142}
144 143
145 144
146static int ixp2000_flash_probe(struct device *_dev) 145static int ixp2000_flash_probe(struct platform_device *dev)
147{ 146{
148 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 147 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
149 struct platform_device *dev = to_platform_device(_dev);
150 struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; 148 struct ixp2000_flash_data *ixp_data = dev->dev.platform_data;
151 struct flash_platform_data *plat; 149 struct flash_platform_data *plat;
152 struct ixp2000_flash_info *info; 150 struct ixp2000_flash_info *info;
@@ -177,7 +175,7 @@ static int ixp2000_flash_probe(struct device *_dev)
177 } 175 }
178 memzero(info, sizeof(struct ixp2000_flash_info)); 176 memzero(info, sizeof(struct ixp2000_flash_info));
179 177
180 dev_set_drvdata(&dev->dev, info); 178 platform_set_drvdata(dev, info);
181 179
182 /* 180 /*
183 * Tell the MTD layer we're not 1:1 mapped so that it does 181 * Tell the MTD layer we're not 1:1 mapped so that it does
@@ -248,25 +246,26 @@ static int ixp2000_flash_probe(struct device *_dev)
248 return 0; 246 return 0;
249 247
250Error: 248Error:
251 ixp2000_flash_remove(_dev); 249 ixp2000_flash_remove(dev);
252 return err; 250 return err;
253} 251}
254 252
255static struct device_driver ixp2000_flash_driver = { 253static struct platform_driver ixp2000_flash_driver = {
256 .name = "IXP2000-Flash",
257 .bus = &platform_bus_type,
258 .probe = &ixp2000_flash_probe, 254 .probe = &ixp2000_flash_probe,
259 .remove = &ixp2000_flash_remove 255 .remove = &ixp2000_flash_remove
256 .driver = {
257 .name = "IXP2000-Flash",
258 },
260}; 259};
261 260
262static int __init ixp2000_flash_init(void) 261static int __init ixp2000_flash_init(void)
263{ 262{
264 return driver_register(&ixp2000_flash_driver); 263 return platform_driver_register(&ixp2000_flash_driver);
265} 264}
266 265
267static void __exit ixp2000_flash_exit(void) 266static void __exit ixp2000_flash_exit(void)
268{ 267{
269 driver_unregister(&ixp2000_flash_driver); 268 platform_driver_unregister(&ixp2000_flash_driver);
270} 269}
271 270
272module_init(ixp2000_flash_init); 271module_init(ixp2000_flash_init);
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 56b3a355bf7b..a59f8027903c 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -99,13 +99,12 @@ struct ixp4xx_flash_info {
99 99
100static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 100static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
101 101
102static int ixp4xx_flash_remove(struct device *_dev) 102static int ixp4xx_flash_remove(struct platform_device *dev)
103{ 103{
104 struct platform_device *dev = to_platform_device(_dev);
105 struct flash_platform_data *plat = dev->dev.platform_data; 104 struct flash_platform_data *plat = dev->dev.platform_data;
106 struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); 105 struct ixp4xx_flash_info *info = platform_get_drvdata(dev);
107 106
108 dev_set_drvdata(&dev->dev, NULL); 107 platform_set_drvdata(dev, NULL);
109 108
110 if(!info) 109 if(!info)
111 return 0; 110 return 0;
@@ -130,9 +129,8 @@ static int ixp4xx_flash_remove(struct device *_dev)
130 return 0; 129 return 0;
131} 130}
132 131
133static int ixp4xx_flash_probe(struct device *_dev) 132static int ixp4xx_flash_probe(struct platform_device *dev)
134{ 133{
135 struct platform_device *dev = to_platform_device(_dev);
136 struct flash_platform_data *plat = dev->dev.platform_data; 134 struct flash_platform_data *plat = dev->dev.platform_data;
137 struct ixp4xx_flash_info *info; 135 struct ixp4xx_flash_info *info;
138 int err = -1; 136 int err = -1;
@@ -153,7 +151,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
153 } 151 }
154 memzero(info, sizeof(struct ixp4xx_flash_info)); 152 memzero(info, sizeof(struct ixp4xx_flash_info));
155 153
156 dev_set_drvdata(&dev->dev, info); 154 platform_set_drvdata(dev, info);
157 155
158 /* 156 /*
159 * Tell the MTD layer we're not 1:1 mapped so that it does 157 * Tell the MTD layer we're not 1:1 mapped so that it does
@@ -214,25 +212,26 @@ static int ixp4xx_flash_probe(struct device *_dev)
214 return 0; 212 return 0;
215 213
216Error: 214Error:
217 ixp4xx_flash_remove(_dev); 215 ixp4xx_flash_remove(dev);
218 return err; 216 return err;
219} 217}
220 218
221static struct device_driver ixp4xx_flash_driver = { 219static struct platform_driver ixp4xx_flash_driver = {
222 .name = "IXP4XX-Flash",
223 .bus = &platform_bus_type,
224 .probe = ixp4xx_flash_probe, 220 .probe = ixp4xx_flash_probe,
225 .remove = ixp4xx_flash_remove, 221 .remove = ixp4xx_flash_remove,
222 .driver = {
223 .name = "IXP4XX-Flash",
224 },
226}; 225};
227 226
228static int __init ixp4xx_flash_init(void) 227static int __init ixp4xx_flash_init(void)
229{ 228{
230 return driver_register(&ixp4xx_flash_driver); 229 return platform_driver_register(&ixp4xx_flash_driver);
231} 230}
232 231
233static void __exit ixp4xx_flash_exit(void) 232static void __exit ixp4xx_flash_exit(void)
234{ 233{
235 driver_unregister(&ixp4xx_flash_driver); 234 platform_driver_unregister(&ixp4xx_flash_driver);
236} 235}
237 236
238 237
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index fd3b4a5fc207..418afffb2d80 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -70,11 +70,10 @@ static void omap_set_vpp(struct map_info *map, int enable)
70 } 70 }
71} 71}
72 72
73static int __devinit omapflash_probe(struct device *dev) 73static int __devinit omapflash_probe(struct platform_device *pdev)
74{ 74{
75 int err; 75 int err;
76 struct omapflash_info *info; 76 struct omapflash_info *info;
77 struct platform_device *pdev = to_platform_device(dev);
78 struct flash_platform_data *pdata = pdev->dev.platform_data; 77 struct flash_platform_data *pdata = pdev->dev.platform_data;
79 struct resource *res = pdev->resource; 78 struct resource *res = pdev->resource;
80 unsigned long size = res->end - res->start + 1; 79 unsigned long size = res->end - res->start + 1;
@@ -119,7 +118,7 @@ static int __devinit omapflash_probe(struct device *dev)
119#endif 118#endif
120 add_mtd_device(info->mtd); 119 add_mtd_device(info->mtd);
121 120
122 dev_set_drvdata(&pdev->dev, info); 121 platform_set_drvdata(pdev, info);
123 122
124 return 0; 123 return 0;
125 124
@@ -133,12 +132,11 @@ out_free_info:
133 return err; 132 return err;
134} 133}
135 134
136static int __devexit omapflash_remove(struct device *dev) 135static int __devexit omapflash_remove(struct platform_device *pdev)
137{ 136{
138 struct platform_device *pdev = to_platform_device(dev); 137 struct omapflash_info *info = platform_get_drvdata(pdev);
139 struct omapflash_info *info = dev_get_drvdata(&pdev->dev);
140 138
141 dev_set_drvdata(&pdev->dev, NULL); 139 platform_set_drvdata(pdev, NULL);
142 140
143 if (info) { 141 if (info) {
144 if (info->parts) { 142 if (info->parts) {
@@ -155,21 +153,22 @@ static int __devexit omapflash_remove(struct device *dev)
155 return 0; 153 return 0;
156} 154}
157 155
158static struct device_driver omapflash_driver = { 156static struct platform_driver omapflash_driver = {
159 .name = "omapflash",
160 .bus = &platform_bus_type,
161 .probe = omapflash_probe, 157 .probe = omapflash_probe,
162 .remove = __devexit_p(omapflash_remove), 158 .remove = __devexit_p(omapflash_remove),
159 .driver = {
160 .name = "omapflash",
161 },
163}; 162};
164 163
165static int __init omapflash_init(void) 164static int __init omapflash_init(void)
166{ 165{
167 return driver_register(&omapflash_driver); 166 return platform_driver_register(&omapflash_driver);
168} 167}
169 168
170static void __exit omapflash_exit(void) 169static void __exit omapflash_exit(void)
171{ 170{
172 driver_unregister(&omapflash_driver); 171 platform_driver_unregister(&omapflash_driver);
173} 172}
174 173
175module_init(omapflash_init); 174module_init(omapflash_init);
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index a02eed94a231..5d3c75451ca2 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -56,9 +56,9 @@ struct platram_info {
56 * device private data to struct platram_info conversion 56 * device private data to struct platram_info conversion
57*/ 57*/
58 58
59static inline struct platram_info *to_platram_info(struct device *dev) 59static inline struct platram_info *to_platram_info(struct platform_device *dev)
60{ 60{
61 return (struct platram_info *)dev_get_drvdata(dev); 61 return (struct platram_info *)platform_get_drvdata(dev);
62} 62}
63 63
64/* platram_setrw 64/* platram_setrw
@@ -83,13 +83,13 @@ static inline void platram_setrw(struct platram_info *info, int to)
83 * called to remove the device from the driver's control 83 * called to remove the device from the driver's control
84*/ 84*/
85 85
86static int platram_remove(struct device *dev) 86static int platram_remove(struct platform_device *pdev)
87{ 87{
88 struct platram_info *info = to_platram_info(dev); 88 struct platram_info *info = to_platram_info(pdev);
89 89
90 dev_set_drvdata(dev, NULL); 90 platform_set_drvdata(pdev, NULL);
91 91
92 dev_dbg(dev, "removing device\n"); 92 dev_dbg(&pdev->dev, "removing device\n");
93 93
94 if (info == NULL) 94 if (info == NULL)
95 return 0; 95 return 0;
@@ -130,61 +130,60 @@ static int platram_remove(struct device *dev)
130 * driver is found. 130 * driver is found.
131*/ 131*/
132 132
133static int platram_probe(struct device *dev) 133static int platram_probe(struct platform_device *pdev)
134{ 134{
135 struct platform_device *pd = to_platform_device(dev);
136 struct platdata_mtd_ram *pdata; 135 struct platdata_mtd_ram *pdata;
137 struct platram_info *info; 136 struct platram_info *info;
138 struct resource *res; 137 struct resource *res;
139 int err = 0; 138 int err = 0;
140 139
141 dev_dbg(dev, "probe entered\n"); 140 dev_dbg(&pdev->dev, "probe entered\n");
142 141
143 if (dev->platform_data == NULL) { 142 if (pdev->dev.platform_data == NULL) {
144 dev_err(dev, "no platform data supplied\n"); 143 dev_err(&pdev->dev, "no platform data supplied\n");
145 err = -ENOENT; 144 err = -ENOENT;
146 goto exit_error; 145 goto exit_error;
147 } 146 }
148 147
149 pdata = dev->platform_data; 148 pdata = pdev->dev.platform_data;
150 149
151 info = kmalloc(sizeof(*info), GFP_KERNEL); 150 info = kmalloc(sizeof(*info), GFP_KERNEL);
152 if (info == NULL) { 151 if (info == NULL) {
153 dev_err(dev, "no memory for flash info\n"); 152 dev_err(&pdev->dev, "no memory for flash info\n");
154 err = -ENOMEM; 153 err = -ENOMEM;
155 goto exit_error; 154 goto exit_error;
156 } 155 }
157 156
158 memset(info, 0, sizeof(*info)); 157 memset(info, 0, sizeof(*info));
159 dev_set_drvdata(dev, info); 158 platform_set_drvdata(pdev, info);
160 159
161 info->dev = dev; 160 info->dev = &pdev->dev;
162 info->pdata = pdata; 161 info->pdata = pdata;
163 162
164 /* get the resource for the memory mapping */ 163 /* get the resource for the memory mapping */
165 164
166 res = platform_get_resource(pd, IORESOURCE_MEM, 0); 165 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
167 166
168 if (res == NULL) { 167 if (res == NULL) {
169 dev_err(dev, "no memory resource specified\n"); 168 dev_err(&pdev->dev, "no memory resource specified\n");
170 err = -ENOENT; 169 err = -ENOENT;
171 goto exit_free; 170 goto exit_free;
172 } 171 }
173 172
174 dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start); 173 dev_dbg(&pdev->dev, "got platform resource %p (0x%lx)\n", res, res->start);
175 174
176 /* setup map parameters */ 175 /* setup map parameters */
177 176
178 info->map.phys = res->start; 177 info->map.phys = res->start;
179 info->map.size = (res->end - res->start) + 1; 178 info->map.size = (res->end - res->start) + 1;
180 info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name; 179 info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pdev->name;
181 info->map.bankwidth = pdata->bankwidth; 180 info->map.bankwidth = pdata->bankwidth;
182 181
183 /* register our usage of the memory area */ 182 /* register our usage of the memory area */
184 183
185 info->area = request_mem_region(res->start, info->map.size, pd->name); 184 info->area = request_mem_region(res->start, info->map.size, pdev->name);
186 if (info->area == NULL) { 185 if (info->area == NULL) {
187 dev_err(dev, "failed to request memory region\n"); 186 dev_err(&pdev->dev, "failed to request memory region\n");
188 err = -EIO; 187 err = -EIO;
189 goto exit_free; 188 goto exit_free;
190 } 189 }
@@ -192,23 +191,23 @@ static int platram_probe(struct device *dev)
192 /* remap the memory area */ 191 /* remap the memory area */
193 192
194 info->map.virt = ioremap(res->start, info->map.size); 193 info->map.virt = ioremap(res->start, info->map.size);
195 dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); 194 dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size);
196 195
197 if (info->map.virt == NULL) { 196 if (info->map.virt == NULL) {
198 dev_err(dev, "failed to ioremap() region\n"); 197 dev_err(&pdev->dev, "failed to ioremap() region\n");
199 err = -EIO; 198 err = -EIO;
200 goto exit_free; 199 goto exit_free;
201 } 200 }
202 201
203 simple_map_init(&info->map); 202 simple_map_init(&info->map);
204 203
205 dev_dbg(dev, "initialised map, probing for mtd\n"); 204 dev_dbg(&pdev->dev, "initialised map, probing for mtd\n");
206 205
207 /* probe for the right mtd map driver */ 206 /* probe for the right mtd map driver */
208 207
209 info->mtd = do_map_probe("map_ram" , &info->map); 208 info->mtd = do_map_probe("map_ram" , &info->map);
210 if (info->mtd == NULL) { 209 if (info->mtd == NULL) {
211 dev_err(dev, "failed to probe for map_ram\n"); 210 dev_err(&pdev->dev, "failed to probe for map_ram\n");
212 err = -ENOMEM; 211 err = -ENOMEM;
213 goto exit_free; 212 goto exit_free;
214 } 213 }
@@ -237,27 +236,28 @@ static int platram_probe(struct device *dev)
237#endif /* CONFIG_MTD_PARTITIONS */ 236#endif /* CONFIG_MTD_PARTITIONS */
238 237
239 if (add_mtd_device(info->mtd)) { 238 if (add_mtd_device(info->mtd)) {
240 dev_err(dev, "add_mtd_device() failed\n"); 239 dev_err(&pdev->dev, "add_mtd_device() failed\n");
241 err = -ENOMEM; 240 err = -ENOMEM;
242 } 241 }
243 242
244 dev_info(dev, "registered mtd device\n"); 243 dev_info(&pdev->dev, "registered mtd device\n");
245 return err; 244 return err;
246 245
247 exit_free: 246 exit_free:
248 platram_remove(dev); 247 platram_remove(pdev);
249 exit_error: 248 exit_error:
250 return err; 249 return err;
251} 250}
252 251
253/* device driver info */ 252/* device driver info */
254 253
255static struct device_driver platram_driver = { 254static struct platform_driver platram_driver = {
256 .name = "mtd-ram",
257 .owner = THIS_MODULE,
258 .bus = &platform_bus_type,
259 .probe = platram_probe, 255 .probe = platram_probe,
260 .remove = platram_remove, 256 .remove = platram_remove,
257 .driver = {
258 .name = "mtd-ram",
259 .owner = THIS_MODULE,
260 },
261}; 261};
262 262
263/* module init/exit */ 263/* module init/exit */
@@ -265,12 +265,12 @@ static struct device_driver platram_driver = {
265static int __init platram_init(void) 265static int __init platram_init(void)
266{ 266{
267 printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); 267 printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n");
268 return driver_register(&platram_driver); 268 return platform_driver_register(&platram_driver);
269} 269}
270 270
271static void __exit platram_exit(void) 271static void __exit platram_exit(void)
272{ 272{
273 driver_unregister(&platram_driver); 273 platform_driver_unregister(&platram_driver);
274} 274}
275 275
276module_init(platram_init); 276module_init(platram_init);
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);
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 97e9b7892d29..d209214b1318 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -125,14 +125,14 @@ static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd)
125 return s3c2410_nand_mtd_toours(mtd)->info; 125 return s3c2410_nand_mtd_toours(mtd)->info;
126} 126}
127 127
128static struct s3c2410_nand_info *to_nand_info(struct device *dev) 128static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev)
129{ 129{
130 return dev_get_drvdata(dev); 130 return platform_get_drvdata(dev);
131} 131}
132 132
133static struct s3c2410_platform_nand *to_nand_plat(struct device *dev) 133static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev)
134{ 134{
135 return dev->platform_data; 135 return dev->dev.platform_data;
136} 136}
137 137
138/* timing calculations */ 138/* timing calculations */
@@ -165,9 +165,9 @@ static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max)
165/* controller setup */ 165/* controller setup */
166 166
167static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, 167static int s3c2410_nand_inithw(struct s3c2410_nand_info *info,
168 struct device *dev) 168 struct platform_device *pdev)
169{ 169{
170 struct s3c2410_platform_nand *plat = to_nand_plat(dev); 170 struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
171 unsigned long clkrate = clk_get_rate(info->clk); 171 unsigned long clkrate = clk_get_rate(info->clk);
172 int tacls, twrph0, twrph1; 172 int tacls, twrph0, twrph1;
173 unsigned long cfg; 173 unsigned long cfg;
@@ -430,11 +430,11 @@ static void s3c2410_nand_write_buf(struct mtd_info *mtd,
430 430
431/* device management functions */ 431/* device management functions */
432 432
433static int s3c2410_nand_remove(struct device *dev) 433static int s3c2410_nand_remove(struct platform_device *pdev)
434{ 434{
435 struct s3c2410_nand_info *info = to_nand_info(dev); 435 struct s3c2410_nand_info *info = to_nand_info(pdev);
436 436
437 dev_set_drvdata(dev, NULL); 437 platform_set_drvdata(pdev, NULL);
438 438
439 if (info == NULL) 439 if (info == NULL)
440 return 0; 440 return 0;
@@ -562,10 +562,9 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
562 * nand layer to look for devices 562 * nand layer to look for devices
563*/ 563*/
564 564
565static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) 565static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
566{ 566{
567 struct platform_device *pdev = to_platform_device(dev); 567 struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
568 struct s3c2410_platform_nand *plat = to_nand_plat(dev);
569 struct s3c2410_nand_info *info; 568 struct s3c2410_nand_info *info;
570 struct s3c2410_nand_mtd *nmtd; 569 struct s3c2410_nand_mtd *nmtd;
571 struct s3c2410_nand_set *sets; 570 struct s3c2410_nand_set *sets;
@@ -575,26 +574,26 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
575 int nr_sets; 574 int nr_sets;
576 int setno; 575 int setno;
577 576
578 pr_debug("s3c2410_nand_probe(%p)\n", dev); 577 pr_debug("s3c2410_nand_probe(%p)\n", pdev);
579 578
580 info = kmalloc(sizeof(*info), GFP_KERNEL); 579 info = kmalloc(sizeof(*info), GFP_KERNEL);
581 if (info == NULL) { 580 if (info == NULL) {
582 dev_err(dev, "no memory for flash info\n"); 581 dev_err(&pdev->dev, "no memory for flash info\n");
583 err = -ENOMEM; 582 err = -ENOMEM;
584 goto exit_error; 583 goto exit_error;
585 } 584 }
586 585
587 memzero(info, sizeof(*info)); 586 memzero(info, sizeof(*info));
588 dev_set_drvdata(dev, info); 587 platform_set_drvdata(pdev, info);
589 588
590 spin_lock_init(&info->controller.lock); 589 spin_lock_init(&info->controller.lock);
591 init_waitqueue_head(&info->controller.wq); 590 init_waitqueue_head(&info->controller.wq);
592 591
593 /* get the clock source and enable it */ 592 /* get the clock source and enable it */
594 593
595 info->clk = clk_get(dev, "nand"); 594 info->clk = clk_get(&pdev->dev, "nand");
596 if (IS_ERR(info->clk)) { 595 if (IS_ERR(info->clk)) {
597 dev_err(dev, "failed to get clock"); 596 dev_err(&pdev->dev, "failed to get clock");
598 err = -ENOENT; 597 err = -ENOENT;
599 goto exit_error; 598 goto exit_error;
600 } 599 }
@@ -611,27 +610,27 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
611 info->area = request_mem_region(res->start, size, pdev->name); 610 info->area = request_mem_region(res->start, size, pdev->name);
612 611
613 if (info->area == NULL) { 612 if (info->area == NULL) {
614 dev_err(dev, "cannot reserve register region\n"); 613 dev_err(&pdev->dev, "cannot reserve register region\n");
615 err = -ENOENT; 614 err = -ENOENT;
616 goto exit_error; 615 goto exit_error;
617 } 616 }
618 617
619 info->device = dev; 618 info->device = &pdev->dev;
620 info->platform = plat; 619 info->platform = plat;
621 info->regs = ioremap(res->start, size); 620 info->regs = ioremap(res->start, size);
622 info->is_s3c2440 = is_s3c2440; 621 info->is_s3c2440 = is_s3c2440;
623 622
624 if (info->regs == NULL) { 623 if (info->regs == NULL) {
625 dev_err(dev, "cannot reserve register region\n"); 624 dev_err(&pdev->dev, "cannot reserve register region\n");
626 err = -EIO; 625 err = -EIO;
627 goto exit_error; 626 goto exit_error;
628 } 627 }
629 628
630 dev_dbg(dev, "mapped registers at %p\n", info->regs); 629 dev_dbg(&pdev->dev, "mapped registers at %p\n", info->regs);
631 630
632 /* initialise the hardware */ 631 /* initialise the hardware */
633 632
634 err = s3c2410_nand_inithw(info, dev); 633 err = s3c2410_nand_inithw(info, pdev);
635 if (err != 0) 634 if (err != 0)
636 goto exit_error; 635 goto exit_error;
637 636
@@ -645,7 +644,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
645 size = nr_sets * sizeof(*info->mtds); 644 size = nr_sets * sizeof(*info->mtds);
646 info->mtds = kmalloc(size, GFP_KERNEL); 645 info->mtds = kmalloc(size, GFP_KERNEL);
647 if (info->mtds == NULL) { 646 if (info->mtds == NULL) {
648 dev_err(dev, "failed to allocate mtd storage\n"); 647 dev_err(&pdev->dev, "failed to allocate mtd storage\n");
649 err = -ENOMEM; 648 err = -ENOMEM;
650 goto exit_error; 649 goto exit_error;
651 } 650 }
@@ -677,7 +676,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
677 return 0; 676 return 0;
678 677
679 exit_error: 678 exit_error:
680 s3c2410_nand_remove(dev); 679 s3c2410_nand_remove(pdev);
681 680
682 if (err == 0) 681 if (err == 0)
683 err = -EINVAL; 682 err = -EINVAL;
@@ -686,44 +685,46 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
686 685
687/* driver device registration */ 686/* driver device registration */
688 687
689static int s3c2410_nand_probe(struct device *dev) 688static int s3c2410_nand_probe(struct platform_device *dev)
690{ 689{
691 return s3c24xx_nand_probe(dev, 0); 690 return s3c24xx_nand_probe(dev, 0);
692} 691}
693 692
694static int s3c2440_nand_probe(struct device *dev) 693static int s3c2440_nand_probe(struct platform_device *dev)
695{ 694{
696 return s3c24xx_nand_probe(dev, 1); 695 return s3c24xx_nand_probe(dev, 1);
697} 696}
698 697
699static struct device_driver s3c2410_nand_driver = { 698static struct platform_driver s3c2410_nand_driver = {
700 .name = "s3c2410-nand",
701 .owner = THIS_MODULE,
702 .bus = &platform_bus_type,
703 .probe = s3c2410_nand_probe, 699 .probe = s3c2410_nand_probe,
704 .remove = s3c2410_nand_remove, 700 .remove = s3c2410_nand_remove,
701 .driver = {
702 .name = "s3c2410-nand",
703 .owner = THIS_MODULE,
704 },
705}; 705};
706 706
707static struct device_driver s3c2440_nand_driver = { 707static struct platform_driver s3c2440_nand_driver = {
708 .name = "s3c2440-nand",
709 .owner = THIS_MODULE,
710 .bus = &platform_bus_type,
711 .probe = s3c2440_nand_probe, 708 .probe = s3c2440_nand_probe,
712 .remove = s3c2410_nand_remove, 709 .remove = s3c2410_nand_remove,
710 .driver = {
711 .name = "s3c2440-nand",
712 .owner = THIS_MODULE,
713 },
713}; 714};
714 715
715static int __init s3c2410_nand_init(void) 716static int __init s3c2410_nand_init(void)
716{ 717{
717 printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n"); 718 printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n");
718 719
719 driver_register(&s3c2440_nand_driver); 720 platform_driver_register(&s3c2440_nand_driver);
720 return driver_register(&s3c2410_nand_driver); 721 return platform_driver_register(&s3c2410_nand_driver);
721} 722}
722 723
723static void __exit s3c2410_nand_exit(void) 724static void __exit s3c2410_nand_exit(void)
724{ 725{
725 driver_unregister(&s3c2440_nand_driver); 726 platform_driver_unregister(&s3c2440_nand_driver);
726 driver_unregister(&s3c2410_nand_driver); 727 platform_driver_unregister(&s3c2410_nand_driver);
727} 728}
728 729
729module_init(s3c2410_nand_init); 730module_init(s3c2410_nand_init);
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index 0d33a93df96b..03804cc38be0 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -398,13 +398,19 @@ static struct mca_driver depca_mca_driver = {
398}; 398};
399#endif 399#endif
400 400
401static int depca_isa_probe (struct device *); 401static int depca_isa_probe (struct platform_device *);
402 402
403static struct device_driver depca_isa_driver = { 403static int __devexit depca_isa_remove(struct platform_device *pdev)
404 .name = depca_string, 404{
405 .bus = &platform_bus_type, 405 return depca_device_remove(&pdev->dev);
406}
407
408static struct platform_driver depca_isa_driver = {
406 .probe = depca_isa_probe, 409 .probe = depca_isa_probe,
407 .remove = __devexit_p(depca_device_remove), 410 .remove = __devexit_p(depca_isa_remove),
411 .driver = {
412 .name = depca_string,
413 },
408}; 414};
409 415
410/* 416/*
@@ -1525,7 +1531,7 @@ static enum depca_type __init depca_shmem_probe (ulong *mem_start)
1525 return adapter; 1531 return adapter;
1526} 1532}
1527 1533
1528static int __init depca_isa_probe (struct device *device) 1534static int __init depca_isa_probe (struct platform_device *device)
1529{ 1535{
1530 struct net_device *dev; 1536 struct net_device *dev;
1531 struct depca_private *lp; 1537 struct depca_private *lp;
@@ -1533,7 +1539,7 @@ static int __init depca_isa_probe (struct device *device)
1533 enum depca_type adapter = unknown; 1539 enum depca_type adapter = unknown;
1534 int status = 0; 1540 int status = 0;
1535 1541
1536 ioaddr = (u_long) device->platform_data; 1542 ioaddr = (u_long) device->dev.platform_data;
1537 1543
1538 if ((status = depca_common_init (ioaddr, &dev))) 1544 if ((status = depca_common_init (ioaddr, &dev)))
1539 goto out; 1545 goto out;
@@ -1553,7 +1559,7 @@ static int __init depca_isa_probe (struct device *device)
1553 lp->adapter = adapter; 1559 lp->adapter = adapter;
1554 lp->mem_start = mem_start; 1560 lp->mem_start = mem_start;
1555 1561
1556 if ((status = depca_hw_init(dev, device))) 1562 if ((status = depca_hw_init(dev, &device->dev)))
1557 goto out_free; 1563 goto out_free;
1558 1564
1559 return 0; 1565 return 0;
@@ -2082,7 +2088,7 @@ static int __init depca_module_init (void)
2082#ifdef CONFIG_EISA 2088#ifdef CONFIG_EISA
2083 err |= eisa_driver_register (&depca_eisa_driver); 2089 err |= eisa_driver_register (&depca_eisa_driver);
2084#endif 2090#endif
2085 err |= driver_register (&depca_isa_driver); 2091 err |= platform_driver_register (&depca_isa_driver);
2086 depca_platform_probe (); 2092 depca_platform_probe ();
2087 2093
2088 return err; 2094 return err;
@@ -2097,7 +2103,7 @@ static void __exit depca_module_exit (void)
2097#ifdef CONFIG_EISA 2103#ifdef CONFIG_EISA
2098 eisa_driver_unregister (&depca_eisa_driver); 2104 eisa_driver_unregister (&depca_eisa_driver);
2099#endif 2105#endif
2100 driver_unregister (&depca_isa_driver); 2106 platform_driver_unregister (&depca_isa_driver);
2101 2107
2102 for (i = 0; depca_io_ports[i].iobase; i++) { 2108 for (i = 0; depca_io_ports[i].iobase; i++) {
2103 if (depca_io_ports[i].device) { 2109 if (depca_io_ports[i].device) {
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index c0af6fb1fbba..25227222e086 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -149,7 +149,7 @@ typedef struct board_info {
149} board_info_t; 149} board_info_t;
150 150
151/* function declaration ------------------------------------- */ 151/* function declaration ------------------------------------- */
152static int dm9000_probe(struct device *); 152static int dm9000_probe(struct platform_device *);
153static int dm9000_open(struct net_device *); 153static int dm9000_open(struct net_device *);
154static int dm9000_start_xmit(struct sk_buff *, struct net_device *); 154static int dm9000_start_xmit(struct sk_buff *, struct net_device *);
155static int dm9000_stop(struct net_device *); 155static int dm9000_stop(struct net_device *);
@@ -379,9 +379,8 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
379 * Search DM9000 board, allocate space and register it 379 * Search DM9000 board, allocate space and register it
380 */ 380 */
381static int 381static int
382dm9000_probe(struct device *dev) 382dm9000_probe(struct platform_device *pdev)
383{ 383{
384 struct platform_device *pdev = to_platform_device(dev);
385 struct dm9000_plat_data *pdata = pdev->dev.platform_data; 384 struct dm9000_plat_data *pdata = pdev->dev.platform_data;
386 struct board_info *db; /* Point a board information structure */ 385 struct board_info *db; /* Point a board information structure */
387 struct net_device *ndev; 386 struct net_device *ndev;
@@ -399,7 +398,7 @@ dm9000_probe(struct device *dev)
399 } 398 }
400 399
401 SET_MODULE_OWNER(ndev); 400 SET_MODULE_OWNER(ndev);
402 SET_NETDEV_DEV(ndev, dev); 401 SET_NETDEV_DEV(ndev, &pdev->dev);
403 402
404 PRINTK2("dm9000_probe()"); 403 PRINTK2("dm9000_probe()");
405 404
@@ -570,7 +569,7 @@ dm9000_probe(struct device *dev)
570 printk("%s: Invalid ethernet MAC address. Please " 569 printk("%s: Invalid ethernet MAC address. Please "
571 "set using ifconfig\n", ndev->name); 570 "set using ifconfig\n", ndev->name);
572 571
573 dev_set_drvdata(dev, ndev); 572 platform_set_drvdata(pdev, ndev);
574 ret = register_netdev(ndev); 573 ret = register_netdev(ndev);
575 574
576 if (ret == 0) { 575 if (ret == 0) {
@@ -1141,9 +1140,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
1141} 1140}
1142 1141
1143static int 1142static int
1144dm9000_drv_suspend(struct device *dev, pm_message_t state) 1143dm9000_drv_suspend(struct platform_device *dev, pm_message_t state)
1145{ 1144{
1146 struct net_device *ndev = dev_get_drvdata(dev); 1145 struct net_device *ndev = platform_get_drvdata(dev);
1147 1146
1148 if (ndev) { 1147 if (ndev) {
1149 if (netif_running(ndev)) { 1148 if (netif_running(ndev)) {
@@ -1155,9 +1154,9 @@ dm9000_drv_suspend(struct device *dev, pm_message_t state)
1155} 1154}
1156 1155
1157static int 1156static int
1158dm9000_drv_resume(struct device *dev) 1157dm9000_drv_resume(struct platform_device *dev)
1159{ 1158{
1160 struct net_device *ndev = dev_get_drvdata(dev); 1159 struct net_device *ndev = platform_get_drvdata(dev);
1161 board_info_t *db = (board_info_t *) ndev->priv; 1160 board_info_t *db = (board_info_t *) ndev->priv;
1162 1161
1163 if (ndev) { 1162 if (ndev) {
@@ -1173,12 +1172,11 @@ dm9000_drv_resume(struct device *dev)
1173} 1172}
1174 1173
1175static int 1174static int
1176dm9000_drv_remove(struct device *dev) 1175dm9000_drv_remove(struct platform_device *pdev)
1177{ 1176{
1178 struct platform_device *pdev = to_platform_device(dev); 1177 struct net_device *ndev = platform_get_drvdata(pdev);
1179 struct net_device *ndev = dev_get_drvdata(dev);
1180 1178
1181 dev_set_drvdata(dev, NULL); 1179 platform_set_drvdata(pdev, NULL);
1182 1180
1183 unregister_netdev(ndev); 1181 unregister_netdev(ndev);
1184 dm9000_release_board(pdev, (board_info_t *) ndev->priv); 1182 dm9000_release_board(pdev, (board_info_t *) ndev->priv);
@@ -1189,13 +1187,14 @@ dm9000_drv_remove(struct device *dev)
1189 return 0; 1187 return 0;
1190} 1188}
1191 1189
1192static struct device_driver dm9000_driver = { 1190static struct platform_driver dm9000_driver = {
1193 .name = "dm9000",
1194 .bus = &platform_bus_type,
1195 .probe = dm9000_probe, 1191 .probe = dm9000_probe,
1196 .remove = dm9000_drv_remove, 1192 .remove = dm9000_drv_remove,
1197 .suspend = dm9000_drv_suspend, 1193 .suspend = dm9000_drv_suspend,
1198 .resume = dm9000_drv_resume, 1194 .resume = dm9000_drv_resume,
1195 .driver = {
1196 .name = "dm9000",
1197 },
1199}; 1198};
1200 1199
1201static int __init 1200static int __init
@@ -1203,13 +1202,13 @@ dm9000_init(void)
1203{ 1202{
1204 printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); 1203 printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME);
1205 1204
1206 return driver_register(&dm9000_driver); /* search board and register */ 1205 return platform_driver_register(&dm9000_driver); /* search board and register */
1207} 1206}
1208 1207
1209static void __exit 1208static void __exit
1210dm9000_cleanup(void) 1209dm9000_cleanup(void)
1211{ 1210{
1212 driver_unregister(&dm9000_driver); 1211 platform_driver_unregister(&dm9000_driver);
1213} 1212}
1214 1213
1215module_init(dm9000_init); 1214module_init(dm9000_init);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 962580f2c4ab..e8dab3983619 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -127,8 +127,8 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs);
127static void adjust_link(struct net_device *dev); 127static void adjust_link(struct net_device *dev);
128static void init_registers(struct net_device *dev); 128static void init_registers(struct net_device *dev);
129static int init_phy(struct net_device *dev); 129static int init_phy(struct net_device *dev);
130static int gfar_probe(struct device *device); 130static int gfar_probe(struct platform_device *pdev);
131static int gfar_remove(struct device *device); 131static int gfar_remove(struct platform_device *pdev);
132static void free_skb_resources(struct gfar_private *priv); 132static void free_skb_resources(struct gfar_private *priv);
133static void gfar_set_multi(struct net_device *dev); 133static void gfar_set_multi(struct net_device *dev);
134static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); 134static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
@@ -157,12 +157,11 @@ int gfar_uses_fcb(struct gfar_private *priv)
157 157
158/* Set up the ethernet device structure, private data, 158/* Set up the ethernet device structure, private data,
159 * and anything else we need before we start */ 159 * and anything else we need before we start */
160static int gfar_probe(struct device *device) 160static int gfar_probe(struct platform_device *pdev)
161{ 161{
162 u32 tempval; 162 u32 tempval;
163 struct net_device *dev = NULL; 163 struct net_device *dev = NULL;
164 struct gfar_private *priv = NULL; 164 struct gfar_private *priv = NULL;
165 struct platform_device *pdev = to_platform_device(device);
166 struct gianfar_platform_data *einfo; 165 struct gianfar_platform_data *einfo;
167 struct resource *r; 166 struct resource *r;
168 int idx; 167 int idx;
@@ -209,7 +208,7 @@ static int gfar_probe(struct device *device)
209 208
210 spin_lock_init(&priv->lock); 209 spin_lock_init(&priv->lock);
211 210
212 dev_set_drvdata(device, dev); 211 platform_set_drvdata(pdev, dev);
213 212
214 /* Stop the DMA engine now, in case it was running before */ 213 /* Stop the DMA engine now, in case it was running before */
215 /* (The firmware could have used it, and left it running). */ 214 /* (The firmware could have used it, and left it running). */
@@ -246,7 +245,7 @@ static int gfar_probe(struct device *device)
246 dev->base_addr = (unsigned long) (priv->regs); 245 dev->base_addr = (unsigned long) (priv->regs);
247 246
248 SET_MODULE_OWNER(dev); 247 SET_MODULE_OWNER(dev);
249 SET_NETDEV_DEV(dev, device); 248 SET_NETDEV_DEV(dev, &pdev->dev);
250 249
251 /* Fill in the dev structure */ 250 /* Fill in the dev structure */
252 dev->open = gfar_enet_open; 251 dev->open = gfar_enet_open;
@@ -378,12 +377,12 @@ regs_fail:
378 return err; 377 return err;
379} 378}
380 379
381static int gfar_remove(struct device *device) 380static int gfar_remove(struct platform_device *pdev)
382{ 381{
383 struct net_device *dev = dev_get_drvdata(device); 382 struct net_device *dev = platform_get_drvdata(pdev);
384 struct gfar_private *priv = netdev_priv(dev); 383 struct gfar_private *priv = netdev_priv(dev);
385 384
386 dev_set_drvdata(device, NULL); 385 platform_set_drvdata(pdev, NULL);
387 386
388 iounmap((void *) priv->regs); 387 iounmap((void *) priv->regs);
389 free_netdev(dev); 388 free_netdev(dev);
@@ -1862,11 +1861,12 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs)
1862} 1861}
1863 1862
1864/* Structure for a device driver */ 1863/* Structure for a device driver */
1865static struct device_driver gfar_driver = { 1864static struct platform_driver gfar_driver = {
1866 .name = "fsl-gianfar",
1867 .bus = &platform_bus_type,
1868 .probe = gfar_probe, 1865 .probe = gfar_probe,
1869 .remove = gfar_remove, 1866 .remove = gfar_remove,
1867 .driver = {
1868 .name = "fsl-gianfar",
1869 },
1870}; 1870};
1871 1871
1872static int __init gfar_init(void) 1872static int __init gfar_init(void)
@@ -1876,7 +1876,7 @@ static int __init gfar_init(void)
1876 if (err) 1876 if (err)
1877 return err; 1877 return err;
1878 1878
1879 err = driver_register(&gfar_driver); 1879 err = platform_driver_register(&gfar_driver);
1880 1880
1881 if (err) 1881 if (err)
1882 gfar_mdio_exit(); 1882 gfar_mdio_exit();
@@ -1886,7 +1886,7 @@ static int __init gfar_init(void)
1886 1886
1887static void __exit gfar_exit(void) 1887static void __exit gfar_exit(void)
1888{ 1888{
1889 driver_unregister(&gfar_driver); 1889 platform_driver_unregister(&gfar_driver);
1890 gfar_mdio_exit(); 1890 gfar_mdio_exit();
1891} 1891}
1892 1892
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 76e0b9fb5e96..63d38fbbd04e 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si)
291/* 291/*
292 * Suspend the IrDA interface. 292 * Suspend the IrDA interface.
293 */ 293 */
294static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) 294static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state)
295{ 295{
296 struct net_device *dev = dev_get_drvdata(_dev); 296 struct net_device *dev = platform_get_drvdata(pdev);
297 struct sa1100_irda *si; 297 struct sa1100_irda *si;
298 298
299 if (!dev) 299 if (!dev)
@@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state)
316/* 316/*
317 * Resume the IrDA interface. 317 * Resume the IrDA interface.
318 */ 318 */
319static int sa1100_irda_resume(struct device *_dev) 319static int sa1100_irda_resume(struct platform_device *pdev)
320{ 320{
321 struct net_device *dev = dev_get_drvdata(_dev); 321 struct net_device *dev = platform_get_drvdata(pdev);
322 struct sa1100_irda *si; 322 struct sa1100_irda *si;
323 323
324 if (!dev) 324 if (!dev)
@@ -886,9 +886,8 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size)
886 return io->head ? 0 : -ENOMEM; 886 return io->head ? 0 : -ENOMEM;
887} 887}
888 888
889static int sa1100_irda_probe(struct device *_dev) 889static int sa1100_irda_probe(struct platform_device *pdev)
890{ 890{
891 struct platform_device *pdev = to_platform_device(_dev);
892 struct net_device *dev; 891 struct net_device *dev;
893 struct sa1100_irda *si; 892 struct sa1100_irda *si;
894 unsigned int baudrate_mask; 893 unsigned int baudrate_mask;
@@ -967,7 +966,7 @@ static int sa1100_irda_probe(struct device *_dev)
967 966
968 err = register_netdev(dev); 967 err = register_netdev(dev);
969 if (err == 0) 968 if (err == 0)
970 dev_set_drvdata(&pdev->dev, dev); 969 platform_set_drvdata(pdev, dev);
971 970
972 if (err) { 971 if (err) {
973 err_mem_5: 972 err_mem_5:
@@ -985,9 +984,9 @@ static int sa1100_irda_probe(struct device *_dev)
985 return err; 984 return err;
986} 985}
987 986
988static int sa1100_irda_remove(struct device *_dev) 987static int sa1100_irda_remove(struct platform_device *pdev)
989{ 988{
990 struct net_device *dev = dev_get_drvdata(_dev); 989 struct net_device *dev = platform_get_drvdata(pdev);
991 990
992 if (dev) { 991 if (dev) {
993 struct sa1100_irda *si = dev->priv; 992 struct sa1100_irda *si = dev->priv;
@@ -1004,13 +1003,14 @@ static int sa1100_irda_remove(struct device *_dev)
1004 return 0; 1003 return 0;
1005} 1004}
1006 1005
1007static struct device_driver sa1100ir_driver = { 1006static struct platform_driver sa1100ir_driver = {
1008 .name = "sa11x0-ir",
1009 .bus = &platform_bus_type,
1010 .probe = sa1100_irda_probe, 1007 .probe = sa1100_irda_probe,
1011 .remove = sa1100_irda_remove, 1008 .remove = sa1100_irda_remove,
1012 .suspend = sa1100_irda_suspend, 1009 .suspend = sa1100_irda_suspend,
1013 .resume = sa1100_irda_resume, 1010 .resume = sa1100_irda_resume,
1011 .driver = {
1012 .name = "sa11x0-ir",
1013 },
1014}; 1014};
1015 1015
1016static int __init sa1100_irda_init(void) 1016static int __init sa1100_irda_init(void)
@@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void)
1023 if (power_level > 3) 1023 if (power_level > 3)
1024 power_level = 3; 1024 power_level = 3;
1025 1025
1026 return driver_register(&sa1100ir_driver); 1026 return platform_driver_register(&sa1100ir_driver);
1027} 1027}
1028 1028
1029static void __exit sa1100_irda_exit(void) 1029static void __exit sa1100_irda_exit(void)
1030{ 1030{
1031 driver_unregister(&sa1100ir_driver); 1031 platform_driver_unregister(&sa1100ir_driver);
1032} 1032}
1033 1033
1034module_init(sa1100_irda_init); 1034module_init(sa1100_irda_init);
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index a1d207f2fa68..ec94ecdb103d 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -214,14 +214,15 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base);
214 214
215/* Power Management */ 215/* Power Management */
216 216
217static int smsc_ircc_suspend(struct device *dev, pm_message_t state); 217static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state);
218static int smsc_ircc_resume(struct device *dev); 218static int smsc_ircc_resume(struct platform_device *dev);
219 219
220static struct device_driver smsc_ircc_driver = { 220static struct platform_driver smsc_ircc_driver = {
221 .name = SMSC_IRCC2_DRIVER_NAME,
222 .bus = &platform_bus_type,
223 .suspend = smsc_ircc_suspend, 221 .suspend = smsc_ircc_suspend,
224 .resume = smsc_ircc_resume, 222 .resume = smsc_ircc_resume,
223 .driver = {
224 .name = SMSC_IRCC2_DRIVER_NAME,
225 },
225}; 226};
226 227
227/* Transceivers for SMSC-ircc */ 228/* Transceivers for SMSC-ircc */
@@ -346,7 +347,7 @@ static int __init smsc_ircc_init(void)
346 347
347 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 348 IRDA_DEBUG(1, "%s\n", __FUNCTION__);
348 349
349 ret = driver_register(&smsc_ircc_driver); 350 ret = platform_driver_register(&smsc_ircc_driver);
350 if (ret) { 351 if (ret) {
351 IRDA_ERROR("%s, Can't register driver!\n", driver_name); 352 IRDA_ERROR("%s, Can't register driver!\n", driver_name);
352 return ret; 353 return ret;
@@ -378,7 +379,7 @@ static int __init smsc_ircc_init(void)
378 } 379 }
379 380
380 if (ret) 381 if (ret)
381 driver_unregister(&smsc_ircc_driver); 382 platform_driver_unregister(&smsc_ircc_driver);
382 383
383 return ret; 384 return ret;
384} 385}
@@ -491,7 +492,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
491 err = PTR_ERR(self->pldev); 492 err = PTR_ERR(self->pldev);
492 goto err_out5; 493 goto err_out5;
493 } 494 }
494 dev_set_drvdata(&self->pldev->dev, self); 495 platform_set_drvdata(self->pldev, self);
495 496
496 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); 497 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
497 dev_count++; 498 dev_count++;
@@ -1685,9 +1686,9 @@ static int smsc_ircc_net_close(struct net_device *dev)
1685 return 0; 1686 return 0;
1686} 1687}
1687 1688
1688static int smsc_ircc_suspend(struct device *dev, pm_message_t state) 1689static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state)
1689{ 1690{
1690 struct smsc_ircc_cb *self = dev_get_drvdata(dev); 1691 struct smsc_ircc_cb *self = platform_get_drvdata(dev);
1691 1692
1692 if (!self->io.suspended) { 1693 if (!self->io.suspended) {
1693 IRDA_DEBUG(1, "%s, Suspending\n", driver_name); 1694 IRDA_DEBUG(1, "%s, Suspending\n", driver_name);
@@ -1706,9 +1707,9 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state)
1706 return 0; 1707 return 0;
1707} 1708}
1708 1709
1709static int smsc_ircc_resume(struct device *dev) 1710static int smsc_ircc_resume(struct platform_device *dev)
1710{ 1711{
1711 struct smsc_ircc_cb *self = dev_get_drvdata(dev); 1712 struct smsc_ircc_cb *self = platform_get_drvdata(dev);
1712 1713
1713 if (self->io.suspended) { 1714 if (self->io.suspended) {
1714 IRDA_DEBUG(1, "%s, Waking up\n", driver_name); 1715 IRDA_DEBUG(1, "%s, Waking up\n", driver_name);
@@ -1788,7 +1789,7 @@ static void __exit smsc_ircc_cleanup(void)
1788 smsc_ircc_close(dev_self[i]); 1789 smsc_ircc_close(dev_self[i]);
1789 } 1790 }
1790 1791
1791 driver_unregister(&smsc_ircc_driver); 1792 platform_driver_unregister(&smsc_ircc_driver);
1792} 1793}
1793 1794
1794/* 1795/*
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index 2fb3101cb33e..b039bd89ceb9 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -194,7 +194,7 @@ out:
194 * Probe for a SONIC ethernet controller on a Mips Jazz board. 194 * Probe for a SONIC ethernet controller on a Mips Jazz board.
195 * Actually probing is superfluous but we're paranoid. 195 * Actually probing is superfluous but we're paranoid.
196 */ 196 */
197static int __init jazz_sonic_probe(struct device *device) 197static int __init jazz_sonic_probe(struct platform_device *pdev)
198{ 198{
199 struct net_device *dev; 199 struct net_device *dev;
200 struct sonic_local *lp; 200 struct sonic_local *lp;
@@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct device *device)
212 return -ENOMEM; 212 return -ENOMEM;
213 213
214 lp = netdev_priv(dev); 214 lp = netdev_priv(dev);
215 lp->device = device; 215 lp->device = &pdev->dev;
216 SET_NETDEV_DEV(dev, device); 216 SET_NETDEV_DEV(dev, &pdev->dev);
217 SET_MODULE_OWNER(dev); 217 SET_MODULE_OWNER(dev);
218 218
219 netdev_boot_setup_check(dev); 219 netdev_boot_setup_check(dev);
@@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
264 264
265#include "sonic.c" 265#include "sonic.c"
266 266
267static int __devexit jazz_sonic_device_remove (struct device *device) 267static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
268{ 268{
269 struct net_device *dev = device->driver_data; 269 struct net_device *dev = platform_get_drvdata(pdev);
270 struct sonic_local* lp = netdev_priv(dev); 270 struct sonic_local* lp = netdev_priv(dev);
271 271
272 unregister_netdev (dev); 272 unregister_netdev (dev);
@@ -278,18 +278,19 @@ static int __devexit jazz_sonic_device_remove (struct device *device)
278 return 0; 278 return 0;
279} 279}
280 280
281static struct device_driver jazz_sonic_driver = { 281static struct platform_driver jazz_sonic_driver = {
282 .name = jazz_sonic_string,
283 .bus = &platform_bus_type,
284 .probe = jazz_sonic_probe, 282 .probe = jazz_sonic_probe,
285 .remove = __devexit_p(jazz_sonic_device_remove), 283 .remove = __devexit_p(jazz_sonic_device_remove),
284 .driver = {
285 .name = jazz_sonic_string,
286 },
286}; 287};
287 288
288static int __init jazz_sonic_init_module(void) 289static int __init jazz_sonic_init_module(void)
289{ 290{
290 int err; 291 int err;
291 292
292 if ((err = driver_register(&jazz_sonic_driver))) { 293 if ((err = platform_driver_register(&jazz_sonic_driver))) {
293 printk(KERN_ERR "Driver registration failed\n"); 294 printk(KERN_ERR "Driver registration failed\n");
294 return err; 295 return err;
295 } 296 }
@@ -313,7 +314,7 @@ out_unregister:
313 314
314static void __exit jazz_sonic_cleanup_module(void) 315static void __exit jazz_sonic_cleanup_module(void)
315{ 316{
316 driver_unregister(&jazz_sonic_driver); 317 platform_driver_unregister(&jazz_sonic_driver);
317 318
318 if (jazz_sonic_device) { 319 if (jazz_sonic_device) {
319 platform_device_unregister(jazz_sonic_device); 320 platform_device_unregister(jazz_sonic_device);
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 9ef4592aca03..02d5c6822733 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
525 return macsonic_init(dev); 525 return macsonic_init(dev);
526} 526}
527 527
528static int __init mac_sonic_probe(struct device *device) 528static int __init mac_sonic_probe(struct platform_device *device)
529{ 529{
530 struct net_device *dev; 530 struct net_device *dev;
531 struct sonic_local *lp; 531 struct sonic_local *lp;
@@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct device *device)
537 return -ENOMEM; 537 return -ENOMEM;
538 538
539 lp = netdev_priv(dev); 539 lp = netdev_priv(dev);
540 lp->device = device; 540 lp->device = &device->dev;
541 SET_NETDEV_DEV(dev, device); 541 SET_NETDEV_DEV(dev, &device->dev);
542 SET_MODULE_OWNER(dev); 542 SET_MODULE_OWNER(dev);
543 543
544 /* This will catch fatal stuff like -ENOMEM as well as success */ 544 /* This will catch fatal stuff like -ENOMEM as well as success */
@@ -579,9 +579,9 @@ MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
579 579
580#include "sonic.c" 580#include "sonic.c"
581 581
582static int __devexit mac_sonic_device_remove (struct device *device) 582static int __devexit mac_sonic_device_remove (struct platform_device *device)
583{ 583{
584 struct net_device *dev = device->driver_data; 584 struct net_device *dev = platform_get_drvdata(device);
585 struct sonic_local* lp = netdev_priv(dev); 585 struct sonic_local* lp = netdev_priv(dev);
586 586
587 unregister_netdev (dev); 587 unregister_netdev (dev);
@@ -592,18 +592,19 @@ static int __devexit mac_sonic_device_remove (struct device *device)
592 return 0; 592 return 0;
593} 593}
594 594
595static struct device_driver mac_sonic_driver = { 595static struct platform_driver mac_sonic_driver = {
596 .name = mac_sonic_string,
597 .bus = &platform_bus_type,
598 .probe = mac_sonic_probe, 596 .probe = mac_sonic_probe,
599 .remove = __devexit_p(mac_sonic_device_remove), 597 .remove = __devexit_p(mac_sonic_device_remove),
598 .driver = {
599 .name = mac_sonic_string,
600 },
600}; 601};
601 602
602static int __init mac_sonic_init_module(void) 603static int __init mac_sonic_init_module(void)
603{ 604{
604 int err; 605 int err;
605 606
606 if ((err = driver_register(&mac_sonic_driver))) { 607 if ((err = platform_driver_register(&mac_sonic_driver))) {
607 printk(KERN_ERR "Driver registration failed\n"); 608 printk(KERN_ERR "Driver registration failed\n");
608 return err; 609 return err;
609 } 610 }
@@ -628,7 +629,7 @@ out_unregister:
628 629
629static void __exit mac_sonic_cleanup_module(void) 630static void __exit mac_sonic_cleanup_module(void)
630{ 631{
631 driver_unregister(&mac_sonic_driver); 632 platform_driver_unregister(&mac_sonic_driver);
632 633
633 if (mac_sonic_device) { 634 if (mac_sonic_device) {
634 platform_device_unregister(mac_sonic_device); 635 platform_device_unregister(mac_sonic_device);
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 71f2c6705bc3..3cb9b3fe0cf1 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1387,9 +1387,8 @@ static void mv643xx_netpoll(struct net_device *netdev)
1387 * Input : struct device * 1387 * Input : struct device *
1388 * Output : -ENOMEM if failed , 0 if success 1388 * Output : -ENOMEM if failed , 0 if success
1389 */ 1389 */
1390static int mv643xx_eth_probe(struct device *ddev) 1390static int mv643xx_eth_probe(struct platform_device *pdev)
1391{ 1391{
1392 struct platform_device *pdev = to_platform_device(ddev);
1393 struct mv643xx_eth_platform_data *pd; 1392 struct mv643xx_eth_platform_data *pd;
1394 int port_num = pdev->id; 1393 int port_num = pdev->id;
1395 struct mv643xx_private *mp; 1394 struct mv643xx_private *mp;
@@ -1402,7 +1401,7 @@ static int mv643xx_eth_probe(struct device *ddev)
1402 if (!dev) 1401 if (!dev)
1403 return -ENOMEM; 1402 return -ENOMEM;
1404 1403
1405 dev_set_drvdata(ddev, dev); 1404 platform_set_drvdata(pdev, dev);
1406 1405
1407 mp = netdev_priv(dev); 1406 mp = netdev_priv(dev);
1408 1407
@@ -1546,21 +1545,20 @@ out:
1546 return err; 1545 return err;
1547} 1546}
1548 1547
1549static int mv643xx_eth_remove(struct device *ddev) 1548static int mv643xx_eth_remove(struct platform_device *pdev)
1550{ 1549{
1551 struct net_device *dev = dev_get_drvdata(ddev); 1550 struct net_device *dev = platform_get_drvdata(pdev);
1552 1551
1553 unregister_netdev(dev); 1552 unregister_netdev(dev);
1554 flush_scheduled_work(); 1553 flush_scheduled_work();
1555 1554
1556 free_netdev(dev); 1555 free_netdev(dev);
1557 dev_set_drvdata(ddev, NULL); 1556 platform_set_drvdata(pdev, NULL);
1558 return 0; 1557 return 0;
1559} 1558}
1560 1559
1561static int mv643xx_eth_shared_probe(struct device *ddev) 1560static int mv643xx_eth_shared_probe(struct platform_device *pdev)
1562{ 1561{
1563 struct platform_device *pdev = to_platform_device(ddev);
1564 struct resource *res; 1562 struct resource *res;
1565 1563
1566 printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); 1564 printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n");
@@ -1578,7 +1576,7 @@ static int mv643xx_eth_shared_probe(struct device *ddev)
1578 1576
1579} 1577}
1580 1578
1581static int mv643xx_eth_shared_remove(struct device *ddev) 1579static int mv643xx_eth_shared_remove(struct platform_device *pdev)
1582{ 1580{
1583 iounmap(mv643xx_eth_shared_base); 1581 iounmap(mv643xx_eth_shared_base);
1584 mv643xx_eth_shared_base = NULL; 1582 mv643xx_eth_shared_base = NULL;
@@ -1586,18 +1584,20 @@ static int mv643xx_eth_shared_remove(struct device *ddev)
1586 return 0; 1584 return 0;
1587} 1585}
1588 1586
1589static struct device_driver mv643xx_eth_driver = { 1587static struct platform_driver mv643xx_eth_driver = {
1590 .name = MV643XX_ETH_NAME,
1591 .bus = &platform_bus_type,
1592 .probe = mv643xx_eth_probe, 1588 .probe = mv643xx_eth_probe,
1593 .remove = mv643xx_eth_remove, 1589 .remove = mv643xx_eth_remove,
1590 .driver = {
1591 .name = MV643XX_ETH_NAME,
1592 },
1594}; 1593};
1595 1594
1596static struct device_driver mv643xx_eth_shared_driver = { 1595static struct platform_driver mv643xx_eth_shared_driver = {
1597 .name = MV643XX_ETH_SHARED_NAME,
1598 .bus = &platform_bus_type,
1599 .probe = mv643xx_eth_shared_probe, 1596 .probe = mv643xx_eth_shared_probe,
1600 .remove = mv643xx_eth_shared_remove, 1597 .remove = mv643xx_eth_shared_remove,
1598 .driver = {
1599 .name = MV643XX_ETH_SHARED_NAME,
1600 },
1601}; 1601};
1602 1602
1603/* 1603/*
@@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void)
1613{ 1613{
1614 int rc; 1614 int rc;
1615 1615
1616 rc = driver_register(&mv643xx_eth_shared_driver); 1616 rc = platform_driver_register(&mv643xx_eth_shared_driver);
1617 if (!rc) { 1617 if (!rc) {
1618 rc = driver_register(&mv643xx_eth_driver); 1618 rc = platform_driver_register(&mv643xx_eth_driver);
1619 if (rc) 1619 if (rc)
1620 driver_unregister(&mv643xx_eth_shared_driver); 1620 platform_driver_unregister(&mv643xx_eth_shared_driver);
1621 } 1621 }
1622 return rc; 1622 return rc;
1623} 1623}
@@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void)
1633 */ 1633 */
1634static void __exit mv643xx_cleanup_module(void) 1634static void __exit mv643xx_cleanup_module(void)
1635{ 1635{
1636 driver_unregister(&mv643xx_eth_driver); 1636 platform_driver_unregister(&mv643xx_eth_driver);
1637 driver_unregister(&mv643xx_eth_shared_driver); 1637 platform_driver_unregister(&mv643xx_eth_shared_driver);
1638} 1638}
1639 1639
1640module_init(mv643xx_init_module); 1640module_init(mv643xx_init_module);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 74d5f1a6fdea..c91e2e81f131 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2183,9 +2183,8 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device *
2183 * 0 --> there is a device 2183 * 0 --> there is a device
2184 * anything else, error 2184 * anything else, error
2185 */ 2185 */
2186static int smc_drv_probe(struct device *dev) 2186static int smc_drv_probe(struct platform_device *pdev)
2187{ 2187{
2188 struct platform_device *pdev = to_platform_device(dev);
2189 struct net_device *ndev; 2188 struct net_device *ndev;
2190 struct resource *res; 2189 struct resource *res;
2191 unsigned int __iomem *addr; 2190 unsigned int __iomem *addr;
@@ -2212,7 +2211,7 @@ static int smc_drv_probe(struct device *dev)
2212 goto out_release_io; 2211 goto out_release_io;
2213 } 2212 }
2214 SET_MODULE_OWNER(ndev); 2213 SET_MODULE_OWNER(ndev);
2215 SET_NETDEV_DEV(ndev, dev); 2214 SET_NETDEV_DEV(ndev, &pdev->dev);
2216 2215
2217 ndev->dma = (unsigned char)-1; 2216 ndev->dma = (unsigned char)-1;
2218 ndev->irq = platform_get_irq(pdev, 0); 2217 ndev->irq = platform_get_irq(pdev, 0);
@@ -2233,7 +2232,7 @@ static int smc_drv_probe(struct device *dev)
2233 goto out_release_attrib; 2232 goto out_release_attrib;
2234 } 2233 }
2235 2234
2236 dev_set_drvdata(dev, ndev); 2235 platform_set_drvdata(pdev, ndev);
2237 ret = smc_probe(ndev, addr); 2236 ret = smc_probe(ndev, addr);
2238 if (ret != 0) 2237 if (ret != 0)
2239 goto out_iounmap; 2238 goto out_iounmap;
@@ -2249,7 +2248,7 @@ static int smc_drv_probe(struct device *dev)
2249 return 0; 2248 return 0;
2250 2249
2251 out_iounmap: 2250 out_iounmap:
2252 dev_set_drvdata(dev, NULL); 2251 platform_set_drvdata(pdev, NULL);
2253 iounmap(addr); 2252 iounmap(addr);
2254 out_release_attrib: 2253 out_release_attrib:
2255 smc_release_attrib(pdev); 2254 smc_release_attrib(pdev);
@@ -2263,14 +2262,13 @@ static int smc_drv_probe(struct device *dev)
2263 return ret; 2262 return ret;
2264} 2263}
2265 2264
2266static int smc_drv_remove(struct device *dev) 2265static int smc_drv_remove(struct platform_device *pdev)
2267{ 2266{
2268 struct platform_device *pdev = to_platform_device(dev); 2267 struct net_device *ndev = platform_get_drvdata(pdev);
2269 struct net_device *ndev = dev_get_drvdata(dev);
2270 struct smc_local *lp = netdev_priv(ndev); 2268 struct smc_local *lp = netdev_priv(ndev);
2271 struct resource *res; 2269 struct resource *res;
2272 2270
2273 dev_set_drvdata(dev, NULL); 2271 platform_set_drvdata(pdev, NULL);
2274 2272
2275 unregister_netdev(ndev); 2273 unregister_netdev(ndev);
2276 2274
@@ -2295,9 +2293,9 @@ static int smc_drv_remove(struct device *dev)
2295 return 0; 2293 return 0;
2296} 2294}
2297 2295
2298static int smc_drv_suspend(struct device *dev, pm_message_t state) 2296static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
2299{ 2297{
2300 struct net_device *ndev = dev_get_drvdata(dev); 2298 struct net_device *ndev = platform_get_drvdata(dev);
2301 2299
2302 if (ndev) { 2300 if (ndev) {
2303 if (netif_running(ndev)) { 2301 if (netif_running(ndev)) {
@@ -2309,14 +2307,13 @@ static int smc_drv_suspend(struct device *dev, pm_message_t state)
2309 return 0; 2307 return 0;
2310} 2308}
2311 2309
2312static int smc_drv_resume(struct device *dev) 2310static int smc_drv_resume(struct platform_device *dev)
2313{ 2311{
2314 struct platform_device *pdev = to_platform_device(dev); 2312 struct net_device *ndev = platform_get_drvdata(dev);
2315 struct net_device *ndev = dev_get_drvdata(dev);
2316 2313
2317 if (ndev) { 2314 if (ndev) {
2318 struct smc_local *lp = netdev_priv(ndev); 2315 struct smc_local *lp = netdev_priv(ndev);
2319 smc_enable_device(pdev); 2316 smc_enable_device(dev);
2320 if (netif_running(ndev)) { 2317 if (netif_running(ndev)) {
2321 smc_reset(ndev); 2318 smc_reset(ndev);
2322 smc_enable(ndev); 2319 smc_enable(ndev);
@@ -2328,13 +2325,14 @@ static int smc_drv_resume(struct device *dev)
2328 return 0; 2325 return 0;
2329} 2326}
2330 2327
2331static struct device_driver smc_driver = { 2328static struct platform_driver smc_driver = {
2332 .name = CARDNAME,
2333 .bus = &platform_bus_type,
2334 .probe = smc_drv_probe, 2329 .probe = smc_drv_probe,
2335 .remove = smc_drv_remove, 2330 .remove = smc_drv_remove,
2336 .suspend = smc_drv_suspend, 2331 .suspend = smc_drv_suspend,
2337 .resume = smc_drv_resume, 2332 .resume = smc_drv_resume,
2333 .driver = {
2334 .name = CARDNAME,
2335 },
2338}; 2336};
2339 2337
2340static int __init smc_init(void) 2338static int __init smc_init(void)
@@ -2348,12 +2346,12 @@ static int __init smc_init(void)
2348#endif 2346#endif
2349#endif 2347#endif
2350 2348
2351 return driver_register(&smc_driver); 2349 return platform_driver_register(&smc_driver);
2352} 2350}
2353 2351
2354static void __exit smc_cleanup(void) 2352static void __exit smc_cleanup(void)
2355{ 2353{
2356 driver_unregister(&smc_driver); 2354 platform_driver_unregister(&smc_driver);
2357} 2355}
2358 2356
2359module_init(smc_init); 2357module_init(smc_init);
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c
index d04c918ebef8..4f756960db2a 100644
--- a/drivers/net/tokenring/proteon.c
+++ b/drivers/net/tokenring/proteon.c
@@ -344,9 +344,10 @@ module_param_array(dma, int, NULL, 0);
344 344
345static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; 345static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS];
346 346
347static struct device_driver proteon_driver = { 347static struct platform_driver proteon_driver = {
348 .name = "proteon", 348 .driver = {
349 .bus = &platform_bus_type, 349 .name = "proteon",
350 },
350}; 351};
351 352
352static int __init proteon_init(void) 353static int __init proteon_init(void)
@@ -355,7 +356,7 @@ static int __init proteon_init(void)
355 struct platform_device *pdev; 356 struct platform_device *pdev;
356 int i, num = 0, err = 0; 357 int i, num = 0, err = 0;
357 358
358 err = driver_register(&proteon_driver); 359 err = platform_driver_register(&proteon_driver);
359 if (err) 360 if (err)
360 return err; 361 return err;
361 362
@@ -372,7 +373,7 @@ static int __init proteon_init(void)
372 err = setup_card(dev, &pdev->dev); 373 err = setup_card(dev, &pdev->dev);
373 if (!err) { 374 if (!err) {
374 proteon_dev[i] = pdev; 375 proteon_dev[i] = pdev;
375 dev_set_drvdata(&pdev->dev, dev); 376 platform_set_drvdata(pdev, dev);
376 ++num; 377 ++num;
377 } else { 378 } else {
378 platform_device_unregister(pdev); 379 platform_device_unregister(pdev);
@@ -399,17 +400,17 @@ static void __exit proteon_cleanup(void)
399 400
400 if (!pdev) 401 if (!pdev)
401 continue; 402 continue;
402 dev = dev_get_drvdata(&pdev->dev); 403 dev = platform_get_drvdata(pdev);
403 unregister_netdev(dev); 404 unregister_netdev(dev);
404 release_region(dev->base_addr, PROTEON_IO_EXTENT); 405 release_region(dev->base_addr, PROTEON_IO_EXTENT);
405 free_irq(dev->irq, dev); 406 free_irq(dev->irq, dev);
406 free_dma(dev->dma); 407 free_dma(dev->dma);
407 tmsdev_term(dev); 408 tmsdev_term(dev);
408 free_netdev(dev); 409 free_netdev(dev);
409 dev_set_drvdata(&pdev->dev, NULL); 410 platform_set_drvdata(pdev, NULL);
410 platform_device_unregister(pdev); 411 platform_device_unregister(pdev);
411 } 412 }
412 driver_unregister(&proteon_driver); 413 platform_driver_unregister(&proteon_driver);
413} 414}
414 415
415module_init(proteon_init); 416module_init(proteon_init);
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c
index 72cf708396be..d6ba41cf3110 100644
--- a/drivers/net/tokenring/skisa.c
+++ b/drivers/net/tokenring/skisa.c
@@ -354,9 +354,10 @@ module_param_array(dma, int, NULL, 0);
354 354
355static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; 355static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS];
356 356
357static struct device_driver sk_isa_driver = { 357static struct platform_driver sk_isa_driver = {
358 .name = "skisa", 358 .driver = {
359 .bus = &platform_bus_type, 359 .name = "skisa",
360 },
360}; 361};
361 362
362static int __init sk_isa_init(void) 363static int __init sk_isa_init(void)
@@ -365,7 +366,7 @@ static int __init sk_isa_init(void)
365 struct platform_device *pdev; 366 struct platform_device *pdev;
366 int i, num = 0, err = 0; 367 int i, num = 0, err = 0;
367 368
368 err = driver_register(&sk_isa_driver); 369 err = platform_driver_register(&sk_isa_driver);
369 if (err) 370 if (err)
370 return err; 371 return err;
371 372
@@ -382,7 +383,7 @@ static int __init sk_isa_init(void)
382 err = setup_card(dev, &pdev->dev); 383 err = setup_card(dev, &pdev->dev);
383 if (!err) { 384 if (!err) {
384 sk_isa_dev[i] = pdev; 385 sk_isa_dev[i] = pdev;
385 dev_set_drvdata(&sk_isa_dev[i]->dev, dev); 386 platform_set_drvdata(sk_isa_dev[i], dev);
386 ++num; 387 ++num;
387 } else { 388 } else {
388 platform_device_unregister(pdev); 389 platform_device_unregister(pdev);
@@ -409,17 +410,17 @@ static void __exit sk_isa_cleanup(void)
409 410
410 if (!pdev) 411 if (!pdev)
411 continue; 412 continue;
412 dev = dev_get_drvdata(&pdev->dev); 413 dev = platform_get_drvdata(pdev);
413 unregister_netdev(dev); 414 unregister_netdev(dev);
414 release_region(dev->base_addr, SK_ISA_IO_EXTENT); 415 release_region(dev->base_addr, SK_ISA_IO_EXTENT);
415 free_irq(dev->irq, dev); 416 free_irq(dev->irq, dev);
416 free_dma(dev->dma); 417 free_dma(dev->dma);
417 tmsdev_term(dev); 418 tmsdev_term(dev);
418 free_netdev(dev); 419 free_netdev(dev);
419 dev_set_drvdata(&pdev->dev, NULL); 420 platform_set_drvdata(pdev, NULL);
420 platform_device_unregister(pdev); 421 platform_device_unregister(pdev);
421 } 422 }
422 driver_unregister(&sk_isa_driver); 423 platform_driver_unregister(&sk_isa_driver);
423} 424}
424 425
425module_init(sk_isa_init); 426module_init(sk_isa_init);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 98820603e75f..3742753241ee 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line)
2381 * list is terminated with a zero flags entry, which means we expect 2381 * list is terminated with a zero flags entry, which means we expect
2382 * all entries to have at least UPF_BOOT_AUTOCONF set. 2382 * all entries to have at least UPF_BOOT_AUTOCONF set.
2383 */ 2383 */
2384static int __devinit serial8250_probe(struct device *dev) 2384static int __devinit serial8250_probe(struct platform_device *dev)
2385{ 2385{
2386 struct plat_serial8250_port *p = dev->platform_data; 2386 struct plat_serial8250_port *p = dev->dev.platform_data;
2387 struct uart_port port; 2387 struct uart_port port;
2388 int ret, i; 2388 int ret, i;
2389 2389
@@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct device *dev)
2399 port.flags = p->flags; 2399 port.flags = p->flags;
2400 port.mapbase = p->mapbase; 2400 port.mapbase = p->mapbase;
2401 port.hub6 = p->hub6; 2401 port.hub6 = p->hub6;
2402 port.dev = dev; 2402 port.dev = &dev->dev;
2403 if (share_irqs) 2403 if (share_irqs)
2404 port.flags |= UPF_SHARE_IRQ; 2404 port.flags |= UPF_SHARE_IRQ;
2405 ret = serial8250_register_port(&port); 2405 ret = serial8250_register_port(&port);
2406 if (ret < 0) { 2406 if (ret < 0) {
2407 dev_err(dev, "unable to register port at index %d " 2407 dev_err(&dev->dev, "unable to register port at index %d "
2408 "(IO%lx MEM%lx IRQ%d): %d\n", i, 2408 "(IO%lx MEM%lx IRQ%d): %d\n", i,
2409 p->iobase, p->mapbase, p->irq, ret); 2409 p->iobase, p->mapbase, p->irq, ret);
2410 } 2410 }
@@ -2415,54 +2415,55 @@ static int __devinit serial8250_probe(struct device *dev)
2415/* 2415/*
2416 * Remove serial ports registered against a platform device. 2416 * Remove serial ports registered against a platform device.
2417 */ 2417 */
2418static int __devexit serial8250_remove(struct device *dev) 2418static int __devexit serial8250_remove(struct platform_device *dev)
2419{ 2419{
2420 int i; 2420 int i;
2421 2421
2422 for (i = 0; i < UART_NR; i++) { 2422 for (i = 0; i < UART_NR; i++) {
2423 struct uart_8250_port *up = &serial8250_ports[i]; 2423 struct uart_8250_port *up = &serial8250_ports[i];
2424 2424
2425 if (up->port.dev == dev) 2425 if (up->port.dev == &dev->dev)
2426 serial8250_unregister_port(i); 2426 serial8250_unregister_port(i);
2427 } 2427 }
2428 return 0; 2428 return 0;
2429} 2429}
2430 2430
2431static int serial8250_suspend(struct device *dev, pm_message_t state) 2431static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
2432{ 2432{
2433 int i; 2433 int i;
2434 2434
2435 for (i = 0; i < UART_NR; i++) { 2435 for (i = 0; i < UART_NR; i++) {
2436 struct uart_8250_port *up = &serial8250_ports[i]; 2436 struct uart_8250_port *up = &serial8250_ports[i];
2437 2437
2438 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2438 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2439 uart_suspend_port(&serial8250_reg, &up->port); 2439 uart_suspend_port(&serial8250_reg, &up->port);
2440 } 2440 }
2441 2441
2442 return 0; 2442 return 0;
2443} 2443}
2444 2444
2445static int serial8250_resume(struct device *dev) 2445static int serial8250_resume(struct platform_device *dev)
2446{ 2446{
2447 int i; 2447 int i;
2448 2448
2449 for (i = 0; i < UART_NR; i++) { 2449 for (i = 0; i < UART_NR; i++) {
2450 struct uart_8250_port *up = &serial8250_ports[i]; 2450 struct uart_8250_port *up = &serial8250_ports[i];
2451 2451
2452 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2452 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2453 uart_resume_port(&serial8250_reg, &up->port); 2453 uart_resume_port(&serial8250_reg, &up->port);
2454 } 2454 }
2455 2455
2456 return 0; 2456 return 0;
2457} 2457}
2458 2458
2459static struct device_driver serial8250_isa_driver = { 2459static struct platform_driver serial8250_isa_driver = {
2460 .name = "serial8250",
2461 .bus = &platform_bus_type,
2462 .probe = serial8250_probe, 2460 .probe = serial8250_probe,
2463 .remove = __devexit_p(serial8250_remove), 2461 .remove = __devexit_p(serial8250_remove),
2464 .suspend = serial8250_suspend, 2462 .suspend = serial8250_suspend,
2465 .resume = serial8250_resume, 2463 .resume = serial8250_resume,
2464 .driver = {
2465 .name = "serial8250",
2466 },
2466}; 2467};
2467 2468
2468/* 2469/*
@@ -2608,7 +2609,7 @@ static int __init serial8250_init(void)
2608 2609
2609 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2610 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
2610 2611
2611 ret = driver_register(&serial8250_isa_driver); 2612 ret = platform_driver_register(&serial8250_isa_driver);
2612 if (ret == 0) 2613 if (ret == 0)
2613 goto out; 2614 goto out;
2614 2615
@@ -2630,7 +2631,7 @@ static void __exit serial8250_exit(void)
2630 */ 2631 */
2631 serial8250_isa_devs = NULL; 2632 serial8250_isa_devs = NULL;
2632 2633
2633 driver_unregister(&serial8250_isa_driver); 2634 platform_driver_unregister(&serial8250_isa_driver);
2634 platform_device_unregister(isa_dev); 2635 platform_device_unregister(isa_dev);
2635 2636
2636 uart_unregister_driver(&serial8250_reg); 2637 uart_unregister_driver(&serial8250_reg);
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 4a54ff584700..355cd93a8a87 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -921,9 +921,9 @@ static struct uart_driver imx_reg = {
921 .cons = IMX_CONSOLE, 921 .cons = IMX_CONSOLE,
922}; 922};
923 923
924static int serial_imx_suspend(struct device *_dev, pm_message_t state) 924static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
925{ 925{
926 struct imx_port *sport = dev_get_drvdata(_dev); 926 struct imx_port *sport = platform_get_drvdata(dev);
927 927
928 if (sport) 928 if (sport)
929 uart_suspend_port(&imx_reg, &sport->port); 929 uart_suspend_port(&imx_reg, &sport->port);
@@ -931,9 +931,9 @@ static int serial_imx_suspend(struct device *_dev, pm_message_t state)
931 return 0; 931 return 0;
932} 932}
933 933
934static int serial_imx_resume(struct device *_dev) 934static int serial_imx_resume(struct platform_device *dev)
935{ 935{
936 struct imx_port *sport = dev_get_drvdata(_dev); 936 struct imx_port *sport = platform_get_drvdata(dev);
937 937
938 if (sport) 938 if (sport)
939 uart_resume_port(&imx_reg, &sport->port); 939 uart_resume_port(&imx_reg, &sport->port);
@@ -941,21 +941,19 @@ static int serial_imx_resume(struct device *_dev)
941 return 0; 941 return 0;
942} 942}
943 943
944static int serial_imx_probe(struct device *_dev) 944static int serial_imx_probe(struct platform_device *dev)
945{ 945{
946 struct platform_device *dev = to_platform_device(_dev); 946 imx_ports[dev->id].port.dev = &dev->dev;
947
948 imx_ports[dev->id].port.dev = _dev;
949 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); 947 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
950 dev_set_drvdata(_dev, &imx_ports[dev->id]); 948 platform_set_drvdata(dev, &imx_ports[dev->id]);
951 return 0; 949 return 0;
952} 950}
953 951
954static int serial_imx_remove(struct device *_dev) 952static int serial_imx_remove(struct platform_device *dev)
955{ 953{
956 struct imx_port *sport = dev_get_drvdata(_dev); 954 struct imx_port *sport = platform_get_drvdata(dev);
957 955
958 dev_set_drvdata(_dev, NULL); 956 platform_set_drvdata(dev, NULL);
959 957
960 if (sport) 958 if (sport)
961 uart_remove_one_port(&imx_reg, &sport->port); 959 uart_remove_one_port(&imx_reg, &sport->port);
@@ -963,14 +961,15 @@ static int serial_imx_remove(struct device *_dev)
963 return 0; 961 return 0;
964} 962}
965 963
966static struct device_driver serial_imx_driver = { 964static struct platform_driver serial_imx_driver = {
967 .name = "imx-uart",
968 .bus = &platform_bus_type,
969 .probe = serial_imx_probe, 965 .probe = serial_imx_probe,
970 .remove = serial_imx_remove, 966 .remove = serial_imx_remove,
971 967
972 .suspend = serial_imx_suspend, 968 .suspend = serial_imx_suspend,
973 .resume = serial_imx_resume, 969 .resume = serial_imx_resume,
970 .driver = {
971 .name = "imx-uart",
972 },
974}; 973};
975 974
976static int __init imx_serial_init(void) 975static int __init imx_serial_init(void)
@@ -985,7 +984,7 @@ static int __init imx_serial_init(void)
985 if (ret) 984 if (ret)
986 return ret; 985 return ret;
987 986
988 ret = driver_register(&serial_imx_driver); 987 ret = platform_driver_register(&serial_imx_driver);
989 if (ret != 0) 988 if (ret != 0)
990 uart_unregister_driver(&imx_reg); 989 uart_unregister_driver(&imx_reg);
991 990
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 0dd08a09e7e6..5d3cb8486447 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -717,10 +717,9 @@ static struct uart_driver mpc52xx_uart_driver = {
717/* ======================================================================== */ 717/* ======================================================================== */
718 718
719static int __devinit 719static int __devinit
720mpc52xx_uart_probe(struct device *dev) 720mpc52xx_uart_probe(struct platform_device *dev)
721{ 721{
722 struct platform_device *pdev = to_platform_device(dev); 722 struct resource *res = dev->resource;
723 struct resource *res = pdev->resource;
724 723
725 struct uart_port *port = NULL; 724 struct uart_port *port = NULL;
726 int i, idx, ret; 725 int i, idx, ret;
@@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev)
761 /* Add the port to the uart sub-system */ 760 /* Add the port to the uart sub-system */
762 ret = uart_add_one_port(&mpc52xx_uart_driver, port); 761 ret = uart_add_one_port(&mpc52xx_uart_driver, port);
763 if (!ret) 762 if (!ret)
764 dev_set_drvdata(dev, (void*)port); 763 platform_set_drvdata(dev, (void*)port);
765 764
766 return ret; 765 return ret;
767} 766}
768 767
769static int 768static int
770mpc52xx_uart_remove(struct device *dev) 769mpc52xx_uart_remove(struct platform_device *dev)
771{ 770{
772 struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); 771 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
773 772
774 dev_set_drvdata(dev, NULL); 773 platform_set_drvdata(dev, NULL);
775 774
776 if (port) 775 if (port)
777 uart_remove_one_port(&mpc52xx_uart_driver, port); 776 uart_remove_one_port(&mpc52xx_uart_driver, port);
@@ -781,9 +780,9 @@ mpc52xx_uart_remove(struct device *dev)
781 780
782#ifdef CONFIG_PM 781#ifdef CONFIG_PM
783static int 782static int
784mpc52xx_uart_suspend(struct device *dev, pm_message_t state) 783mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state)
785{ 784{
786 struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); 785 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
787 786
788 if (sport) 787 if (sport)
789 uart_suspend_port(&mpc52xx_uart_driver, port); 788 uart_suspend_port(&mpc52xx_uart_driver, port);
@@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state)
792} 791}
793 792
794static int 793static int
795mpc52xx_uart_resume(struct device *dev) 794mpc52xx_uart_resume(struct platform_device *dev)
796{ 795{
797 struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); 796 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
798 797
799 if (port) 798 if (port)
800 uart_resume_port(&mpc52xx_uart_driver, port); 799 uart_resume_port(&mpc52xx_uart_driver, port);
@@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev)
803} 802}
804#endif 803#endif
805 804
806static struct device_driver mpc52xx_uart_platform_driver = { 805static struct platform_driver mpc52xx_uart_platform_driver = {
807 .name = "mpc52xx-psc",
808 .bus = &platform_bus_type,
809 .probe = mpc52xx_uart_probe, 806 .probe = mpc52xx_uart_probe,
810 .remove = mpc52xx_uart_remove, 807 .remove = mpc52xx_uart_remove,
811#ifdef CONFIG_PM 808#ifdef CONFIG_PM
812 .suspend = mpc52xx_uart_suspend, 809 .suspend = mpc52xx_uart_suspend,
813 .resume = mpc52xx_uart_resume, 810 .resume = mpc52xx_uart_resume,
814#endif 811#endif
812 .driver = {
813 .name = "mpc52xx-psc",
814 },
815}; 815};
816 816
817 817
@@ -828,7 +828,7 @@ mpc52xx_uart_init(void)
828 828
829 ret = uart_register_driver(&mpc52xx_uart_driver); 829 ret = uart_register_driver(&mpc52xx_uart_driver);
830 if (ret == 0) { 830 if (ret == 0) {
831 ret = driver_register(&mpc52xx_uart_platform_driver); 831 ret = platform_driver_register(&mpc52xx_uart_platform_driver);
832 if (ret) 832 if (ret)
833 uart_unregister_driver(&mpc52xx_uart_driver); 833 uart_unregister_driver(&mpc52xx_uart_driver);
834 } 834 }
@@ -839,7 +839,7 @@ mpc52xx_uart_init(void)
839static void __exit 839static void __exit
840mpc52xx_uart_exit(void) 840mpc52xx_uart_exit(void)
841{ 841{
842 driver_unregister(&mpc52xx_uart_platform_driver); 842 platform_driver_unregister(&mpc52xx_uart_platform_driver);
843 uart_unregister_driver(&mpc52xx_uart_driver); 843 uart_unregister_driver(&mpc52xx_uart_driver);
844} 844}
845 845
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index ba8838b234da..8f83e4007ecd 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
1551} 1551}
1552 1552
1553static int 1553static int
1554mpsc_shared_drv_probe(struct device *dev) 1554mpsc_shared_drv_probe(struct platform_device *dev)
1555{ 1555{
1556 struct platform_device *pd = to_platform_device(dev);
1557 struct mpsc_shared_pdata *pdata; 1556 struct mpsc_shared_pdata *pdata;
1558 int rc = -ENODEV; 1557 int rc = -ENODEV;
1559 1558
1560 if (pd->id == 0) { 1559 if (dev->id == 0) {
1561 if (!(rc = mpsc_shared_map_regs(pd))) { 1560 if (!(rc = mpsc_shared_map_regs(dev))) {
1562 pdata = (struct mpsc_shared_pdata *)dev->platform_data; 1561 pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
1563 1562
1564 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; 1563 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
1565 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; 1564 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
1577} 1576}
1578 1577
1579static int 1578static int
1580mpsc_shared_drv_remove(struct device *dev) 1579mpsc_shared_drv_remove(struct platform_device *dev)
1581{ 1580{
1582 struct platform_device *pd = to_platform_device(dev);
1583 int rc = -ENODEV; 1581 int rc = -ENODEV;
1584 1582
1585 if (pd->id == 0) { 1583 if (dev->id == 0) {
1586 mpsc_shared_unmap_regs(); 1584 mpsc_shared_unmap_regs();
1587 mpsc_shared_regs.MPSC_MRR_m = 0; 1585 mpsc_shared_regs.MPSC_MRR_m = 0;
1588 mpsc_shared_regs.MPSC_RCRR_m = 0; 1586 mpsc_shared_regs.MPSC_RCRR_m = 0;
@@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
1595 return rc; 1593 return rc;
1596} 1594}
1597 1595
1598static struct device_driver mpsc_shared_driver = { 1596static struct platform_driver mpsc_shared_driver = {
1599 .name = MPSC_SHARED_NAME,
1600 .bus = &platform_bus_type,
1601 .probe = mpsc_shared_drv_probe, 1597 .probe = mpsc_shared_drv_probe,
1602 .remove = mpsc_shared_drv_remove, 1598 .remove = mpsc_shared_drv_remove,
1599 .driver = {
1600 .name = MPSC_SHARED_NAME,
1601 },
1603}; 1602};
1604 1603
1605/* 1604/*
@@ -1732,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
1732} 1731}
1733 1732
1734static int 1733static int
1735mpsc_drv_probe(struct device *dev) 1734mpsc_drv_probe(struct platform_device *dev)
1736{ 1735{
1737 struct platform_device *pd = to_platform_device(dev);
1738 struct mpsc_port_info *pi; 1736 struct mpsc_port_info *pi;
1739 int rc = -ENODEV; 1737 int rc = -ENODEV;
1740 1738
1741 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); 1739 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id);
1742 1740
1743 if (pd->id < MPSC_NUM_CTLRS) { 1741 if (dev->id < MPSC_NUM_CTLRS) {
1744 pi = &mpsc_ports[pd->id]; 1742 pi = &mpsc_ports[dev->id];
1745 1743
1746 if (!(rc = mpsc_drv_map_regs(pi, pd))) { 1744 if (!(rc = mpsc_drv_map_regs(pi, dev))) {
1747 mpsc_drv_get_platform_data(pi, pd, pd->id); 1745 mpsc_drv_get_platform_data(pi, dev, dev->id);
1748 1746
1749 if (!(rc = mpsc_make_ready(pi))) 1747 if (!(rc = mpsc_make_ready(pi)))
1750 if (!(rc = uart_add_one_port(&mpsc_reg, 1748 if (!(rc = uart_add_one_port(&mpsc_reg,
@@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
1764} 1762}
1765 1763
1766static int 1764static int
1767mpsc_drv_remove(struct device *dev) 1765mpsc_drv_remove(struct platform_device *dev)
1768{ 1766{
1769 struct platform_device *pd = to_platform_device(dev); 1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
1770 1768
1771 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); 1769 if (dev->id < MPSC_NUM_CTLRS) {
1772 1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
1773 if (pd->id < MPSC_NUM_CTLRS) { 1771 mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
1774 uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); 1772 mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
1775 mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port);
1776 mpsc_drv_unmap_regs(&mpsc_ports[pd->id]);
1777 return 0; 1773 return 0;
1778 } 1774 }
1779 else 1775 else
1780 return -ENODEV; 1776 return -ENODEV;
1781} 1777}
1782 1778
1783static struct device_driver mpsc_driver = { 1779static struct platform_driver mpsc_driver = {
1784 .name = MPSC_CTLR_NAME,
1785 .bus = &platform_bus_type,
1786 .probe = mpsc_drv_probe, 1780 .probe = mpsc_drv_probe,
1787 .remove = mpsc_drv_remove, 1781 .remove = mpsc_drv_remove,
1782 .driver = {
1783 .name = MPSC_CTLR_NAME,
1784 },
1788}; 1785};
1789 1786
1790static int __init 1787static int __init
@@ -1798,9 +1795,9 @@ mpsc_drv_init(void)
1798 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1795 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
1799 1796
1800 if (!(rc = uart_register_driver(&mpsc_reg))) { 1797 if (!(rc = uart_register_driver(&mpsc_reg))) {
1801 if (!(rc = driver_register(&mpsc_shared_driver))) { 1798 if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
1802 if ((rc = driver_register(&mpsc_driver))) { 1799 if ((rc = platform_driver_register(&mpsc_driver))) {
1803 driver_unregister(&mpsc_shared_driver); 1800 platform_driver_unregister(&mpsc_shared_driver);
1804 uart_unregister_driver(&mpsc_reg); 1801 uart_unregister_driver(&mpsc_reg);
1805 } 1802 }
1806 } 1803 }
@@ -1815,8 +1812,8 @@ mpsc_drv_init(void)
1815static void __exit 1812static void __exit
1816mpsc_drv_exit(void) 1813mpsc_drv_exit(void)
1817{ 1814{
1818 driver_unregister(&mpsc_driver); 1815 platform_driver_unregister(&mpsc_driver);
1819 driver_unregister(&mpsc_shared_driver); 1816 platform_driver_unregister(&mpsc_shared_driver);
1820 uart_unregister_driver(&mpsc_reg); 1817 uart_unregister_driver(&mpsc_reg);
1821 memset(mpsc_ports, 0, sizeof(mpsc_ports)); 1818 memset(mpsc_ports, 0, sizeof(mpsc_ports));
1822 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1819 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 16b2f9417af9..ff5e6309d682 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = {
805 .cons = PXA_CONSOLE, 805 .cons = PXA_CONSOLE,
806}; 806};
807 807
808static int serial_pxa_suspend(struct device *_dev, pm_message_t state) 808static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
809{ 809{
810 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 810 struct uart_pxa_port *sport = platform_get_drvdata(dev);
811 811
812 if (sport) 812 if (sport)
813 uart_suspend_port(&serial_pxa_reg, &sport->port); 813 uart_suspend_port(&serial_pxa_reg, &sport->port);
@@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct device *_dev, pm_message_t state)
815 return 0; 815 return 0;
816} 816}
817 817
818static int serial_pxa_resume(struct device *_dev) 818static int serial_pxa_resume(struct platform_device *dev)
819{ 819{
820 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 820 struct uart_pxa_port *sport = platform_get_drvdata(dev);
821 821
822 if (sport) 822 if (sport)
823 uart_resume_port(&serial_pxa_reg, &sport->port); 823 uart_resume_port(&serial_pxa_reg, &sport->port);
@@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev)
825 return 0; 825 return 0;
826} 826}
827 827
828static int serial_pxa_probe(struct device *_dev) 828static int serial_pxa_probe(struct platform_device *dev)
829{ 829{
830 struct platform_device *dev = to_platform_device(_dev); 830 serial_pxa_ports[dev->id].port.dev = &dev->dev;
831
832 serial_pxa_ports[dev->id].port.dev = _dev;
833 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); 831 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port);
834 dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); 832 platform_set_drvdata(dev, &serial_pxa_ports[dev->id]);
835 return 0; 833 return 0;
836} 834}
837 835
838static int serial_pxa_remove(struct device *_dev) 836static int serial_pxa_remove(struct platform_device *dev)
839{ 837{
840 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 838 struct uart_pxa_port *sport = platform_get_drvdata(dev);
841 839
842 dev_set_drvdata(_dev, NULL); 840 platform_set_drvdata(dev, NULL);
843 841
844 if (sport) 842 if (sport)
845 uart_remove_one_port(&serial_pxa_reg, &sport->port); 843 uart_remove_one_port(&serial_pxa_reg, &sport->port);
@@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
847 return 0; 845 return 0;
848} 846}
849 847
850static struct device_driver serial_pxa_driver = { 848static struct platform_driver serial_pxa_driver = {
851 .name = "pxa2xx-uart",
852 .bus = &platform_bus_type,
853 .probe = serial_pxa_probe, 849 .probe = serial_pxa_probe,
854 .remove = serial_pxa_remove, 850 .remove = serial_pxa_remove,
855 851
856 .suspend = serial_pxa_suspend, 852 .suspend = serial_pxa_suspend,
857 .resume = serial_pxa_resume, 853 .resume = serial_pxa_resume,
854 .driver = {
855 .name = "pxa2xx-uart",
856 },
858}; 857};
859 858
860int __init serial_pxa_init(void) 859int __init serial_pxa_init(void)
@@ -865,7 +864,7 @@ int __init serial_pxa_init(void)
865 if (ret != 0) 864 if (ret != 0)
866 return ret; 865 return ret;
867 866
868 ret = driver_register(&serial_pxa_driver); 867 ret = platform_driver_register(&serial_pxa_driver);
869 if (ret != 0) 868 if (ret != 0)
870 uart_unregister_driver(&serial_pxa_reg); 869 uart_unregister_driver(&serial_pxa_reg);
871 870
@@ -874,7 +873,7 @@ int __init serial_pxa_init(void)
874 873
875void __exit serial_pxa_exit(void) 874void __exit serial_pxa_exit(void)
876{ 875{
877 driver_unregister(&serial_pxa_driver); 876 platform_driver_unregister(&serial_pxa_driver);
878 uart_unregister_driver(&serial_pxa_reg); 877 uart_unregister_driver(&serial_pxa_reg);
879} 878}
880 879
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 036792328d49..47681c4654e4 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -1092,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1092 1092
1093static int probe_index = 0; 1093static int probe_index = 0;
1094 1094
1095static int s3c24xx_serial_probe(struct device *_dev, 1095static int s3c24xx_serial_probe(struct platform_device *dev,
1096 struct s3c24xx_uart_info *info) 1096 struct s3c24xx_uart_info *info)
1097{ 1097{
1098 struct s3c24xx_uart_port *ourport; 1098 struct s3c24xx_uart_port *ourport;
1099 struct platform_device *dev = to_platform_device(_dev);
1100 int ret; 1099 int ret;
1101 1100
1102 dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index); 1101 dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
1103 1102
1104 ourport = &s3c24xx_serial_ports[probe_index]; 1103 ourport = &s3c24xx_serial_ports[probe_index];
1105 probe_index++; 1104 probe_index++;
@@ -1112,7 +1111,7 @@ static int s3c24xx_serial_probe(struct device *_dev,
1112 1111
1113 dbg("%s: adding port\n", __FUNCTION__); 1112 dbg("%s: adding port\n", __FUNCTION__);
1114 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); 1113 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
1115 dev_set_drvdata(_dev, &ourport->port); 1114 platform_set_drvdata(dev, &ourport->port);
1116 1115
1117 return 0; 1116 return 0;
1118 1117
@@ -1120,9 +1119,9 @@ static int s3c24xx_serial_probe(struct device *_dev,
1120 return ret; 1119 return ret;
1121} 1120}
1122 1121
1123static int s3c24xx_serial_remove(struct device *_dev) 1122static int s3c24xx_serial_remove(struct platform_device *dev)
1124{ 1123{
1125 struct uart_port *port = s3c24xx_dev_to_port(_dev); 1124 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1126 1125
1127 if (port) 1126 if (port)
1128 uart_remove_one_port(&s3c24xx_uart_drv, port); 1127 uart_remove_one_port(&s3c24xx_uart_drv, port);
@@ -1134,9 +1133,9 @@ static int s3c24xx_serial_remove(struct device *_dev)
1134 1133
1135#ifdef CONFIG_PM 1134#ifdef CONFIG_PM
1136 1135
1137static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) 1136static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
1138{ 1137{
1139 struct uart_port *port = s3c24xx_dev_to_port(dev); 1138 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1140 1139
1141 if (port) 1140 if (port)
1142 uart_suspend_port(&s3c24xx_uart_drv, port); 1141 uart_suspend_port(&s3c24xx_uart_drv, port);
@@ -1144,9 +1143,9 @@ static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state)
1144 return 0; 1143 return 0;
1145} 1144}
1146 1145
1147static int s3c24xx_serial_resume(struct device *dev) 1146static int s3c24xx_serial_resume(struct platform_device *dev)
1148{ 1147{
1149 struct uart_port *port = s3c24xx_dev_to_port(dev); 1148 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1150 struct s3c24xx_uart_port *ourport = to_ourport(port); 1149 struct s3c24xx_uart_port *ourport = to_ourport(port);
1151 1150
1152 if (port) { 1151 if (port) {
@@ -1165,11 +1164,11 @@ static int s3c24xx_serial_resume(struct device *dev)
1165#define s3c24xx_serial_resume NULL 1164#define s3c24xx_serial_resume NULL
1166#endif 1165#endif
1167 1166
1168static int s3c24xx_serial_init(struct device_driver *drv, 1167static int s3c24xx_serial_init(struct platform_driver *drv,
1169 struct s3c24xx_uart_info *info) 1168 struct s3c24xx_uart_info *info)
1170{ 1169{
1171 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); 1170 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
1172 return driver_register(drv); 1171 return platform_driver_register(drv);
1173} 1172}
1174 1173
1175 1174
@@ -1228,19 +1227,20 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = {
1228 .reset_port = s3c2400_serial_resetport, 1227 .reset_port = s3c2400_serial_resetport,
1229}; 1228};
1230 1229
1231static int s3c2400_serial_probe(struct device *dev) 1230static int s3c2400_serial_probe(struct platform_device *dev)
1232{ 1231{
1233 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); 1232 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
1234} 1233}
1235 1234
1236static struct device_driver s3c2400_serial_drv = { 1235static struct platform_driver s3c2400_serial_drv = {
1237 .name = "s3c2400-uart",
1238 .owner = THIS_MODULE,
1239 .bus = &platform_bus_type,
1240 .probe = s3c2400_serial_probe, 1236 .probe = s3c2400_serial_probe,
1241 .remove = s3c24xx_serial_remove, 1237 .remove = s3c24xx_serial_remove,
1242 .suspend = s3c24xx_serial_suspend, 1238 .suspend = s3c24xx_serial_suspend,
1243 .resume = s3c24xx_serial_resume, 1239 .resume = s3c24xx_serial_resume,
1240 .driver = {
1241 .name = "s3c2400-uart",
1242 .owner = THIS_MODULE,
1243 },
1244}; 1244};
1245 1245
1246static inline int s3c2400_serial_init(void) 1246static inline int s3c2400_serial_init(void)
@@ -1250,7 +1250,7 @@ static inline int s3c2400_serial_init(void)
1250 1250
1251static inline void s3c2400_serial_exit(void) 1251static inline void s3c2400_serial_exit(void)
1252{ 1252{
1253 driver_unregister(&s3c2400_serial_drv); 1253 platform_driver_unregister(&s3c2400_serial_drv);
1254} 1254}
1255 1255
1256#define s3c2400_uart_inf_at &s3c2400_uart_inf 1256#define s3c2400_uart_inf_at &s3c2400_uart_inf
@@ -1332,19 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
1332 1332
1333/* device management */ 1333/* device management */
1334 1334
1335static int s3c2410_serial_probe(struct device *dev) 1335static int s3c2410_serial_probe(struct platform_device *dev)
1336{ 1336{
1337 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); 1337 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
1338} 1338}
1339 1339
1340static struct device_driver s3c2410_serial_drv = { 1340static struct platform_driver s3c2410_serial_drv = {
1341 .name = "s3c2410-uart",
1342 .owner = THIS_MODULE,
1343 .bus = &platform_bus_type,
1344 .probe = s3c2410_serial_probe, 1341 .probe = s3c2410_serial_probe,
1345 .remove = s3c24xx_serial_remove, 1342 .remove = s3c24xx_serial_remove,
1346 .suspend = s3c24xx_serial_suspend, 1343 .suspend = s3c24xx_serial_suspend,
1347 .resume = s3c24xx_serial_resume, 1344 .resume = s3c24xx_serial_resume,
1345 .driver = {
1346 .name = "s3c2410-uart",
1347 .owner = THIS_MODULE,
1348 },
1348}; 1349};
1349 1350
1350static inline int s3c2410_serial_init(void) 1351static inline int s3c2410_serial_init(void)
@@ -1354,7 +1355,7 @@ static inline int s3c2410_serial_init(void)
1354 1355
1355static inline void s3c2410_serial_exit(void) 1356static inline void s3c2410_serial_exit(void)
1356{ 1357{
1357 driver_unregister(&s3c2410_serial_drv); 1358 platform_driver_unregister(&s3c2410_serial_drv);
1358} 1359}
1359 1360
1360#define s3c2410_uart_inf_at &s3c2410_uart_inf 1361#define s3c2410_uart_inf_at &s3c2410_uart_inf
@@ -1493,20 +1494,21 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = {
1493 1494
1494/* device management */ 1495/* device management */
1495 1496
1496static int s3c2440_serial_probe(struct device *dev) 1497static int s3c2440_serial_probe(struct platform_device *dev)
1497{ 1498{
1498 dbg("s3c2440_serial_probe: dev=%p\n", dev); 1499 dbg("s3c2440_serial_probe: dev=%p\n", dev);
1499 return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); 1500 return s3c24xx_serial_probe(dev, &s3c2440_uart_inf);
1500} 1501}
1501 1502
1502static struct device_driver s3c2440_serial_drv = { 1503static struct platform_driver s3c2440_serial_drv = {
1503 .name = "s3c2440-uart",
1504 .owner = THIS_MODULE,
1505 .bus = &platform_bus_type,
1506 .probe = s3c2440_serial_probe, 1504 .probe = s3c2440_serial_probe,
1507 .remove = s3c24xx_serial_remove, 1505 .remove = s3c24xx_serial_remove,
1508 .suspend = s3c24xx_serial_suspend, 1506 .suspend = s3c24xx_serial_suspend,
1509 .resume = s3c24xx_serial_resume, 1507 .resume = s3c24xx_serial_resume,
1508 .driver = {
1509 .name = "s3c2440-uart",
1510 .owner = THIS_MODULE,
1511 },
1510}; 1512};
1511 1513
1512 1514
@@ -1517,7 +1519,7 @@ static inline int s3c2440_serial_init(void)
1517 1519
1518static inline void s3c2440_serial_exit(void) 1520static inline void s3c2440_serial_exit(void)
1519{ 1521{
1520 driver_unregister(&s3c2440_serial_drv); 1522 platform_driver_unregister(&s3c2440_serial_drv);
1521} 1523}
1522 1524
1523#define s3c2440_uart_inf_at &s3c2440_uart_inf 1525#define s3c2440_uart_inf_at &s3c2440_uart_inf
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index ed618cc7ae96..fd9deee20e05 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -834,9 +834,9 @@ static struct uart_driver sa1100_reg = {
834 .cons = SA1100_CONSOLE, 834 .cons = SA1100_CONSOLE,
835}; 835};
836 836
837static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) 837static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state)
838{ 838{
839 struct sa1100_port *sport = dev_get_drvdata(_dev); 839 struct sa1100_port *sport = platform_get_drvdata(dev);
840 840
841 if (sport) 841 if (sport)
842 uart_suspend_port(&sa1100_reg, &sport->port); 842 uart_suspend_port(&sa1100_reg, &sport->port);
@@ -844,9 +844,9 @@ static int sa1100_serial_suspend(struct device *_dev, pm_message_t state)
844 return 0; 844 return 0;
845} 845}
846 846
847static int sa1100_serial_resume(struct device *_dev) 847static int sa1100_serial_resume(struct platform_device *dev)
848{ 848{
849 struct sa1100_port *sport = dev_get_drvdata(_dev); 849 struct sa1100_port *sport = platform_get_drvdata(dev);
850 850
851 if (sport) 851 if (sport)
852 uart_resume_port(&sa1100_reg, &sport->port); 852 uart_resume_port(&sa1100_reg, &sport->port);
@@ -854,9 +854,8 @@ static int sa1100_serial_resume(struct device *_dev)
854 return 0; 854 return 0;
855} 855}
856 856
857static int sa1100_serial_probe(struct device *_dev) 857static int sa1100_serial_probe(struct platform_device *dev)
858{ 858{
859 struct platform_device *dev = to_platform_device(_dev);
860 struct resource *res = dev->resource; 859 struct resource *res = dev->resource;
861 int i; 860 int i;
862 861
@@ -869,9 +868,9 @@ static int sa1100_serial_probe(struct device *_dev)
869 if (sa1100_ports[i].port.mapbase != res->start) 868 if (sa1100_ports[i].port.mapbase != res->start)
870 continue; 869 continue;
871 870
872 sa1100_ports[i].port.dev = _dev; 871 sa1100_ports[i].port.dev = &dev->dev;
873 uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); 872 uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port);
874 dev_set_drvdata(_dev, &sa1100_ports[i]); 873 platform_set_drvdata(dev, &sa1100_ports[i]);
875 break; 874 break;
876 } 875 }
877 } 876 }
@@ -879,11 +878,11 @@ static int sa1100_serial_probe(struct device *_dev)
879 return 0; 878 return 0;
880} 879}
881 880
882static int sa1100_serial_remove(struct device *_dev) 881static int sa1100_serial_remove(struct platform_device *pdev)
883{ 882{
884 struct sa1100_port *sport = dev_get_drvdata(_dev); 883 struct sa1100_port *sport = platform_get_drvdata(pdev);
885 884
886 dev_set_drvdata(_dev, NULL); 885 platform_set_drvdata(pdev, NULL);
887 886
888 if (sport) 887 if (sport)
889 uart_remove_one_port(&sa1100_reg, &sport->port); 888 uart_remove_one_port(&sa1100_reg, &sport->port);
@@ -891,13 +890,14 @@ static int sa1100_serial_remove(struct device *_dev)
891 return 0; 890 return 0;
892} 891}
893 892
894static struct device_driver sa11x0_serial_driver = { 893static struct platform_driver sa11x0_serial_driver = {
895 .name = "sa11x0-uart",
896 .bus = &platform_bus_type,
897 .probe = sa1100_serial_probe, 894 .probe = sa1100_serial_probe,
898 .remove = sa1100_serial_remove, 895 .remove = sa1100_serial_remove,
899 .suspend = sa1100_serial_suspend, 896 .suspend = sa1100_serial_suspend,
900 .resume = sa1100_serial_resume, 897 .resume = sa1100_serial_resume,
898 .driver = {
899 .name = "sa11x0-uart",
900 },
901}; 901};
902 902
903static int __init sa1100_serial_init(void) 903static int __init sa1100_serial_init(void)
@@ -910,7 +910,7 @@ static int __init sa1100_serial_init(void)
910 910
911 ret = uart_register_driver(&sa1100_reg); 911 ret = uart_register_driver(&sa1100_reg);
912 if (ret == 0) { 912 if (ret == 0) {
913 ret = driver_register(&sa11x0_serial_driver); 913 ret = platform_driver_register(&sa11x0_serial_driver);
914 if (ret) 914 if (ret)
915 uart_unregister_driver(&sa1100_reg); 915 uart_unregister_driver(&sa1100_reg);
916 } 916 }
@@ -919,7 +919,7 @@ static int __init sa1100_serial_init(void)
919 919
920static void __exit sa1100_serial_exit(void) 920static void __exit sa1100_serial_exit(void)
921{ 921{
922 driver_unregister(&sa11x0_serial_driver); 922 platform_driver_unregister(&sa11x0_serial_driver);
923 uart_unregister_driver(&sa1100_reg); 923 uart_unregister_driver(&sa1100_reg);
924} 924}
925 925
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index 01696b3e3f61..865d4dea65df 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -924,7 +924,7 @@ static struct uart_driver siu_uart_driver = {
924 .cons = SERIAL_VR41XX_CONSOLE, 924 .cons = SERIAL_VR41XX_CONSOLE,
925}; 925};
926 926
927static int siu_probe(struct device *dev) 927static int siu_probe(struct platform_device *dev)
928{ 928{
929 struct uart_port *port; 929 struct uart_port *port;
930 int num, i, retval; 930 int num, i, retval;
@@ -941,7 +941,7 @@ static int siu_probe(struct device *dev)
941 for (i = 0; i < num; i++) { 941 for (i = 0; i < num; i++) {
942 port = &siu_uart_ports[i]; 942 port = &siu_uart_ports[i];
943 port->ops = &siu_uart_ops; 943 port->ops = &siu_uart_ops;
944 port->dev = dev; 944 port->dev = &dev->dev;
945 945
946 retval = uart_add_one_port(&siu_uart_driver, port); 946 retval = uart_add_one_port(&siu_uart_driver, port);
947 if (retval < 0) { 947 if (retval < 0) {
@@ -958,14 +958,14 @@ static int siu_probe(struct device *dev)
958 return 0; 958 return 0;
959} 959}
960 960
961static int siu_remove(struct device *dev) 961static int siu_remove(struct platform_device *dev)
962{ 962{
963 struct uart_port *port; 963 struct uart_port *port;
964 int i; 964 int i;
965 965
966 for (i = 0; i < siu_uart_driver.nr; i++) { 966 for (i = 0; i < siu_uart_driver.nr; i++) {
967 port = &siu_uart_ports[i]; 967 port = &siu_uart_ports[i];
968 if (port->dev == dev) { 968 if (port->dev == &dev->dev) {
969 uart_remove_one_port(&siu_uart_driver, port); 969 uart_remove_one_port(&siu_uart_driver, port);
970 port->dev = NULL; 970 port->dev = NULL;
971 } 971 }
@@ -976,7 +976,7 @@ static int siu_remove(struct device *dev)
976 return 0; 976 return 0;
977} 977}
978 978
979static int siu_suspend(struct device *dev, pm_message_t state) 979static int siu_suspend(struct platform_device *dev, pm_message_t state)
980{ 980{
981 struct uart_port *port; 981 struct uart_port *port;
982 int i; 982 int i;
@@ -984,7 +984,7 @@ static int siu_suspend(struct device *dev, pm_message_t state)
984 for (i = 0; i < siu_uart_driver.nr; i++) { 984 for (i = 0; i < siu_uart_driver.nr; i++) {
985 port = &siu_uart_ports[i]; 985 port = &siu_uart_ports[i];
986 if ((port->type == PORT_VR41XX_SIU || 986 if ((port->type == PORT_VR41XX_SIU ||
987 port->type == PORT_VR41XX_DSIU) && port->dev == dev) 987 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
988 uart_suspend_port(&siu_uart_driver, port); 988 uart_suspend_port(&siu_uart_driver, port);
989 989
990 } 990 }
@@ -992,7 +992,7 @@ static int siu_suspend(struct device *dev, pm_message_t state)
992 return 0; 992 return 0;
993} 993}
994 994
995static int siu_resume(struct device *dev) 995static int siu_resume(struct platform_device *dev)
996{ 996{
997 struct uart_port *port; 997 struct uart_port *port;
998 int i; 998 int i;
@@ -1000,7 +1000,7 @@ static int siu_resume(struct device *dev)
1000 for (i = 0; i < siu_uart_driver.nr; i++) { 1000 for (i = 0; i < siu_uart_driver.nr; i++) {
1001 port = &siu_uart_ports[i]; 1001 port = &siu_uart_ports[i];
1002 if ((port->type == PORT_VR41XX_SIU || 1002 if ((port->type == PORT_VR41XX_SIU ||
1003 port->type == PORT_VR41XX_DSIU) && port->dev == dev) 1003 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
1004 uart_resume_port(&siu_uart_driver, port); 1004 uart_resume_port(&siu_uart_driver, port);
1005 } 1005 }
1006 1006
@@ -1009,13 +1009,14 @@ static int siu_resume(struct device *dev)
1009 1009
1010static struct platform_device *siu_platform_device; 1010static struct platform_device *siu_platform_device;
1011 1011
1012static struct device_driver siu_device_driver = { 1012static struct platform_driver siu_device_driver = {
1013 .name = "SIU",
1014 .bus = &platform_bus_type,
1015 .probe = siu_probe, 1013 .probe = siu_probe,
1016 .remove = siu_remove, 1014 .remove = siu_remove,
1017 .suspend = siu_suspend, 1015 .suspend = siu_suspend,
1018 .resume = siu_resume, 1016 .resume = siu_resume,
1017 .driver = {
1018 .name = "SIU",
1019 },
1019}; 1020};
1020 1021
1021static int __devinit vr41xx_siu_init(void) 1022static int __devinit vr41xx_siu_init(void)
@@ -1026,7 +1027,7 @@ static int __devinit vr41xx_siu_init(void)
1026 if (IS_ERR(siu_platform_device)) 1027 if (IS_ERR(siu_platform_device))
1027 return PTR_ERR(siu_platform_device); 1028 return PTR_ERR(siu_platform_device);
1028 1029
1029 retval = driver_register(&siu_device_driver); 1030 retval = platform_driver_register(&siu_device_driver);
1030 if (retval < 0) 1031 if (retval < 0)
1031 platform_device_unregister(siu_platform_device); 1032 platform_device_unregister(siu_platform_device);
1032 1033
@@ -1035,7 +1036,7 @@ static int __devinit vr41xx_siu_init(void)
1035 1036
1036static void __devexit vr41xx_siu_exit(void) 1037static void __devexit vr41xx_siu_exit(void)
1037{ 1038{
1038 driver_unregister(&siu_device_driver); 1039 platform_driver_unregister(&siu_device_driver);
1039 1040
1040 platform_device_unregister(siu_platform_device); 1041 platform_device_unregister(siu_platform_device);
1041} 1042}
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 975ace3f5b1e..6b93dbbf3246 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -897,7 +897,7 @@ dummy_gadget_release (struct device *dev)
897#endif 897#endif
898} 898}
899 899
900static int dummy_udc_probe (struct device *dev) 900static int dummy_udc_probe (struct platform_device *dev)
901{ 901{
902 struct dummy *dum = the_controller; 902 struct dummy *dum = the_controller;
903 int rc; 903 int rc;
@@ -910,7 +910,7 @@ static int dummy_udc_probe (struct device *dev)
910 dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); 910 dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0);
911 911
912 strcpy (dum->gadget.dev.bus_id, "gadget"); 912 strcpy (dum->gadget.dev.bus_id, "gadget");
913 dum->gadget.dev.parent = dev; 913 dum->gadget.dev.parent = &dev->dev;
914 dum->gadget.dev.release = dummy_gadget_release; 914 dum->gadget.dev.release = dummy_gadget_release;
915 rc = device_register (&dum->gadget.dev); 915 rc = device_register (&dum->gadget.dev);
916 if (rc < 0) 916 if (rc < 0)
@@ -920,26 +920,26 @@ static int dummy_udc_probe (struct device *dev)
920 usb_bus_get (&dummy_to_hcd (dum)->self); 920 usb_bus_get (&dummy_to_hcd (dum)->self);
921#endif 921#endif
922 922
923 dev_set_drvdata (dev, dum); 923 platform_set_drvdata (dev, dum);
924 device_create_file (&dum->gadget.dev, &dev_attr_function); 924 device_create_file (&dum->gadget.dev, &dev_attr_function);
925 return rc; 925 return rc;
926} 926}
927 927
928static int dummy_udc_remove (struct device *dev) 928static int dummy_udc_remove (struct platform_device *dev)
929{ 929{
930 struct dummy *dum = dev_get_drvdata (dev); 930 struct dummy *dum = platform_get_drvdata (dev);
931 931
932 dev_set_drvdata (dev, NULL); 932 platform_set_drvdata (dev, NULL);
933 device_remove_file (&dum->gadget.dev, &dev_attr_function); 933 device_remove_file (&dum->gadget.dev, &dev_attr_function);
934 device_unregister (&dum->gadget.dev); 934 device_unregister (&dum->gadget.dev);
935 return 0; 935 return 0;
936} 936}
937 937
938static int dummy_udc_suspend (struct device *dev, pm_message_t state) 938static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state)
939{ 939{
940 struct dummy *dum = dev_get_drvdata(dev); 940 struct dummy *dum = platform_get_drvdata(dev);
941 941
942 dev_dbg (dev, "%s\n", __FUNCTION__); 942 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
943 spin_lock_irq (&dum->lock); 943 spin_lock_irq (&dum->lock);
944 dum->udc_suspended = 1; 944 dum->udc_suspended = 1;
945 set_link_state (dum); 945 set_link_state (dum);
@@ -950,29 +950,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state)
950 return 0; 950 return 0;
951} 951}
952 952
953static int dummy_udc_resume (struct device *dev) 953static int dummy_udc_resume (struct platform_device *dev)
954{ 954{
955 struct dummy *dum = dev_get_drvdata(dev); 955 struct dummy *dum = platform_get_drvdata(dev);
956 956
957 dev_dbg (dev, "%s\n", __FUNCTION__); 957 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
958 spin_lock_irq (&dum->lock); 958 spin_lock_irq (&dum->lock);
959 dum->udc_suspended = 0; 959 dum->udc_suspended = 0;
960 set_link_state (dum); 960 set_link_state (dum);
961 spin_unlock_irq (&dum->lock); 961 spin_unlock_irq (&dum->lock);
962 962
963 dev->power.power_state = PMSG_ON; 963 dev->dev.power.power_state = PMSG_ON;
964 usb_hcd_poll_rh_status (dummy_to_hcd (dum)); 964 usb_hcd_poll_rh_status (dummy_to_hcd (dum));
965 return 0; 965 return 0;
966} 966}
967 967
968static struct device_driver dummy_udc_driver = { 968static struct platform_driver dummy_udc_driver = {
969 .name = (char *) gadget_name,
970 .owner = THIS_MODULE,
971 .bus = &platform_bus_type,
972 .probe = dummy_udc_probe, 969 .probe = dummy_udc_probe,
973 .remove = dummy_udc_remove, 970 .remove = dummy_udc_remove,
974 .suspend = dummy_udc_suspend, 971 .suspend = dummy_udc_suspend,
975 .resume = dummy_udc_resume, 972 .resume = dummy_udc_resume,
973 .driver = {
974 .name = (char *) gadget_name,
975 .owner = THIS_MODULE,
976 },
976}; 977};
977 978
978/*-------------------------------------------------------------------------*/ 979/*-------------------------------------------------------------------------*/
@@ -1899,14 +1900,14 @@ static const struct hc_driver dummy_hcd = {
1899 .bus_resume = dummy_bus_resume, 1900 .bus_resume = dummy_bus_resume,
1900}; 1901};
1901 1902
1902static int dummy_hcd_probe (struct device *dev) 1903static int dummy_hcd_probe (struct platform_device *dev)
1903{ 1904{
1904 struct usb_hcd *hcd; 1905 struct usb_hcd *hcd;
1905 int retval; 1906 int retval;
1906 1907
1907 dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); 1908 dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);
1908 1909
1909 hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); 1910 hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id);
1910 if (!hcd) 1911 if (!hcd)
1911 return -ENOMEM; 1912 return -ENOMEM;
1912 the_controller = hcd_to_dummy (hcd); 1913 the_controller = hcd_to_dummy (hcd);
@@ -1919,48 +1920,49 @@ static int dummy_hcd_probe (struct device *dev)
1919 return retval; 1920 return retval;
1920} 1921}
1921 1922
1922static int dummy_hcd_remove (struct device *dev) 1923static int dummy_hcd_remove (struct platform_device *dev)
1923{ 1924{
1924 struct usb_hcd *hcd; 1925 struct usb_hcd *hcd;
1925 1926
1926 hcd = dev_get_drvdata (dev); 1927 hcd = platform_get_drvdata (dev);
1927 usb_remove_hcd (hcd); 1928 usb_remove_hcd (hcd);
1928 usb_put_hcd (hcd); 1929 usb_put_hcd (hcd);
1929 the_controller = NULL; 1930 the_controller = NULL;
1930 return 0; 1931 return 0;
1931} 1932}
1932 1933
1933static int dummy_hcd_suspend (struct device *dev, pm_message_t state) 1934static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state)
1934{ 1935{
1935 struct usb_hcd *hcd; 1936 struct usb_hcd *hcd;
1936 1937
1937 dev_dbg (dev, "%s\n", __FUNCTION__); 1938 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
1938 hcd = dev_get_drvdata (dev); 1939 hcd = platform_get_drvdata (dev);
1939 1940
1940 hcd->state = HC_STATE_SUSPENDED; 1941 hcd->state = HC_STATE_SUSPENDED;
1941 return 0; 1942 return 0;
1942} 1943}
1943 1944
1944static int dummy_hcd_resume (struct device *dev) 1945static int dummy_hcd_resume (struct platform_device *dev)
1945{ 1946{
1946 struct usb_hcd *hcd; 1947 struct usb_hcd *hcd;
1947 1948
1948 dev_dbg (dev, "%s\n", __FUNCTION__); 1949 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
1949 hcd = dev_get_drvdata (dev); 1950 hcd = platform_get_drvdata (dev);
1950 hcd->state = HC_STATE_RUNNING; 1951 hcd->state = HC_STATE_RUNNING;
1951 1952
1952 usb_hcd_poll_rh_status (hcd); 1953 usb_hcd_poll_rh_status (hcd);
1953 return 0; 1954 return 0;
1954} 1955}
1955 1956
1956static struct device_driver dummy_hcd_driver = { 1957static struct platform_driver dummy_hcd_driver = {
1957 .name = (char *) driver_name,
1958 .owner = THIS_MODULE,
1959 .bus = &platform_bus_type,
1960 .probe = dummy_hcd_probe, 1958 .probe = dummy_hcd_probe,
1961 .remove = dummy_hcd_remove, 1959 .remove = dummy_hcd_remove,
1962 .suspend = dummy_hcd_suspend, 1960 .suspend = dummy_hcd_suspend,
1963 .resume = dummy_hcd_resume, 1961 .resume = dummy_hcd_resume,
1962 .driver = {
1963 .name = (char *) driver_name,
1964 .owner = THIS_MODULE,
1965 },
1964}; 1966};
1965 1967
1966/*-------------------------------------------------------------------------*/ 1968/*-------------------------------------------------------------------------*/
@@ -1996,11 +1998,11 @@ static int __init init (void)
1996 if (usb_disabled ()) 1998 if (usb_disabled ())
1997 return -ENODEV; 1999 return -ENODEV;
1998 2000
1999 retval = driver_register (&dummy_hcd_driver); 2001 retval = platform_driver_register (&dummy_hcd_driver);
2000 if (retval < 0) 2002 if (retval < 0)
2001 return retval; 2003 return retval;
2002 2004
2003 retval = driver_register (&dummy_udc_driver); 2005 retval = platform_driver_register (&dummy_udc_driver);
2004 if (retval < 0) 2006 if (retval < 0)
2005 goto err_register_udc_driver; 2007 goto err_register_udc_driver;
2006 2008
@@ -2016,9 +2018,9 @@ static int __init init (void)
2016err_register_udc: 2018err_register_udc:
2017 platform_device_unregister (&the_hcd_pdev); 2019 platform_device_unregister (&the_hcd_pdev);
2018err_register_hcd: 2020err_register_hcd:
2019 driver_unregister (&dummy_udc_driver); 2021 platform_driver_unregister (&dummy_udc_driver);
2020err_register_udc_driver: 2022err_register_udc_driver:
2021 driver_unregister (&dummy_hcd_driver); 2023 platform_driver_unregister (&dummy_hcd_driver);
2022 return retval; 2024 return retval;
2023} 2025}
2024module_init (init); 2026module_init (init);
@@ -2027,7 +2029,7 @@ static void __exit cleanup (void)
2027{ 2029{
2028 platform_device_unregister (&the_udc_pdev); 2030 platform_device_unregister (&the_udc_pdev);
2029 platform_device_unregister (&the_hcd_pdev); 2031 platform_device_unregister (&the_hcd_pdev);
2030 driver_unregister (&dummy_udc_driver); 2032 platform_driver_unregister (&dummy_udc_driver);
2031 driver_unregister (&dummy_hcd_driver); 2033 platform_driver_unregister (&dummy_hcd_driver);
2032} 2034}
2033module_exit (cleanup); 2035module_exit (cleanup);
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index bc6269f10cbb..e02fea5a5433 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -2085,21 +2085,21 @@ static struct lh7a40x_udc memory = {
2085/* 2085/*
2086 * probe - binds to the platform device 2086 * probe - binds to the platform device
2087 */ 2087 */
2088static int lh7a40x_udc_probe(struct device *_dev) 2088static int lh7a40x_udc_probe(struct platform_device *pdev)
2089{ 2089{
2090 struct lh7a40x_udc *dev = &memory; 2090 struct lh7a40x_udc *dev = &memory;
2091 int retval; 2091 int retval;
2092 2092
2093 DEBUG("%s: %p\n", __FUNCTION__, _dev); 2093 DEBUG("%s: %p\n", __FUNCTION__, pdev);
2094 2094
2095 spin_lock_init(&dev->lock); 2095 spin_lock_init(&dev->lock);
2096 dev->dev = _dev; 2096 dev->dev = &pdev->dev;
2097 2097
2098 device_initialize(&dev->gadget.dev); 2098 device_initialize(&dev->gadget.dev);
2099 dev->gadget.dev.parent = _dev; 2099 dev->gadget.dev.parent = &pdev->dev;
2100 2100
2101 the_controller = dev; 2101 the_controller = dev;
2102 dev_set_drvdata(_dev, dev); 2102 platform_set_drvdata(pdev, dev);
2103 2103
2104 udc_disable(dev); 2104 udc_disable(dev);
2105 udc_reinit(dev); 2105 udc_reinit(dev);
@@ -2119,11 +2119,11 @@ static int lh7a40x_udc_probe(struct device *_dev)
2119 return retval; 2119 return retval;
2120} 2120}
2121 2121
2122static int lh7a40x_udc_remove(struct device *_dev) 2122static int lh7a40x_udc_remove(struct platform_device *pdev)
2123{ 2123{
2124 struct lh7a40x_udc *dev = _dev->driver_data; 2124 struct lh7a40x_udc *dev = platform_get_drvdata(pdev);
2125 2125
2126 DEBUG("%s: %p\n", __FUNCTION__, dev); 2126 DEBUG("%s: %p\n", __FUNCTION__, pdev);
2127 2127
2128 udc_disable(dev); 2128 udc_disable(dev);
2129 remove_proc_files(); 2129 remove_proc_files();
@@ -2131,7 +2131,7 @@ static int lh7a40x_udc_remove(struct device *_dev)
2131 2131
2132 free_irq(IRQ_USBINTR, dev); 2132 free_irq(IRQ_USBINTR, dev);
2133 2133
2134 dev_set_drvdata(_dev, 0); 2134 platform_set_drvdata(pdev, 0);
2135 2135
2136 the_controller = 0; 2136 the_controller = 0;
2137 2137
@@ -2140,26 +2140,27 @@ static int lh7a40x_udc_remove(struct device *_dev)
2140 2140
2141/*-------------------------------------------------------------------------*/ 2141/*-------------------------------------------------------------------------*/
2142 2142
2143static struct device_driver udc_driver = { 2143static struct platform_driver udc_driver = {
2144 .name = (char *)driver_name,
2145 .owner = THIS_MODULE,
2146 .bus = &platform_bus_type,
2147 .probe = lh7a40x_udc_probe, 2144 .probe = lh7a40x_udc_probe,
2148 .remove = lh7a40x_udc_remove 2145 .remove = lh7a40x_udc_remove
2149 /* FIXME power management support */ 2146 /* FIXME power management support */
2150 /* .suspend = ... disable UDC */ 2147 /* .suspend = ... disable UDC */
2151 /* .resume = ... re-enable UDC */ 2148 /* .resume = ... re-enable UDC */
2149 .driver = {
2150 .name = (char *)driver_name,
2151 .owner = THIS_MODULE,
2152 },
2152}; 2153};
2153 2154
2154static int __init udc_init(void) 2155static int __init udc_init(void)
2155{ 2156{
2156 DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); 2157 DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION);
2157 return driver_register(&udc_driver); 2158 return platform_driver_register(&udc_driver);
2158} 2159}
2159 2160
2160static void __exit udc_exit(void) 2161static void __exit udc_exit(void)
2161{ 2162{
2162 driver_unregister(&udc_driver); 2163 platform_driver_unregister(&udc_driver);
2163} 2164}
2164 2165
2165module_init(udc_init); 2166module_init(udc_init);
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 387692a3611e..a8972d7c97be 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2707,18 +2707,17 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
2707 return 0; 2707 return 0;
2708} 2708}
2709 2709
2710static int __init omap_udc_probe(struct device *dev) 2710static int __init omap_udc_probe(struct platform_device *pdev)
2711{ 2711{
2712 struct platform_device *odev = to_platform_device(dev);
2713 int status = -ENODEV; 2712 int status = -ENODEV;
2714 int hmc; 2713 int hmc;
2715 struct otg_transceiver *xceiv = NULL; 2714 struct otg_transceiver *xceiv = NULL;
2716 const char *type = NULL; 2715 const char *type = NULL;
2717 struct omap_usb_config *config = dev->platform_data; 2716 struct omap_usb_config *config = pdev->dev.platform_data;
2718 2717
2719 /* NOTE: "knows" the order of the resources! */ 2718 /* NOTE: "knows" the order of the resources! */
2720 if (!request_mem_region(odev->resource[0].start, 2719 if (!request_mem_region(pdev->resource[0].start,
2721 odev->resource[0].end - odev->resource[0].start + 1, 2720 pdev->resource[0].end - pdev->resource[0].start + 1,
2722 driver_name)) { 2721 driver_name)) {
2723 DBG("request_mem_region failed\n"); 2722 DBG("request_mem_region failed\n");
2724 return -EBUSY; 2723 return -EBUSY;
@@ -2803,7 +2802,7 @@ bad_on_1710:
2803 INFO("hmc mode %d, %s transceiver\n", hmc, type); 2802 INFO("hmc mode %d, %s transceiver\n", hmc, type);
2804 2803
2805 /* a "gadget" abstracts/virtualizes the controller */ 2804 /* a "gadget" abstracts/virtualizes the controller */
2806 status = omap_udc_setup(odev, xceiv); 2805 status = omap_udc_setup(pdev, xceiv);
2807 if (status) { 2806 if (status) {
2808 goto cleanup0; 2807 goto cleanup0;
2809 } 2808 }
@@ -2821,28 +2820,28 @@ bad_on_1710:
2821 udc->clr_halt = UDC_RESET_EP; 2820 udc->clr_halt = UDC_RESET_EP;
2822 2821
2823 /* USB general purpose IRQ: ep0, state changes, dma, etc */ 2822 /* USB general purpose IRQ: ep0, state changes, dma, etc */
2824 status = request_irq(odev->resource[1].start, omap_udc_irq, 2823 status = request_irq(pdev->resource[1].start, omap_udc_irq,
2825 SA_SAMPLE_RANDOM, driver_name, udc); 2824 SA_SAMPLE_RANDOM, driver_name, udc);
2826 if (status != 0) { 2825 if (status != 0) {
2827 ERR( "can't get irq %ld, err %d\n", 2826 ERR( "can't get irq %ld, err %d\n",
2828 odev->resource[1].start, status); 2827 pdev->resource[1].start, status);
2829 goto cleanup1; 2828 goto cleanup1;
2830 } 2829 }
2831 2830
2832 /* USB "non-iso" IRQ (PIO for all but ep0) */ 2831 /* USB "non-iso" IRQ (PIO for all but ep0) */
2833 status = request_irq(odev->resource[2].start, omap_udc_pio_irq, 2832 status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
2834 SA_SAMPLE_RANDOM, "omap_udc pio", udc); 2833 SA_SAMPLE_RANDOM, "omap_udc pio", udc);
2835 if (status != 0) { 2834 if (status != 0) {
2836 ERR( "can't get irq %ld, err %d\n", 2835 ERR( "can't get irq %ld, err %d\n",
2837 odev->resource[2].start, status); 2836 pdev->resource[2].start, status);
2838 goto cleanup2; 2837 goto cleanup2;
2839 } 2838 }
2840#ifdef USE_ISO 2839#ifdef USE_ISO
2841 status = request_irq(odev->resource[3].start, omap_udc_iso_irq, 2840 status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
2842 SA_INTERRUPT, "omap_udc iso", udc); 2841 SA_INTERRUPT, "omap_udc iso", udc);
2843 if (status != 0) { 2842 if (status != 0) {
2844 ERR("can't get irq %ld, err %d\n", 2843 ERR("can't get irq %ld, err %d\n",
2845 odev->resource[3].start, status); 2844 pdev->resource[3].start, status);
2846 goto cleanup3; 2845 goto cleanup3;
2847 } 2846 }
2848#endif 2847#endif
@@ -2853,11 +2852,11 @@ bad_on_1710:
2853 2852
2854#ifdef USE_ISO 2853#ifdef USE_ISO
2855cleanup3: 2854cleanup3:
2856 free_irq(odev->resource[2].start, udc); 2855 free_irq(pdev->resource[2].start, udc);
2857#endif 2856#endif
2858 2857
2859cleanup2: 2858cleanup2:
2860 free_irq(odev->resource[1].start, udc); 2859 free_irq(pdev->resource[1].start, udc);
2861 2860
2862cleanup1: 2861cleanup1:
2863 kfree (udc); 2862 kfree (udc);
@@ -2866,14 +2865,13 @@ cleanup1:
2866cleanup0: 2865cleanup0:
2867 if (xceiv) 2866 if (xceiv)
2868 put_device(xceiv->dev); 2867 put_device(xceiv->dev);
2869 release_mem_region(odev->resource[0].start, 2868 release_mem_region(pdev->resource[0].start,
2870 odev->resource[0].end - odev->resource[0].start + 1); 2869 pdev->resource[0].end - pdev->resource[0].start + 1);
2871 return status; 2870 return status;
2872} 2871}
2873 2872
2874static int __exit omap_udc_remove(struct device *dev) 2873static int __exit omap_udc_remove(struct platform_device *pdev)
2875{ 2874{
2876 struct platform_device *odev = to_platform_device(dev);
2877 DECLARE_COMPLETION(done); 2875 DECLARE_COMPLETION(done);
2878 2876
2879 if (!udc) 2877 if (!udc)
@@ -2891,13 +2889,13 @@ static int __exit omap_udc_remove(struct device *dev)
2891 remove_proc_file(); 2889 remove_proc_file();
2892 2890
2893#ifdef USE_ISO 2891#ifdef USE_ISO
2894 free_irq(odev->resource[3].start, udc); 2892 free_irq(pdev->resource[3].start, udc);
2895#endif 2893#endif
2896 free_irq(odev->resource[2].start, udc); 2894 free_irq(pdev->resource[2].start, udc);
2897 free_irq(odev->resource[1].start, udc); 2895 free_irq(pdev->resource[1].start, udc);
2898 2896
2899 release_mem_region(odev->resource[0].start, 2897 release_mem_region(pdev->resource[0].start,
2900 odev->resource[0].end - odev->resource[0].start + 1); 2898 pdev->resource[0].end - pdev->resource[0].start + 1);
2901 2899
2902 device_unregister(&udc->gadget.dev); 2900 device_unregister(&udc->gadget.dev);
2903 wait_for_completion(&done); 2901 wait_for_completion(&done);
@@ -2915,7 +2913,7 @@ static int __exit omap_udc_remove(struct device *dev)
2915 * may involve talking to an external transceiver (e.g. isp1301). 2913 * may involve talking to an external transceiver (e.g. isp1301).
2916 */ 2914 */
2917 2915
2918static int omap_udc_suspend(struct device *dev, pm_message_t message) 2916static int omap_udc_suspend(struct platform_device *dev, pm_message_t message)
2919{ 2917{
2920 u32 devstat; 2918 u32 devstat;
2921 2919
@@ -2935,7 +2933,7 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message)
2935 return 0; 2933 return 0;
2936} 2934}
2937 2935
2938static int omap_udc_resume(struct device *dev) 2936static int omap_udc_resume(struct platform_device *dev)
2939{ 2937{
2940 DBG("resume + wakeup/SRP\n"); 2938 DBG("resume + wakeup/SRP\n");
2941 omap_pullup(&udc->gadget, 1); 2939 omap_pullup(&udc->gadget, 1);
@@ -2947,14 +2945,15 @@ static int omap_udc_resume(struct device *dev)
2947 2945
2948/*-------------------------------------------------------------------------*/ 2946/*-------------------------------------------------------------------------*/
2949 2947
2950static struct device_driver udc_driver = { 2948static struct platform_driver udc_driver = {
2951 .name = (char *) driver_name,
2952 .owner = THIS_MODULE,
2953 .bus = &platform_bus_type,
2954 .probe = omap_udc_probe, 2949 .probe = omap_udc_probe,
2955 .remove = __exit_p(omap_udc_remove), 2950 .remove = __exit_p(omap_udc_remove),
2956 .suspend = omap_udc_suspend, 2951 .suspend = omap_udc_suspend,
2957 .resume = omap_udc_resume, 2952 .resume = omap_udc_resume,
2953 .driver = {
2954 .owner = THIS_MODULE,
2955 .name = (char *) driver_name,
2956 },
2958}; 2957};
2959 2958
2960static int __init udc_init(void) 2959static int __init udc_init(void)
@@ -2965,13 +2964,13 @@ static int __init udc_init(void)
2965#endif 2964#endif
2966 "%s\n", driver_desc, 2965 "%s\n", driver_desc,
2967 use_dma ? " (dma)" : ""); 2966 use_dma ? " (dma)" : "");
2968 return driver_register(&udc_driver); 2967 return platform_driver_register(&udc_driver);
2969} 2968}
2970module_init(udc_init); 2969module_init(udc_init);
2971 2970
2972static void __exit udc_exit(void) 2971static void __exit udc_exit(void)
2973{ 2972{
2974 driver_unregister(&udc_driver); 2973 platform_driver_unregister(&udc_driver);
2975} 2974}
2976module_exit(udc_exit); 2975module_exit(udc_exit);
2977 2976
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index ee9cd7869d92..91bf18b8191f 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2433,7 +2433,7 @@ static struct pxa2xx_udc memory = {
2433/* 2433/*
2434 * probe - binds to the platform device 2434 * probe - binds to the platform device
2435 */ 2435 */
2436static int __init pxa2xx_udc_probe(struct device *_dev) 2436static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2437{ 2437{
2438 struct pxa2xx_udc *dev = &memory; 2438 struct pxa2xx_udc *dev = &memory;
2439 int retval, out_dma = 1; 2439 int retval, out_dma = 1;
@@ -2496,19 +2496,19 @@ static int __init pxa2xx_udc_probe(struct device *_dev)
2496#endif 2496#endif
2497 2497
2498 /* other non-static parts of init */ 2498 /* other non-static parts of init */
2499 dev->dev = _dev; 2499 dev->dev = &pdev->dev;
2500 dev->mach = _dev->platform_data; 2500 dev->mach = pdev->dev.platform_data;
2501 2501
2502 init_timer(&dev->timer); 2502 init_timer(&dev->timer);
2503 dev->timer.function = udc_watchdog; 2503 dev->timer.function = udc_watchdog;
2504 dev->timer.data = (unsigned long) dev; 2504 dev->timer.data = (unsigned long) dev;
2505 2505
2506 device_initialize(&dev->gadget.dev); 2506 device_initialize(&dev->gadget.dev);
2507 dev->gadget.dev.parent = _dev; 2507 dev->gadget.dev.parent = &pdev->dev;
2508 dev->gadget.dev.dma_mask = _dev->dma_mask; 2508 dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
2509 2509
2510 the_controller = dev; 2510 the_controller = dev;
2511 dev_set_drvdata(_dev, dev); 2511 platform_set_drvdata(pdev, dev);
2512 2512
2513 udc_disable(dev); 2513 udc_disable(dev);
2514 udc_reinit(dev); 2514 udc_reinit(dev);
@@ -2560,14 +2560,14 @@ lubbock_fail0:
2560 return 0; 2560 return 0;
2561} 2561}
2562 2562
2563static void pxa2xx_udc_shutdown(struct device *_dev) 2563static void pxa2xx_udc_shutdown(struct platform_device *_dev)
2564{ 2564{
2565 pullup_off(); 2565 pullup_off();
2566} 2566}
2567 2567
2568static int __exit pxa2xx_udc_remove(struct device *_dev) 2568static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
2569{ 2569{
2570 struct pxa2xx_udc *dev = dev_get_drvdata(_dev); 2570 struct pxa2xx_udc *dev = platform_get_drvdata(pdev);
2571 2571
2572 udc_disable(dev); 2572 udc_disable(dev);
2573 remove_proc_files(); 2573 remove_proc_files();
@@ -2581,7 +2581,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
2581 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2581 free_irq(LUBBOCK_USB_DISC_IRQ, dev);
2582 free_irq(LUBBOCK_USB_IRQ, dev); 2582 free_irq(LUBBOCK_USB_IRQ, dev);
2583 } 2583 }
2584 dev_set_drvdata(_dev, NULL); 2584 platform_set_drvdata(pdev, NULL);
2585 the_controller = NULL; 2585 the_controller = NULL;
2586 return 0; 2586 return 0;
2587} 2587}
@@ -2602,9 +2602,9 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
2602 * VBUS IRQs should probably be ignored so that the PXA device just acts 2602 * VBUS IRQs should probably be ignored so that the PXA device just acts
2603 * "dead" to USB hosts until system resume. 2603 * "dead" to USB hosts until system resume.
2604 */ 2604 */
2605static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) 2605static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2606{ 2606{
2607 struct pxa2xx_udc *udc = dev_get_drvdata(dev); 2607 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2608 2608
2609 if (!udc->mach->udc_command) 2609 if (!udc->mach->udc_command)
2610 WARN("USB host won't detect disconnect!\n"); 2610 WARN("USB host won't detect disconnect!\n");
@@ -2613,9 +2613,9 @@ static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
2613 return 0; 2613 return 0;
2614} 2614}
2615 2615
2616static int pxa2xx_udc_resume(struct device *dev) 2616static int pxa2xx_udc_resume(struct platform_device *dev)
2617{ 2617{
2618 struct pxa2xx_udc *udc = dev_get_drvdata(dev); 2618 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2619 2619
2620 pullup(udc, 1); 2620 pullup(udc, 1);
2621 2621
@@ -2629,27 +2629,28 @@ static int pxa2xx_udc_resume(struct device *dev)
2629 2629
2630/*-------------------------------------------------------------------------*/ 2630/*-------------------------------------------------------------------------*/
2631 2631
2632static struct device_driver udc_driver = { 2632static struct platform_driver udc_driver = {
2633 .name = "pxa2xx-udc",
2634 .owner = THIS_MODULE,
2635 .bus = &platform_bus_type,
2636 .probe = pxa2xx_udc_probe, 2633 .probe = pxa2xx_udc_probe,
2637 .shutdown = pxa2xx_udc_shutdown, 2634 .shutdown = pxa2xx_udc_shutdown,
2638 .remove = __exit_p(pxa2xx_udc_remove), 2635 .remove = __exit_p(pxa2xx_udc_remove),
2639 .suspend = pxa2xx_udc_suspend, 2636 .suspend = pxa2xx_udc_suspend,
2640 .resume = pxa2xx_udc_resume, 2637 .resume = pxa2xx_udc_resume,
2638 .driver = {
2639 .owner = THIS_MODULE,
2640 .name = "pxa2xx-udc",
2641 },
2641}; 2642};
2642 2643
2643static int __init udc_init(void) 2644static int __init udc_init(void)
2644{ 2645{
2645 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); 2646 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
2646 return driver_register(&udc_driver); 2647 return platform_driver_register(&udc_driver);
2647} 2648}
2648module_init(udc_init); 2649module_init(udc_init);
2649 2650
2650static void __exit udc_exit(void) 2651static void __exit udc_exit(void)
2651{ 2652{
2652 driver_unregister(&udc_driver); 2653 platform_driver_unregister(&udc_driver);
2653} 2654}
2654module_exit(udc_exit); 2655module_exit(udc_exit);
2655 2656
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index f9c3f5b8dd1c..82f64986bc22 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1633,17 +1633,15 @@ static struct hc_driver isp116x_hc_driver = {
1633 1633
1634/*----------------------------------------------------------------*/ 1634/*----------------------------------------------------------------*/
1635 1635
1636static int __init_or_module isp116x_remove(struct device *dev) 1636static int __init_or_module isp116x_remove(struct platform_device *pdev)
1637{ 1637{
1638 struct usb_hcd *hcd = dev_get_drvdata(dev); 1638 struct usb_hcd *hcd = platform_get_drvdata(pdev);
1639 struct isp116x *isp116x; 1639 struct isp116x *isp116x;
1640 struct platform_device *pdev;
1641 struct resource *res; 1640 struct resource *res;
1642 1641
1643 if (!hcd) 1642 if (!hcd)
1644 return 0; 1643 return 0;
1645 isp116x = hcd_to_isp116x(hcd); 1644 isp116x = hcd_to_isp116x(hcd);
1646 pdev = container_of(dev, struct platform_device, dev);
1647 remove_debug_file(isp116x); 1645 remove_debug_file(isp116x);
1648 usb_remove_hcd(hcd); 1646 usb_remove_hcd(hcd);
1649 1647
@@ -1660,18 +1658,16 @@ static int __init_or_module isp116x_remove(struct device *dev)
1660 1658
1661#define resource_len(r) (((r)->end - (r)->start) + 1) 1659#define resource_len(r) (((r)->end - (r)->start) + 1)
1662 1660
1663static int __init isp116x_probe(struct device *dev) 1661static int __init isp116x_probe(struct platform_device *pdev)
1664{ 1662{
1665 struct usb_hcd *hcd; 1663 struct usb_hcd *hcd;
1666 struct isp116x *isp116x; 1664 struct isp116x *isp116x;
1667 struct platform_device *pdev;
1668 struct resource *addr, *data; 1665 struct resource *addr, *data;
1669 void __iomem *addr_reg; 1666 void __iomem *addr_reg;
1670 void __iomem *data_reg; 1667 void __iomem *data_reg;
1671 int irq; 1668 int irq;
1672 int ret = 0; 1669 int ret = 0;
1673 1670
1674 pdev = container_of(dev, struct platform_device, dev);
1675 if (pdev->num_resources < 3) { 1671 if (pdev->num_resources < 3) {
1676 ret = -ENODEV; 1672 ret = -ENODEV;
1677 goto err1; 1673 goto err1;
@@ -1685,7 +1681,7 @@ static int __init isp116x_probe(struct device *dev)
1685 goto err1; 1681 goto err1;
1686 } 1682 }
1687 1683
1688 if (dev->dma_mask) { 1684 if (pdev->dev.dma_mask) {
1689 DBG("DMA not supported\n"); 1685 DBG("DMA not supported\n");
1690 ret = -EINVAL; 1686 ret = -EINVAL;
1691 goto err1; 1687 goto err1;
@@ -1711,7 +1707,7 @@ static int __init isp116x_probe(struct device *dev)
1711 } 1707 }
1712 1708
1713 /* allocate and initialize hcd */ 1709 /* allocate and initialize hcd */
1714 hcd = usb_create_hcd(&isp116x_hc_driver, dev, dev->bus_id); 1710 hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id);
1715 if (!hcd) { 1711 if (!hcd) {
1716 ret = -ENOMEM; 1712 ret = -ENOMEM;
1717 goto err5; 1713 goto err5;
@@ -1723,7 +1719,7 @@ static int __init isp116x_probe(struct device *dev)
1723 isp116x->addr_reg = addr_reg; 1719 isp116x->addr_reg = addr_reg;
1724 spin_lock_init(&isp116x->lock); 1720 spin_lock_init(&isp116x->lock);
1725 INIT_LIST_HEAD(&isp116x->async); 1721 INIT_LIST_HEAD(&isp116x->async);
1726 isp116x->board = dev->platform_data; 1722 isp116x->board = pdev->dev.platform_data;
1727 1723
1728 if (!isp116x->board) { 1724 if (!isp116x->board) {
1729 ERR("Platform data structure not initialized\n"); 1725 ERR("Platform data structure not initialized\n");
@@ -1764,13 +1760,13 @@ static int __init isp116x_probe(struct device *dev)
1764/* 1760/*
1765 Suspend of platform device 1761 Suspend of platform device
1766*/ 1762*/
1767static int isp116x_suspend(struct device *dev, pm_message_t state) 1763static int isp116x_suspend(struct platform_device *dev, pm_message_t state)
1768{ 1764{
1769 int ret = 0; 1765 int ret = 0;
1770 1766
1771 VDBG("%s: state %x\n", __func__, state); 1767 VDBG("%s: state %x\n", __func__, state);
1772 1768
1773 dev->power.power_state = state; 1769 dev->dev.power.power_state = state;
1774 1770
1775 return ret; 1771 return ret;
1776} 1772}
@@ -1778,13 +1774,13 @@ static int isp116x_suspend(struct device *dev, pm_message_t state)
1778/* 1774/*
1779 Resume platform device 1775 Resume platform device
1780*/ 1776*/
1781static int isp116x_resume(struct device *dev) 1777static int isp116x_resume(struct platform_device *dev)
1782{ 1778{
1783 int ret = 0; 1779 int ret = 0;
1784 1780
1785 VDBG("%s: state %x\n", __func__, dev->power.power_state); 1781 VDBG("%s: state %x\n", __func__, dev->dev.power.power_state);
1786 1782
1787 dev->power.power_state = PMSG_ON; 1783 dev->dev.power.power_state = PMSG_ON;
1788 1784
1789 return ret; 1785 return ret;
1790} 1786}
@@ -1796,13 +1792,14 @@ static int isp116x_resume(struct device *dev)
1796 1792
1797#endif 1793#endif
1798 1794
1799static struct device_driver isp116x_driver = { 1795static struct platform_driver isp116x_driver = {
1800 .name = (char *)hcd_name,
1801 .bus = &platform_bus_type,
1802 .probe = isp116x_probe, 1796 .probe = isp116x_probe,
1803 .remove = isp116x_remove, 1797 .remove = isp116x_remove,
1804 .suspend = isp116x_suspend, 1798 .suspend = isp116x_suspend,
1805 .resume = isp116x_resume, 1799 .resume = isp116x_resume,
1800 .driver = {
1801 .name = (char *)hcd_name,
1802 },
1806}; 1803};
1807 1804
1808/*-----------------------------------------------------------------*/ 1805/*-----------------------------------------------------------------*/
@@ -1813,14 +1810,14 @@ static int __init isp116x_init(void)
1813 return -ENODEV; 1810 return -ENODEV;
1814 1811
1815 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); 1812 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
1816 return driver_register(&isp116x_driver); 1813 return platform_driver_register(&isp116x_driver);
1817} 1814}
1818 1815
1819module_init(isp116x_init); 1816module_init(isp116x_init);
1820 1817
1821static void __exit isp116x_cleanup(void) 1818static void __exit isp116x_cleanup(void)
1822{ 1819{
1823 driver_unregister(&isp116x_driver); 1820 platform_driver_unregister(&isp116x_driver);
1824} 1821}
1825 1822
1826module_exit(isp116x_cleanup); 1823module_exit(isp116x_cleanup);
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index f0c78cf14b6c..d9cf3b327d96 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -225,9 +225,8 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
225 225
226/*-------------------------------------------------------------------------*/ 226/*-------------------------------------------------------------------------*/
227 227
228static int ohci_hcd_au1xxx_drv_probe(struct device *dev) 228static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
229{ 229{
230 struct platform_device *pdev = to_platform_device(dev);
231 int ret; 230 int ret;
232 231
233 pr_debug ("In ohci_hcd_au1xxx_drv_probe"); 232 pr_debug ("In ohci_hcd_au1xxx_drv_probe");
@@ -239,39 +238,37 @@ static int ohci_hcd_au1xxx_drv_probe(struct device *dev)
239 return ret; 238 return ret;
240} 239}
241 240
242static int ohci_hcd_au1xxx_drv_remove(struct device *dev) 241static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
243{ 242{
244 struct platform_device *pdev = to_platform_device(dev); 243 struct usb_hcd *hcd = platform_get_drvdata(pdev);
245 struct usb_hcd *hcd = dev_get_drvdata(dev);
246 244
247 usb_hcd_au1xxx_remove(hcd, pdev); 245 usb_hcd_au1xxx_remove(hcd, pdev);
248 return 0; 246 return 0;
249} 247}
250 /*TBD*/ 248 /*TBD*/
251/*static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) 249/*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev)
252{ 250{
253 struct platform_device *pdev = to_platform_device(dev); 251 struct usb_hcd *hcd = platform_get_drvdata(dev);
254 struct usb_hcd *hcd = dev_get_drvdata(dev);
255 252
256 return 0; 253 return 0;
257} 254}
258static int ohci_hcd_au1xxx_drv_resume(struct device *dev) 255static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev)
259{ 256{
260 struct platform_device *pdev = to_platform_device(dev); 257 struct usb_hcd *hcd = platform_get_drvdata(dev);
261 struct usb_hcd *hcd = dev_get_drvdata(dev);
262 258
263 return 0; 259 return 0;
264} 260}
265*/ 261*/
266 262
267static struct device_driver ohci_hcd_au1xxx_driver = { 263static struct platform_driver ohci_hcd_au1xxx_driver = {
268 .name = "au1xxx-ohci",
269 .owner = THIS_MODULE,
270 .bus = &platform_bus_type,
271 .probe = ohci_hcd_au1xxx_drv_probe, 264 .probe = ohci_hcd_au1xxx_drv_probe,
272 .remove = ohci_hcd_au1xxx_drv_remove, 265 .remove = ohci_hcd_au1xxx_drv_remove,
273 /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ 266 /*.suspend = ohci_hcd_au1xxx_drv_suspend, */
274 /*.resume = ohci_hcd_au1xxx_drv_resume, */ 267 /*.resume = ohci_hcd_au1xxx_drv_resume, */
268 .driver = {
269 .name = "au1xxx-ohci",
270 .owner = THIS_MODULE,
271 },
275}; 272};
276 273
277static int __init ohci_hcd_au1xxx_init (void) 274static int __init ohci_hcd_au1xxx_init (void)
@@ -280,12 +277,12 @@ static int __init ohci_hcd_au1xxx_init (void)
280 pr_debug ("block sizes: ed %d td %d\n", 277 pr_debug ("block sizes: ed %d td %d\n",
281 sizeof (struct ed), sizeof (struct td)); 278 sizeof (struct ed), sizeof (struct td));
282 279
283 return driver_register(&ohci_hcd_au1xxx_driver); 280 return platform_driver_register(&ohci_hcd_au1xxx_driver);
284} 281}
285 282
286static void __exit ohci_hcd_au1xxx_cleanup (void) 283static void __exit ohci_hcd_au1xxx_cleanup (void)
287{ 284{
288 driver_unregister(&ohci_hcd_au1xxx_driver); 285 platform_driver_unregister(&ohci_hcd_au1xxx_driver);
289} 286}
290 287
291module_init (ohci_hcd_au1xxx_init); 288module_init (ohci_hcd_au1xxx_init);
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 336c766c6e29..081ec3f5cff4 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -204,9 +204,8 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
204 204
205/*-------------------------------------------------------------------------*/ 205/*-------------------------------------------------------------------------*/
206 206
207static int ohci_hcd_lh7a404_drv_probe(struct device *dev) 207static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev)
208{ 208{
209 struct platform_device *pdev = to_platform_device(dev);
210 int ret; 209 int ret;
211 210
212 pr_debug ("In ohci_hcd_lh7a404_drv_probe"); 211 pr_debug ("In ohci_hcd_lh7a404_drv_probe");
@@ -218,40 +217,38 @@ static int ohci_hcd_lh7a404_drv_probe(struct device *dev)
218 return ret; 217 return ret;
219} 218}
220 219
221static int ohci_hcd_lh7a404_drv_remove(struct device *dev) 220static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev)
222{ 221{
223 struct platform_device *pdev = to_platform_device(dev); 222 struct usb_hcd *hcd = platform_get_drvdata(dev);
224 struct usb_hcd *hcd = dev_get_drvdata(dev);
225 223
226 usb_hcd_lh7a404_remove(hcd, pdev); 224 usb_hcd_lh7a404_remove(hcd, pdev);
227 return 0; 225 return 0;
228} 226}
229 /*TBD*/ 227 /*TBD*/
230/*static int ohci_hcd_lh7a404_drv_suspend(struct device *dev) 228/*static int ohci_hcd_lh7a404_drv_suspend(struct platform_device *dev)
231{ 229{
232 struct platform_device *pdev = to_platform_device(dev); 230 struct usb_hcd *hcd = platform_get_drvdata(dev);
233 struct usb_hcd *hcd = dev_get_drvdata(dev);
234 231
235 return 0; 232 return 0;
236} 233}
237static int ohci_hcd_lh7a404_drv_resume(struct device *dev) 234static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev)
238{ 235{
239 struct platform_device *pdev = to_platform_device(dev); 236 struct usb_hcd *hcd = platform_get_drvdata(dev);
240 struct usb_hcd *hcd = dev_get_drvdata(dev);
241 237
242 238
243 return 0; 239 return 0;
244} 240}
245*/ 241*/
246 242
247static struct device_driver ohci_hcd_lh7a404_driver = { 243static struct platform_driver ohci_hcd_lh7a404_driver = {
248 .name = "lh7a404-ohci",
249 .owner = THIS_MODULE,
250 .bus = &platform_bus_type,
251 .probe = ohci_hcd_lh7a404_drv_probe, 244 .probe = ohci_hcd_lh7a404_drv_probe,
252 .remove = ohci_hcd_lh7a404_drv_remove, 245 .remove = ohci_hcd_lh7a404_drv_remove,
253 /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ 246 /*.suspend = ohci_hcd_lh7a404_drv_suspend, */
254 /*.resume = ohci_hcd_lh7a404_drv_resume, */ 247 /*.resume = ohci_hcd_lh7a404_drv_resume, */
248 .driver = {
249 .name = "lh7a404-ohci",
250 .owner = THIS_MODULE,
251 },
255}; 252};
256 253
257static int __init ohci_hcd_lh7a404_init (void) 254static int __init ohci_hcd_lh7a404_init (void)
@@ -260,12 +257,12 @@ static int __init ohci_hcd_lh7a404_init (void)
260 pr_debug ("block sizes: ed %d td %d\n", 257 pr_debug ("block sizes: ed %d td %d\n",
261 sizeof (struct ed), sizeof (struct td)); 258 sizeof (struct ed), sizeof (struct td));
262 259
263 return driver_register(&ohci_hcd_lh7a404_driver); 260 return platform_driver_register(&ohci_hcd_lh7a404_driver);
264} 261}
265 262
266static void __exit ohci_hcd_lh7a404_cleanup (void) 263static void __exit ohci_hcd_lh7a404_cleanup (void)
267{ 264{
268 driver_unregister(&ohci_hcd_lh7a404_driver); 265 platform_driver_unregister(&ohci_hcd_lh7a404_driver);
269} 266}
270 267
271module_init (ohci_hcd_lh7a404_init); 268module_init (ohci_hcd_lh7a404_init);
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index e46cc540cf4d..c9e29d808711 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -433,24 +433,22 @@ static const struct hc_driver ohci_omap_hc_driver = {
433 433
434/*-------------------------------------------------------------------------*/ 434/*-------------------------------------------------------------------------*/
435 435
436static int ohci_hcd_omap_drv_probe(struct device *dev) 436static int ohci_hcd_omap_drv_probe(struct platform_device *dev)
437{ 437{
438 return usb_hcd_omap_probe(&ohci_omap_hc_driver, 438 return usb_hcd_omap_probe(&ohci_omap_hc_driver, dev);
439 to_platform_device(dev));
440} 439}
441 440
442static int ohci_hcd_omap_drv_remove(struct device *dev) 441static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
443{ 442{
444 struct platform_device *pdev = to_platform_device(dev); 443 struct usb_hcd *hcd = platform_get_drvdata(dev);
445 struct usb_hcd *hcd = dev_get_drvdata(dev);
446 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 444 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
447 445
448 usb_hcd_omap_remove(hcd, pdev); 446 usb_hcd_omap_remove(hcd, dev);
449 if (ohci->transceiver) { 447 if (ohci->transceiver) {
450 (void) otg_set_host(ohci->transceiver, 0); 448 (void) otg_set_host(ohci->transceiver, 0);
451 put_device(ohci->transceiver->dev); 449 put_device(ohci->transceiver->dev);
452 } 450 }
453 dev_set_drvdata(dev, NULL); 451 platform_set_drvdata(dev, NULL);
454 452
455 return 0; 453 return 0;
456} 454}
@@ -459,9 +457,9 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
459 457
460#ifdef CONFIG_PM 458#ifdef CONFIG_PM
461 459
462static int ohci_omap_suspend(struct device *dev, pm_message_t message) 460static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
463{ 461{
464 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 462 struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
465 463
466 if (time_before(jiffies, ohci->next_statechange)) 464 if (time_before(jiffies, ohci->next_statechange))
467 msleep(5); 465 msleep(5);
@@ -473,9 +471,9 @@ static int ohci_omap_suspend(struct device *dev, pm_message_t message)
473 return 0; 471 return 0;
474} 472}
475 473
476static int ohci_omap_resume(struct device *dev) 474static int ohci_omap_resume(struct platform_device *dev)
477{ 475{
478 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 476 struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
479 477
480 if (time_before(jiffies, ohci->next_statechange)) 478 if (time_before(jiffies, ohci->next_statechange))
481 msleep(5); 479 msleep(5);
@@ -494,16 +492,17 @@ static int ohci_omap_resume(struct device *dev)
494/* 492/*
495 * Driver definition to register with the OMAP bus 493 * Driver definition to register with the OMAP bus
496 */ 494 */
497static struct device_driver ohci_hcd_omap_driver = { 495static struct platform_driver ohci_hcd_omap_driver = {
498 .name = "ohci",
499 .owner = THIS_MODULE,
500 .bus = &platform_bus_type,
501 .probe = ohci_hcd_omap_drv_probe, 496 .probe = ohci_hcd_omap_drv_probe,
502 .remove = ohci_hcd_omap_drv_remove, 497 .remove = ohci_hcd_omap_drv_remove,
503#ifdef CONFIG_PM 498#ifdef CONFIG_PM
504 .suspend = ohci_omap_suspend, 499 .suspend = ohci_omap_suspend,
505 .resume = ohci_omap_resume, 500 .resume = ohci_omap_resume,
506#endif 501#endif
502 .driver = {
503 .owner = THIS_MODULE,
504 .name = "ohci",
505 },
507}; 506};
508 507
509static int __init ohci_hcd_omap_init (void) 508static int __init ohci_hcd_omap_init (void)
@@ -515,12 +514,12 @@ static int __init ohci_hcd_omap_init (void)
515 pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name, 514 pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
516 sizeof (struct ed), sizeof (struct td)); 515 sizeof (struct ed), sizeof (struct td));
517 516
518 return driver_register(&ohci_hcd_omap_driver); 517 return platform_driver_register(&ohci_hcd_omap_driver);
519} 518}
520 519
521static void __exit ohci_hcd_omap_cleanup (void) 520static void __exit ohci_hcd_omap_cleanup (void)
522{ 521{
523 driver_unregister(&ohci_hcd_omap_driver); 522 platform_driver_unregister(&ohci_hcd_omap_driver);
524} 523}
525 524
526module_init (ohci_hcd_omap_init); 525module_init (ohci_hcd_omap_init);
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 92cf6f4a1374..18755766e406 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -172,9 +172,8 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
172 .start_port_reset = ohci_start_port_reset, 172 .start_port_reset = ohci_start_port_reset,
173}; 173};
174 174
175static int ohci_hcd_ppc_soc_drv_probe(struct device *dev) 175static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev)
176{ 176{
177 struct platform_device *pdev = to_platform_device(dev);
178 int ret; 177 int ret;
179 178
180 if (usb_disabled()) 179 if (usb_disabled())
@@ -184,25 +183,25 @@ static int ohci_hcd_ppc_soc_drv_probe(struct device *dev)
184 return ret; 183 return ret;
185} 184}
186 185
187static int ohci_hcd_ppc_soc_drv_remove(struct device *dev) 186static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev)
188{ 187{
189 struct platform_device *pdev = to_platform_device(dev); 188 struct usb_hcd *hcd = platform_get_drvdata(dev);
190 struct usb_hcd *hcd = dev_get_drvdata(dev);
191 189
192 usb_hcd_ppc_soc_remove(hcd, pdev); 190 usb_hcd_ppc_soc_remove(hcd, pdev);
193 return 0; 191 return 0;
194} 192}
195 193
196static struct device_driver ohci_hcd_ppc_soc_driver = { 194static struct platform_driver ohci_hcd_ppc_soc_driver = {
197 .name = "ppc-soc-ohci",
198 .owner = THIS_MODULE,
199 .bus = &platform_bus_type,
200 .probe = ohci_hcd_ppc_soc_drv_probe, 195 .probe = ohci_hcd_ppc_soc_drv_probe,
201 .remove = ohci_hcd_ppc_soc_drv_remove, 196 .remove = ohci_hcd_ppc_soc_drv_remove,
202#ifdef CONFIG_PM 197#ifdef CONFIG_PM
203 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ 198 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/
204 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ 199 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/
205#endif 200#endif
201 .driver = {
202 .name = "ppc-soc-ohci",
203 .owner = THIS_MODULE,
204 },
206}; 205};
207 206
208static int __init ohci_hcd_ppc_soc_init(void) 207static int __init ohci_hcd_ppc_soc_init(void)
@@ -211,12 +210,12 @@ static int __init ohci_hcd_ppc_soc_init(void)
211 pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed), 210 pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
212 sizeof(struct td)); 211 sizeof(struct td));
213 212
214 return driver_register(&ohci_hcd_ppc_soc_driver); 213 return platform_driver_register(&ohci_hcd_ppc_soc_driver);
215} 214}
216 215
217static void __exit ohci_hcd_ppc_soc_cleanup(void) 216static void __exit ohci_hcd_ppc_soc_cleanup(void)
218{ 217{
219 driver_unregister(&ohci_hcd_ppc_soc_driver); 218 platform_driver_unregister(&ohci_hcd_ppc_soc_driver);
220} 219}
221 220
222module_init(ohci_hcd_ppc_soc_init); 221module_init(ohci_hcd_ppc_soc_init);
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 59e20568e8f9..9d65ec307990 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -290,9 +290,8 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
290 290
291/*-------------------------------------------------------------------------*/ 291/*-------------------------------------------------------------------------*/
292 292
293static int ohci_hcd_pxa27x_drv_probe(struct device *dev) 293static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev)
294{ 294{
295 struct platform_device *pdev = to_platform_device(dev);
296 int ret; 295 int ret;
297 296
298 pr_debug ("In ohci_hcd_pxa27x_drv_probe"); 297 pr_debug ("In ohci_hcd_pxa27x_drv_probe");
@@ -304,41 +303,39 @@ static int ohci_hcd_pxa27x_drv_probe(struct device *dev)
304 return ret; 303 return ret;
305} 304}
306 305
307static int ohci_hcd_pxa27x_drv_remove(struct device *dev) 306static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
308{ 307{
309 struct platform_device *pdev = to_platform_device(dev); 308 struct usb_hcd *hcd = platform_get_drvdata(pdev);
310 struct usb_hcd *hcd = dev_get_drvdata(dev);
311 309
312 usb_hcd_pxa27x_remove(hcd, pdev); 310 usb_hcd_pxa27x_remove(hcd, pdev);
313 return 0; 311 return 0;
314} 312}
315 313
316static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state) 314static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state)
317{ 315{
318// struct platform_device *pdev = to_platform_device(dev); 316// struct usb_hcd *hcd = platform_get_drvdata(dev);
319// struct usb_hcd *hcd = dev_get_drvdata(dev);
320 printk("%s: not implemented yet\n", __FUNCTION__); 317 printk("%s: not implemented yet\n", __FUNCTION__);
321 318
322 return 0; 319 return 0;
323} 320}
324 321
325static int ohci_hcd_pxa27x_drv_resume(struct device *dev) 322static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev)
326{ 323{
327// struct platform_device *pdev = to_platform_device(dev); 324// struct usb_hcd *hcd = platform_get_drvdata(dev);
328// struct usb_hcd *hcd = dev_get_drvdata(dev);
329 printk("%s: not implemented yet\n", __FUNCTION__); 325 printk("%s: not implemented yet\n", __FUNCTION__);
330 326
331 return 0; 327 return 0;
332} 328}
333 329
334 330
335static struct device_driver ohci_hcd_pxa27x_driver = { 331static struct platform_driver ohci_hcd_pxa27x_driver = {
336 .name = "pxa27x-ohci",
337 .bus = &platform_bus_type,
338 .probe = ohci_hcd_pxa27x_drv_probe, 332 .probe = ohci_hcd_pxa27x_drv_probe,
339 .remove = ohci_hcd_pxa27x_drv_remove, 333 .remove = ohci_hcd_pxa27x_drv_remove,
340 .suspend = ohci_hcd_pxa27x_drv_suspend, 334 .suspend = ohci_hcd_pxa27x_drv_suspend,
341 .resume = ohci_hcd_pxa27x_drv_resume, 335 .resume = ohci_hcd_pxa27x_drv_resume,
336 .driver = {
337 .name = "pxa27x-ohci",
338 },
342}; 339};
343 340
344static int __init ohci_hcd_pxa27x_init (void) 341static int __init ohci_hcd_pxa27x_init (void)
@@ -347,12 +344,12 @@ static int __init ohci_hcd_pxa27x_init (void)
347 pr_debug ("block sizes: ed %d td %d\n", 344 pr_debug ("block sizes: ed %d td %d\n",
348 sizeof (struct ed), sizeof (struct td)); 345 sizeof (struct ed), sizeof (struct td));
349 346
350 return driver_register(&ohci_hcd_pxa27x_driver); 347 return platform_driver_register(&ohci_hcd_pxa27x_driver);
351} 348}
352 349
353static void __exit ohci_hcd_pxa27x_cleanup (void) 350static void __exit ohci_hcd_pxa27x_cleanup (void)
354{ 351{
355 driver_unregister(&ohci_hcd_pxa27x_driver); 352 platform_driver_unregister(&ohci_hcd_pxa27x_driver);
356} 353}
357 354
358module_init (ohci_hcd_pxa27x_init); 355module_init (ohci_hcd_pxa27x_init);
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index ee1fc605b402..35cc9402adc0 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -459,39 +459,38 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
459 459
460/* device driver */ 460/* device driver */
461 461
462static int ohci_hcd_s3c2410_drv_probe(struct device *dev) 462static int ohci_hcd_s3c2410_drv_probe(struct platform_device *pdev)
463{ 463{
464 struct platform_device *pdev = to_platform_device(dev);
465 return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); 464 return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev);
466} 465}
467 466
468static int ohci_hcd_s3c2410_drv_remove(struct device *dev) 467static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
469{ 468{
470 struct platform_device *pdev = to_platform_device(dev); 469 struct usb_hcd *hcd = platform_get_drvdata(pdev);
471 struct usb_hcd *hcd = dev_get_drvdata(dev);
472 470
473 usb_hcd_s3c2410_remove(hcd, pdev); 471 usb_hcd_s3c2410_remove(hcd, pdev);
474 return 0; 472 return 0;
475} 473}
476 474
477static struct device_driver ohci_hcd_s3c2410_driver = { 475static struct platform_driver ohci_hcd_s3c2410_driver = {
478 .name = "s3c2410-ohci",
479 .owner = THIS_MODULE,
480 .bus = &platform_bus_type,
481 .probe = ohci_hcd_s3c2410_drv_probe, 476 .probe = ohci_hcd_s3c2410_drv_probe,
482 .remove = ohci_hcd_s3c2410_drv_remove, 477 .remove = ohci_hcd_s3c2410_drv_remove,
483 /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ 478 /*.suspend = ohci_hcd_s3c2410_drv_suspend, */
484 /*.resume = ohci_hcd_s3c2410_drv_resume, */ 479 /*.resume = ohci_hcd_s3c2410_drv_resume, */
480 .driver = {
481 .owner = THIS_MODULE,
482 .name = "s3c2410-ohci",
483 },
485}; 484};
486 485
487static int __init ohci_hcd_s3c2410_init (void) 486static int __init ohci_hcd_s3c2410_init (void)
488{ 487{
489 return driver_register(&ohci_hcd_s3c2410_driver); 488 return platform_driver_register(&ohci_hcd_s3c2410_driver);
490} 489}
491 490
492static void __exit ohci_hcd_s3c2410_cleanup (void) 491static void __exit ohci_hcd_s3c2410_cleanup (void)
493{ 492{
494 driver_unregister(&ohci_hcd_s3c2410_driver); 493 platform_driver_unregister(&ohci_hcd_s3c2410_driver);
495} 494}
496 495
497module_init (ohci_hcd_s3c2410_init); 496module_init (ohci_hcd_s3c2410_init);
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 5607c0ae6835..a7722a6a5a5b 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1631,24 +1631,21 @@ static struct hc_driver sl811h_hc_driver = {
1631/*-------------------------------------------------------------------------*/ 1631/*-------------------------------------------------------------------------*/
1632 1632
1633static int __devexit 1633static int __devexit
1634sl811h_remove(struct device *dev) 1634sl811h_remove(struct platform_device *dev)
1635{ 1635{
1636 struct usb_hcd *hcd = dev_get_drvdata(dev); 1636 struct usb_hcd *hcd = platform_get_drvdata(dev);
1637 struct sl811 *sl811 = hcd_to_sl811(hcd); 1637 struct sl811 *sl811 = hcd_to_sl811(hcd);
1638 struct platform_device *pdev;
1639 struct resource *res; 1638 struct resource *res;
1640 1639
1641 pdev = container_of(dev, struct platform_device, dev);
1642
1643 remove_debug_file(sl811); 1640 remove_debug_file(sl811);
1644 usb_remove_hcd(hcd); 1641 usb_remove_hcd(hcd);
1645 1642
1646 /* some platforms may use IORESOURCE_IO */ 1643 /* some platforms may use IORESOURCE_IO */
1647 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1644 res = platform_get_resource(dev, IORESOURCE_MEM, 1);
1648 if (res) 1645 if (res)
1649 iounmap(sl811->data_reg); 1646 iounmap(sl811->data_reg);
1650 1647
1651 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1648 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
1652 if (res) 1649 if (res)
1653 iounmap(sl811->addr_reg); 1650 iounmap(sl811->addr_reg);
1654 1651
@@ -1657,11 +1654,10 @@ sl811h_remove(struct device *dev)
1657} 1654}
1658 1655
1659static int __devinit 1656static int __devinit
1660sl811h_probe(struct device *dev) 1657sl811h_probe(struct platform_device *dev)
1661{ 1658{
1662 struct usb_hcd *hcd; 1659 struct usb_hcd *hcd;
1663 struct sl811 *sl811; 1660 struct sl811 *sl811;
1664 struct platform_device *pdev;
1665 struct resource *addr, *data; 1661 struct resource *addr, *data;
1666 int irq; 1662 int irq;
1667 void __iomem *addr_reg; 1663 void __iomem *addr_reg;
@@ -1674,24 +1670,23 @@ sl811h_probe(struct device *dev)
1674 * specific platform_data. we don't probe for IRQs, and do only 1670 * specific platform_data. we don't probe for IRQs, and do only
1675 * minimal sanity checking. 1671 * minimal sanity checking.
1676 */ 1672 */
1677 pdev = container_of(dev, struct platform_device, dev); 1673 irq = platform_get_irq(dev, 0);
1678 irq = platform_get_irq(pdev, 0); 1674 if (dev->num_resources < 3 || irq < 0)
1679 if (pdev->num_resources < 3 || irq < 0)
1680 return -ENODEV; 1675 return -ENODEV;
1681 1676
1682 /* refuse to confuse usbcore */ 1677 /* refuse to confuse usbcore */
1683 if (dev->dma_mask) { 1678 if (dev->dev.dma_mask) {
1684 DBG("no we won't dma\n"); 1679 DBG("no we won't dma\n");
1685 return -EINVAL; 1680 return -EINVAL;
1686 } 1681 }
1687 1682
1688 /* the chip may be wired for either kind of addressing */ 1683 /* the chip may be wired for either kind of addressing */
1689 addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1684 addr = platform_get_resource(dev, IORESOURCE_MEM, 0);
1690 data = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1685 data = platform_get_resource(dev, IORESOURCE_MEM, 1);
1691 retval = -EBUSY; 1686 retval = -EBUSY;
1692 if (!addr || !data) { 1687 if (!addr || !data) {
1693 addr = platform_get_resource(pdev, IORESOURCE_IO, 0); 1688 addr = platform_get_resource(dev, IORESOURCE_IO, 0);
1694 data = platform_get_resource(pdev, IORESOURCE_IO, 1); 1689 data = platform_get_resource(dev, IORESOURCE_IO, 1);
1695 if (!addr || !data) 1690 if (!addr || !data)
1696 return -ENODEV; 1691 return -ENODEV;
1697 ioaddr = 1; 1692 ioaddr = 1;
@@ -1713,7 +1708,7 @@ sl811h_probe(struct device *dev)
1713 } 1708 }
1714 1709
1715 /* allocate and initialize hcd */ 1710 /* allocate and initialize hcd */
1716 hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id); 1711 hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id);
1717 if (!hcd) { 1712 if (!hcd) {
1718 retval = -ENOMEM; 1713 retval = -ENOMEM;
1719 goto err5; 1714 goto err5;
@@ -1723,7 +1718,7 @@ sl811h_probe(struct device *dev)
1723 1718
1724 spin_lock_init(&sl811->lock); 1719 spin_lock_init(&sl811->lock);
1725 INIT_LIST_HEAD(&sl811->async); 1720 INIT_LIST_HEAD(&sl811->async);
1726 sl811->board = dev->platform_data; 1721 sl811->board = dev->dev.platform_data;
1727 init_timer(&sl811->timer); 1722 init_timer(&sl811->timer);
1728 sl811->timer.function = sl811h_timer; 1723 sl811->timer.function = sl811h_timer;
1729 sl811->timer.data = (unsigned long) sl811; 1724 sl811->timer.data = (unsigned long) sl811;
@@ -1785,9 +1780,9 @@ sl811h_probe(struct device *dev)
1785 */ 1780 */
1786 1781
1787static int 1782static int
1788sl811h_suspend(struct device *dev, pm_message_t state) 1783sl811h_suspend(struct platform_device *dev, pm_message_t state)
1789{ 1784{
1790 struct usb_hcd *hcd = dev_get_drvdata(dev); 1785 struct usb_hcd *hcd = platform_get_drvdata(dev);
1791 struct sl811 *sl811 = hcd_to_sl811(hcd); 1786 struct sl811 *sl811 = hcd_to_sl811(hcd);
1792 int retval = 0; 1787 int retval = 0;
1793 1788
@@ -1796,27 +1791,27 @@ sl811h_suspend(struct device *dev, pm_message_t state)
1796 else if (state.event == PM_EVENT_SUSPEND) 1791 else if (state.event == PM_EVENT_SUSPEND)
1797 port_power(sl811, 0); 1792 port_power(sl811, 0);
1798 if (retval == 0) 1793 if (retval == 0)
1799 dev->power.power_state = state; 1794 dev->dev.power.power_state = state;
1800 return retval; 1795 return retval;
1801} 1796}
1802 1797
1803static int 1798static int
1804sl811h_resume(struct device *dev) 1799sl811h_resume(struct platform_device *dev)
1805{ 1800{
1806 struct usb_hcd *hcd = dev_get_drvdata(dev); 1801 struct usb_hcd *hcd = platform_get_drvdata(dev);
1807 struct sl811 *sl811 = hcd_to_sl811(hcd); 1802 struct sl811 *sl811 = hcd_to_sl811(hcd);
1808 1803
1809 /* with no "check to see if VBUS is still powered" board hook, 1804 /* with no "check to see if VBUS is still powered" board hook,
1810 * let's assume it'd only be powered to enable remote wakeup. 1805 * let's assume it'd only be powered to enable remote wakeup.
1811 */ 1806 */
1812 if (dev->power.power_state.event == PM_EVENT_SUSPEND 1807 if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND
1813 || !hcd->can_wakeup) { 1808 || !hcd->can_wakeup) {
1814 sl811->port1 = 0; 1809 sl811->port1 = 0;
1815 port_power(sl811, 1); 1810 port_power(sl811, 1);
1816 return 0; 1811 return 0;
1817 } 1812 }
1818 1813
1819 dev->power.power_state = PMSG_ON; 1814 dev->dev.power.power_state = PMSG_ON;
1820 return sl811h_bus_resume(hcd); 1815 return sl811h_bus_resume(hcd);
1821} 1816}
1822 1817
@@ -1829,16 +1824,16 @@ sl811h_resume(struct device *dev)
1829 1824
1830 1825
1831/* this driver is exported so sl811_cs can depend on it */ 1826/* this driver is exported so sl811_cs can depend on it */
1832struct device_driver sl811h_driver = { 1827struct platform_driver sl811h_driver = {
1833 .name = (char *) hcd_name,
1834 .bus = &platform_bus_type,
1835 .owner = THIS_MODULE,
1836
1837 .probe = sl811h_probe, 1828 .probe = sl811h_probe,
1838 .remove = __devexit_p(sl811h_remove), 1829 .remove = __devexit_p(sl811h_remove),
1839 1830
1840 .suspend = sl811h_suspend, 1831 .suspend = sl811h_suspend,
1841 .resume = sl811h_resume, 1832 .resume = sl811h_resume,
1833 .driver = {
1834 .name = (char *) hcd_name,
1835 .owner = THIS_MODULE,
1836 },
1842}; 1837};
1843EXPORT_SYMBOL(sl811h_driver); 1838EXPORT_SYMBOL(sl811h_driver);
1844 1839
@@ -1850,12 +1845,12 @@ static int __init sl811h_init(void)
1850 return -ENODEV; 1845 return -ENODEV;
1851 1846
1852 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); 1847 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
1853 return driver_register(&sl811h_driver); 1848 return platform_driver_register(&sl811h_driver);
1854} 1849}
1855module_init(sl811h_init); 1850module_init(sl811h_init);
1856 1851
1857static void __exit sl811h_cleanup(void) 1852static void __exit sl811h_cleanup(void)
1858{ 1853{
1859 driver_unregister(&sl811h_driver); 1854 platform_driver_unregister(&sl811h_driver);
1860} 1855}
1861module_exit(sl811h_cleanup); 1856module_exit(sl811h_cleanup);
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c
index 193b482570c7..750cebb18306 100644
--- a/drivers/video/acornfb.c
+++ b/drivers/video/acornfb.c
@@ -1279,7 +1279,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
1279 printk("acornfb: freed %dK memory\n", mb_freed); 1279 printk("acornfb: freed %dK memory\n", mb_freed);
1280} 1280}
1281 1281
1282static int __init acornfb_probe(struct device *dev) 1282static int __init acornfb_probe(struct platform_device *dev)
1283{ 1283{
1284 unsigned long size; 1284 unsigned long size;
1285 u_int h_sync, v_sync; 1285 u_int h_sync, v_sync;
@@ -1292,7 +1292,7 @@ static int __init acornfb_probe(struct device *dev)
1292 1292
1293 acornfb_init_fbinfo(); 1293 acornfb_init_fbinfo();
1294 1294
1295 current_par.dev = dev; 1295 current_par.dev = &dev->dev;
1296 1296
1297 if (current_par.montype == -1) 1297 if (current_par.montype == -1)
1298 current_par.montype = acornfb_detect_monitortype(); 1298 current_par.montype = acornfb_detect_monitortype();
@@ -1453,15 +1453,16 @@ static int __init acornfb_probe(struct device *dev)
1453 return 0; 1453 return 0;
1454} 1454}
1455 1455
1456static struct device_driver acornfb_driver = { 1456static struct platform_driver acornfb_driver = {
1457 .name = "acornfb",
1458 .bus = &platform_bus_type,
1459 .probe = acornfb_probe, 1457 .probe = acornfb_probe,
1458 .driver = {
1459 .name = "acornfb",
1460 },
1460}; 1461};
1461 1462
1462static int __init acornfb_init(void) 1463static int __init acornfb_init(void)
1463{ 1464{
1464 return driver_register(&acornfb_driver); 1465 return platform_driver_register(&acornfb_driver);
1465} 1466}
1466 1467
1467module_init(acornfb_init); 1468module_init(acornfb_init);
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index a1fc8bbb1090..080db812ca48 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -514,9 +514,8 @@ static struct fb_ops arcfb_ops = {
514 .fb_ioctl = arcfb_ioctl, 514 .fb_ioctl = arcfb_ioctl,
515}; 515};
516 516
517static int __init arcfb_probe(struct device *device) 517static int __init arcfb_probe(struct platform_device *dev)
518{ 518{
519 struct platform_device *dev = to_platform_device(device);
520 struct fb_info *info; 519 struct fb_info *info;
521 int retval = -ENOMEM; 520 int retval = -ENOMEM;
522 int videomemorysize; 521 int videomemorysize;
@@ -559,7 +558,7 @@ static int __init arcfb_probe(struct device *device)
559 retval = register_framebuffer(info); 558 retval = register_framebuffer(info);
560 if (retval < 0) 559 if (retval < 0)
561 goto err1; 560 goto err1;
562 dev_set_drvdata(&dev->dev, info); 561 platform_set_drvdata(dev, info);
563 if (irq) { 562 if (irq) {
564 par->irq = irq; 563 par->irq = irq;
565 if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, 564 if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ,
@@ -600,9 +599,9 @@ err:
600 return retval; 599 return retval;
601} 600}
602 601
603static int arcfb_remove(struct device *device) 602static int arcfb_remove(struct platform_device *dev)
604{ 603{
605 struct fb_info *info = dev_get_drvdata(device); 604 struct fb_info *info = platform_get_drvdata(dev);
606 605
607 if (info) { 606 if (info) {
608 unregister_framebuffer(info); 607 unregister_framebuffer(info);
@@ -612,11 +611,12 @@ static int arcfb_remove(struct device *device)
612 return 0; 611 return 0;
613} 612}
614 613
615static struct device_driver arcfb_driver = { 614static struct platform_driver arcfb_driver = {
616 .name = "arcfb",
617 .bus = &platform_bus_type,
618 .probe = arcfb_probe, 615 .probe = arcfb_probe,
619 .remove = arcfb_remove, 616 .remove = arcfb_remove,
617 .driver = {
618 .name = "arcfb",
619 },
620}; 620};
621 621
622static struct platform_device *arcfb_device; 622static struct platform_device *arcfb_device;
@@ -628,7 +628,7 @@ static int __init arcfb_init(void)
628 if (!arcfb_enable) 628 if (!arcfb_enable)
629 return -ENXIO; 629 return -ENXIO;
630 630
631 ret = driver_register(&arcfb_driver); 631 ret = platform_driver_register(&arcfb_driver);
632 if (!ret) { 632 if (!ret) {
633 arcfb_device = platform_device_alloc("arcfb", 0); 633 arcfb_device = platform_device_alloc("arcfb", 0);
634 if (arcfb_device) { 634 if (arcfb_device) {
@@ -638,7 +638,7 @@ static int __init arcfb_init(void)
638 } 638 }
639 if (ret) { 639 if (ret) {
640 platform_device_put(arcfb_device); 640 platform_device_put(arcfb_device);
641 driver_unregister(&arcfb_driver); 641 platform_driver_unregister(&arcfb_driver);
642 } 642 }
643 } 643 }
644 return ret; 644 return ret;
@@ -648,7 +648,7 @@ static int __init arcfb_init(void)
648static void __exit arcfb_exit(void) 648static void __exit arcfb_exit(void)
649{ 649{
650 platform_device_unregister(arcfb_device); 650 platform_device_unregister(arcfb_device);
651 driver_unregister(&arcfb_driver); 651 platform_driver_unregister(&arcfb_driver);
652} 652}
653 653
654module_param(num_cols, ulong, 0); 654module_param(num_cols, ulong, 0);
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 4867498f68e8..bc492f26c5a9 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -73,13 +73,13 @@ static void corgibl_blank(int blank)
73} 73}
74 74
75#ifdef CONFIG_PM 75#ifdef CONFIG_PM
76static int corgibl_suspend(struct device *dev, pm_message_t state) 76static int corgibl_suspend(struct platform_device *dev, pm_message_t state)
77{ 77{
78 corgibl_blank(FB_BLANK_POWERDOWN); 78 corgibl_blank(FB_BLANK_POWERDOWN);
79 return 0; 79 return 0;
80} 80}
81 81
82static int corgibl_resume(struct device *dev) 82static int corgibl_resume(struct platform_device *dev)
83{ 83{
84 corgibl_blank(FB_BLANK_UNBLANK); 84 corgibl_blank(FB_BLANK_UNBLANK);
85 return 0; 85 return 0;
@@ -137,9 +137,9 @@ static struct backlight_properties corgibl_data = {
137 137
138static struct backlight_device *corgi_backlight_device; 138static struct backlight_device *corgi_backlight_device;
139 139
140static int __init corgibl_probe(struct device *dev) 140static int __init corgibl_probe(struct platform_device *pdev)
141{ 141{
142 struct corgibl_machinfo *machinfo = dev->platform_data; 142 struct corgibl_machinfo *machinfo = pdev->dev.platform_data;
143 143
144 corgibl_data.max_brightness = machinfo->max_intensity; 144 corgibl_data.max_brightness = machinfo->max_intensity;
145 corgibl_mach_set_intensity = machinfo->set_bl_intensity; 145 corgibl_mach_set_intensity = machinfo->set_bl_intensity;
@@ -156,7 +156,7 @@ static int __init corgibl_probe(struct device *dev)
156 return 0; 156 return 0;
157} 157}
158 158
159static int corgibl_remove(struct device *dev) 159static int corgibl_remove(struct platform_device *dev)
160{ 160{
161 backlight_device_unregister(corgi_backlight_device); 161 backlight_device_unregister(corgi_backlight_device);
162 162
@@ -166,23 +166,24 @@ static int corgibl_remove(struct device *dev)
166 return 0; 166 return 0;
167} 167}
168 168
169static struct device_driver corgibl_driver = { 169static struct platform_driver corgibl_driver = {
170 .name = "corgi-bl",
171 .bus = &platform_bus_type,
172 .probe = corgibl_probe, 170 .probe = corgibl_probe,
173 .remove = corgibl_remove, 171 .remove = corgibl_remove,
174 .suspend = corgibl_suspend, 172 .suspend = corgibl_suspend,
175 .resume = corgibl_resume, 173 .resume = corgibl_resume,
174 .driver = {
175 .name = "corgi-bl",
176 },
176}; 177};
177 178
178static int __init corgibl_init(void) 179static int __init corgibl_init(void)
179{ 180{
180 return driver_register(&corgibl_driver); 181 return platform_driver_register(&corgibl_driver);
181} 182}
182 183
183static void __exit corgibl_exit(void) 184static void __exit corgibl_exit(void)
184{ 185{
185 driver_unregister(&corgibl_driver); 186 platform_driver_unregister(&corgibl_driver);
186} 187}
187 188
188module_init(corgibl_init); 189module_init(corgibl_init);
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c
index 957a3ada2b75..5abd3cb00671 100644
--- a/drivers/video/dnfb.c
+++ b/drivers/video/dnfb.c
@@ -227,9 +227,8 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
227 * Initialization 227 * Initialization
228 */ 228 */
229 229
230static int __devinit dnfb_probe(struct device *device) 230static int __devinit dnfb_probe(struct platform_device *dev)
231{ 231{
232 struct platform_device *dev = to_platform_device(device);
233 struct fb_info *info; 232 struct fb_info *info;
234 int err = 0; 233 int err = 0;
235 234
@@ -257,7 +256,7 @@ static int __devinit dnfb_probe(struct device *device)
257 framebuffer_release(info); 256 framebuffer_release(info);
258 return err; 257 return err;
259 } 258 }
260 dev_set_drvdata(&dev->dev, info); 259 platform_set_drvdata(dev, info);
261 260
262 /* now we have registered we can safely setup the hardware */ 261 /* now we have registered we can safely setup the hardware */
263 out_8(AP_CONTROL_3A, RESET_CREG); 262 out_8(AP_CONTROL_3A, RESET_CREG);
@@ -271,10 +270,11 @@ static int __devinit dnfb_probe(struct device *device)
271 return err; 270 return err;
272} 271}
273 272
274static struct device_driver dnfb_driver = { 273static struct platform_driver dnfb_driver = {
275 .name = "dnfb",
276 .bus = &platform_bus_type,
277 .probe = dnfb_probe, 274 .probe = dnfb_probe,
275 .driver = {
276 .name = "dnfb",
277 },
278}; 278};
279 279
280static struct platform_device dnfb_device = { 280static struct platform_device dnfb_device = {
@@ -288,12 +288,12 @@ int __init dnfb_init(void)
288 if (fb_get_options("dnfb", NULL)) 288 if (fb_get_options("dnfb", NULL))
289 return -ENODEV; 289 return -ENODEV;
290 290
291 ret = driver_register(&dnfb_driver); 291 ret = platform_driver_register(&dnfb_driver);
292 292
293 if (!ret) { 293 if (!ret) {
294 ret = platform_device_register(&dnfb_device); 294 ret = platform_device_register(&dnfb_device);
295 if (ret) 295 if (ret)
296 driver_unregister(&dnfb_driver); 296 platform_driver_unregister(&dnfb_driver);
297 } 297 }
298 return ret; 298 return ret;
299} 299}
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c
index 6a81a1dd8f3d..3b0e71383448 100644
--- a/drivers/video/epson1355fb.c
+++ b/drivers/video/epson1355fb.c
@@ -609,9 +609,9 @@ static void epson1355fb_platform_release(struct device *device)
609{ 609{
610} 610}
611 611
612static int epson1355fb_remove(struct device *device) 612static int epson1355fb_remove(struct platform_device *dev)
613{ 613{
614 struct fb_info *info = dev_get_drvdata(device); 614 struct fb_info *info = platform_get_drvdata(dev);
615 struct epson1355_par *par = info->par; 615 struct epson1355_par *par = info->par;
616 616
617 backlight_enable(0); 617 backlight_enable(0);
@@ -632,9 +632,8 @@ static int epson1355fb_remove(struct device *device)
632 return 0; 632 return 0;
633} 633}
634 634
635int __init epson1355fb_probe(struct device *device) 635int __init epson1355fb_probe(struct platform_device *dev)
636{ 636{
637 struct platform_device *dev = to_platform_device(device);
638 struct epson1355_par *default_par; 637 struct epson1355_par *default_par;
639 struct fb_info *info; 638 struct fb_info *info;
640 u8 revision; 639 u8 revision;
@@ -713,7 +712,7 @@ int __init epson1355fb_probe(struct device *device)
713 /* 712 /*
714 * Our driver data. 713 * Our driver data.
715 */ 714 */
716 dev_set_drvdata(&dev->dev, info); 715 platform_set_drvdata(dev, info);
717 716
718 printk(KERN_INFO "fb%d: %s frame buffer device\n", 717 printk(KERN_INFO "fb%d: %s frame buffer device\n",
719 info->node, info->fix.id); 718 info->node, info->fix.id);
@@ -721,15 +720,16 @@ int __init epson1355fb_probe(struct device *device)
721 return 0; 720 return 0;
722 721
723 bail: 722 bail:
724 epson1355fb_remove(device); 723 epson1355fb_remove(dev);
725 return rc; 724 return rc;
726} 725}
727 726
728static struct device_driver epson1355fb_driver = { 727static struct platform_driver epson1355fb_driver = {
729 .name = "epson1355fb",
730 .bus = &platform_bus_type,
731 .probe = epson1355fb_probe, 728 .probe = epson1355fb_probe,
732 .remove = epson1355fb_remove, 729 .remove = epson1355fb_remove,
730 .driver = {
731 .name = "epson1355fb",
732 },
733}; 733};
734 734
735static struct platform_device epson1355fb_device = { 735static struct platform_device epson1355fb_device = {
@@ -747,11 +747,11 @@ int __init epson1355fb_init(void)
747 if (fb_get_options("epson1355fb", NULL)) 747 if (fb_get_options("epson1355fb", NULL))
748 return -ENODEV; 748 return -ENODEV;
749 749
750 ret = driver_register(&epson1355fb_driver); 750 ret = platform_driver_register(&epson1355fb_driver);
751 if (!ret) { 751 if (!ret) {
752 ret = platform_device_register(&epson1355fb_device); 752 ret = platform_device_register(&epson1355fb_device);
753 if (ret) 753 if (ret)
754 driver_unregister(&epson1355fb_driver); 754 platform_driver_unregister(&epson1355fb_driver);
755 } 755 }
756 return ret; 756 return ret;
757} 757}
@@ -762,7 +762,7 @@ module_init(epson1355fb_init);
762static void __exit epson1355fb_exit(void) 762static void __exit epson1355fb_exit(void)
763{ 763{
764 platform_device_unregister(&epson1355fb_device); 764 platform_device_unregister(&epson1355fb_device);
765 driver_unregister(&epson1355fb_driver); 765 platform_driver_unregister(&epson1355fb_driver);
766} 766}
767 767
768/* ------------------------------------------------------------------------- */ 768/* ------------------------------------------------------------------------- */
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
1108static int __init gbefb_probe(struct device *dev) 1108static 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
1234static int __devexit gbefb_remove(struct device* dev) 1233static 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
1255static struct device_driver gbefb_driver = { 1253static 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
1262static struct platform_device *gbefb_device; 1261static struct platform_device *gbefb_device;
1263 1262
1264int __init gbefb_init(void) 1263int __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)
1282void __exit gbefb_exit(void) 1281void __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
1288module_init(gbefb_init); 1287module_init(gbefb_init);
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index e20b9f3a255f..5924cc225c95 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -423,18 +423,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi)
423 * Power management hooks. Note that we won't be called from IRQ context, 423 * Power management hooks. Note that we won't be called from IRQ context,
424 * unlike the blank functions above, so we may sleep. 424 * unlike the blank functions above, so we may sleep.
425 */ 425 */
426static int imxfb_suspend(struct device *dev, pm_message_t state) 426static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
427{ 427{
428 struct imxfb_info *fbi = dev_get_drvdata(dev); 428 struct imxfb_info *fbi = platform_get_drvdata(dev);
429 pr_debug("%s\n",__FUNCTION__); 429 pr_debug("%s\n",__FUNCTION__);
430 430
431 imxfb_disable_controller(fbi); 431 imxfb_disable_controller(fbi);
432 return 0; 432 return 0;
433} 433}
434 434
435static int imxfb_resume(struct device *dev) 435static int imxfb_resume(struct platform_device *dev)
436{ 436{
437 struct imxfb_info *fbi = dev_get_drvdata(dev); 437 struct imxfb_info *fbi = platform_get_drvdata(dev);
438 pr_debug("%s\n",__FUNCTION__); 438 pr_debug("%s\n",__FUNCTION__);
439 439
440 imxfb_enable_controller(fbi); 440 imxfb_enable_controller(fbi);
@@ -538,9 +538,8 @@ static int __init imxfb_map_video_memory(struct fb_info *info)
538 return fbi->map_cpu ? 0 : -ENOMEM; 538 return fbi->map_cpu ? 0 : -ENOMEM;
539} 539}
540 540
541static int __init imxfb_probe(struct device *dev) 541static int __init imxfb_probe(struct platform_device *pdev)
542{ 542{
543 struct platform_device *pdev = to_platform_device(dev);
544 struct imxfb_info *fbi; 543 struct imxfb_info *fbi;
545 struct fb_info *info; 544 struct fb_info *info;
546 struct imxfb_mach_info *inf; 545 struct imxfb_mach_info *inf;
@@ -553,21 +552,21 @@ static int __init imxfb_probe(struct device *dev)
553 if(!res) 552 if(!res)
554 return -ENODEV; 553 return -ENODEV;
555 554
556 inf = dev->platform_data; 555 inf = pdev->dev.platform_data;
557 if(!inf) { 556 if(!inf) {
558 dev_err(dev,"No platform_data available\n"); 557 dev_err(dev,"No platform_data available\n");
559 return -ENOMEM; 558 return -ENOMEM;
560 } 559 }
561 560
562 info = framebuffer_alloc(sizeof(struct imxfb_info), dev); 561 info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
563 if(!info) 562 if(!info)
564 return -ENOMEM; 563 return -ENOMEM;
565 564
566 fbi = info->par; 565 fbi = info->par;
567 566
568 dev_set_drvdata(dev, info); 567 platform_set_drvdata(pdev, info);
569 568
570 ret = imxfb_init_fbinfo(dev); 569 ret = imxfb_init_fbinfo(&pdev->dev);
571 if( ret < 0 ) 570 if( ret < 0 )
572 goto failed_init; 571 goto failed_init;
573 572
@@ -621,22 +620,21 @@ failed_register:
621 fb_dealloc_cmap(&info->cmap); 620 fb_dealloc_cmap(&info->cmap);
622failed_cmap: 621failed_cmap:
623 if (!inf->fixed_screen_cpu) 622 if (!inf->fixed_screen_cpu)
624 dma_free_writecombine(dev,fbi->map_size,fbi->map_cpu, 623 dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu,
625 fbi->map_dma); 624 fbi->map_dma);
626failed_map: 625failed_map:
627 kfree(info->pseudo_palette); 626 kfree(info->pseudo_palette);
628failed_regs: 627failed_regs:
629 release_mem_region(res->start, res->end - res->start); 628 release_mem_region(res->start, res->end - res->start);
630failed_init: 629failed_init:
631 dev_set_drvdata(dev, NULL); 630 platform_set_drvdata(pdev, NULL);
632 framebuffer_release(info); 631 framebuffer_release(info);
633 return ret; 632 return ret;
634} 633}
635 634
636static int imxfb_remove(struct device *dev) 635static int imxfb_remove(struct platform_device *pdev)
637{ 636{
638 struct platform_device *pdev = to_platform_device(dev); 637 struct fb_info *info = platform_get_drvdata(pdev);
639 struct fb_info *info = dev_get_drvdata(dev);
640 struct imxfb_info *fbi = info->par; 638 struct imxfb_info *fbi = info->par;
641 struct resource *res; 639 struct resource *res;
642 640
@@ -651,36 +649,37 @@ static int imxfb_remove(struct device *dev)
651 framebuffer_release(info); 649 framebuffer_release(info);
652 650
653 release_mem_region(res->start, res->end - res->start + 1); 651 release_mem_region(res->start, res->end - res->start + 1);
654 dev_set_drvdata(dev, NULL); 652 platform_set_drvdata(pdev, NULL);
655 653
656 return 0; 654 return 0;
657} 655}
658 656
659void imxfb_shutdown(struct device * dev) 657void imxfb_shutdown(struct platform_device * dev)
660{ 658{
661 struct fb_info *info = dev_get_drvdata(dev); 659 struct fb_info *info = platform_get_drvdata(dev);
662 struct imxfb_info *fbi = info->par; 660 struct imxfb_info *fbi = info->par;
663 imxfb_disable_controller(fbi); 661 imxfb_disable_controller(fbi);
664} 662}
665 663
666static struct device_driver imxfb_driver = { 664static struct platform_driver imxfb_driver = {
667 .name = "imx-fb",
668 .bus = &platform_bus_type,
669 .probe = imxfb_probe, 665 .probe = imxfb_probe,
670 .suspend = imxfb_suspend, 666 .suspend = imxfb_suspend,
671 .resume = imxfb_resume, 667 .resume = imxfb_resume,
672 .remove = imxfb_remove, 668 .remove = imxfb_remove,
673 .shutdown = imxfb_shutdown, 669 .shutdown = imxfb_shutdown,
670 .driver = {
671 .name = "imx-fb",
672 },
674}; 673};
675 674
676int __init imxfb_init(void) 675int __init imxfb_init(void)
677{ 676{
678 return driver_register(&imxfb_driver); 677 return platform_driver_register(&imxfb_driver);
679} 678}
680 679
681static void __exit imxfb_cleanup(void) 680static void __exit imxfb_cleanup(void)
682{ 681{
683 driver_unregister(&imxfb_driver); 682 platform_driver_unregister(&imxfb_driver);
684} 683}
685 684
686module_init(imxfb_init); 685module_init(imxfb_init);
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index f305a5b77b23..7b4cd250bec8 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -980,17 +980,17 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
980 * Power management hooks. Note that we won't be called from IRQ context, 980 * Power management hooks. Note that we won't be called from IRQ context,
981 * unlike the blank functions above, so we may sleep. 981 * unlike the blank functions above, so we may sleep.
982 */ 982 */
983static int pxafb_suspend(struct device *dev, pm_message_t state) 983static int pxafb_suspend(struct platform_device *dev, pm_message_t state)
984{ 984{
985 struct pxafb_info *fbi = dev_get_drvdata(dev); 985 struct pxafb_info *fbi = platform_get_drvdata(dev);
986 986
987 set_ctrlr_state(fbi, C_DISABLE_PM); 987 set_ctrlr_state(fbi, C_DISABLE_PM);
988 return 0; 988 return 0;
989} 989}
990 990
991static int pxafb_resume(struct device *dev) 991static int pxafb_resume(struct platform_device *dev)
992{ 992{
993 struct pxafb_info *fbi = dev_get_drvdata(dev); 993 struct pxafb_info *fbi = platform_get_drvdata(dev);
994 994
995 set_ctrlr_state(fbi, C_ENABLE_PM); 995 set_ctrlr_state(fbi, C_ENABLE_PM);
996 return 0; 996 return 0;
@@ -1268,7 +1268,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1268} 1268}
1269#endif 1269#endif
1270 1270
1271int __init pxafb_probe(struct device *dev) 1271int __init pxafb_probe(struct platform_device *dev)
1272{ 1272{
1273 struct pxafb_info *fbi; 1273 struct pxafb_info *fbi;
1274 struct pxafb_mach_info *inf; 1274 struct pxafb_mach_info *inf;
@@ -1276,14 +1276,14 @@ int __init pxafb_probe(struct device *dev)
1276 1276
1277 dev_dbg(dev, "pxafb_probe\n"); 1277 dev_dbg(dev, "pxafb_probe\n");
1278 1278
1279 inf = dev->platform_data; 1279 inf = dev->dev.platform_data;
1280 ret = -ENOMEM; 1280 ret = -ENOMEM;
1281 fbi = NULL; 1281 fbi = NULL;
1282 if (!inf) 1282 if (!inf)
1283 goto failed; 1283 goto failed;
1284 1284
1285#ifdef CONFIG_FB_PXA_PARAMETERS 1285#ifdef CONFIG_FB_PXA_PARAMETERS
1286 ret = pxafb_parse_options(dev, g_options); 1286 ret = pxafb_parse_options(&dev->dev, g_options);
1287 if (ret < 0) 1287 if (ret < 0)
1288 goto failed; 1288 goto failed;
1289#endif 1289#endif
@@ -1293,36 +1293,36 @@ int __init pxafb_probe(struct device *dev)
1293 * a warning is given. */ 1293 * a warning is given. */
1294 1294
1295 if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) 1295 if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK)
1296 dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n", 1296 dev_warn(&dev->dev, "machine LCCR0 setting contains illegal bits: %08x\n",
1297 inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); 1297 inf->lccr0 & LCCR0_INVALID_CONFIG_MASK);
1298 if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) 1298 if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK)
1299 dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n", 1299 dev_warn(&dev->dev, "machine LCCR3 setting contains illegal bits: %08x\n",
1300 inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); 1300 inf->lccr3 & LCCR3_INVALID_CONFIG_MASK);
1301 if (inf->lccr0 & LCCR0_DPD && 1301 if (inf->lccr0 & LCCR0_DPD &&
1302 ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || 1302 ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas ||
1303 (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || 1303 (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl ||
1304 (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) 1304 (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono))
1305 dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono" 1305 dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is only valid in passive mono"
1306 " single panel mode\n"); 1306 " single panel mode\n");
1307 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && 1307 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act &&
1308 (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) 1308 (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual)
1309 dev_warn(dev, "Dual panel only valid in passive mode\n"); 1309 dev_warn(&dev->dev, "Dual panel only valid in passive mode\n");
1310 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && 1310 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas &&
1311 (inf->upper_margin || inf->lower_margin)) 1311 (inf->upper_margin || inf->lower_margin))
1312 dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n"); 1312 dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n");
1313#endif 1313#endif
1314 1314
1315 dev_dbg(dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); 1315 dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp);
1316 if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { 1316 if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) {
1317 dev_err(dev, "Invalid resolution or bit depth\n"); 1317 dev_err(&dev->dev, "Invalid resolution or bit depth\n");
1318 ret = -EINVAL; 1318 ret = -EINVAL;
1319 goto failed; 1319 goto failed;
1320 } 1320 }
1321 pxafb_backlight_power = inf->pxafb_backlight_power; 1321 pxafb_backlight_power = inf->pxafb_backlight_power;
1322 pxafb_lcd_power = inf->pxafb_lcd_power; 1322 pxafb_lcd_power = inf->pxafb_lcd_power;
1323 fbi = pxafb_init_fbinfo(dev); 1323 fbi = pxafb_init_fbinfo(&dev->dev);
1324 if (!fbi) { 1324 if (!fbi) {
1325 dev_err(dev, "Failed to initialize framebuffer device\n"); 1325 dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
1326 ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc 1326 ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc
1327 goto failed; 1327 goto failed;
1328 } 1328 }
@@ -1330,14 +1330,14 @@ int __init pxafb_probe(struct device *dev)
1330 /* Initialize video memory */ 1330 /* Initialize video memory */
1331 ret = pxafb_map_video_memory(fbi); 1331 ret = pxafb_map_video_memory(fbi);
1332 if (ret) { 1332 if (ret) {
1333 dev_err(dev, "Failed to allocate video RAM: %d\n", ret); 1333 dev_err(&dev->dev, "Failed to allocate video RAM: %d\n", ret);
1334 ret = -ENOMEM; 1334 ret = -ENOMEM;
1335 goto failed; 1335 goto failed;
1336 } 1336 }
1337 1337
1338 ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); 1338 ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi);
1339 if (ret) { 1339 if (ret) {
1340 dev_err(dev, "request_irq failed: %d\n", ret); 1340 dev_err(&dev->dev, "request_irq failed: %d\n", ret);
1341 ret = -EBUSY; 1341 ret = -EBUSY;
1342 goto failed; 1342 goto failed;
1343 } 1343 }
@@ -1349,11 +1349,11 @@ int __init pxafb_probe(struct device *dev)
1349 pxafb_check_var(&fbi->fb.var, &fbi->fb); 1349 pxafb_check_var(&fbi->fb.var, &fbi->fb);
1350 pxafb_set_par(&fbi->fb); 1350 pxafb_set_par(&fbi->fb);
1351 1351
1352 dev_set_drvdata(dev, fbi); 1352 platform_set_drvdata(dev, fbi);
1353 1353
1354 ret = register_framebuffer(&fbi->fb); 1354 ret = register_framebuffer(&fbi->fb);
1355 if (ret < 0) { 1355 if (ret < 0) {
1356 dev_err(dev, "Failed to register framebuffer device: %d\n", ret); 1356 dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret);
1357 goto failed; 1357 goto failed;
1358 } 1358 }
1359 1359
@@ -1376,19 +1376,20 @@ int __init pxafb_probe(struct device *dev)
1376 return 0; 1376 return 0;
1377 1377
1378failed: 1378failed:
1379 dev_set_drvdata(dev, NULL); 1379 platform_set_drvdata(dev, NULL);
1380 kfree(fbi); 1380 kfree(fbi);
1381 return ret; 1381 return ret;
1382} 1382}
1383 1383
1384static struct device_driver pxafb_driver = { 1384static struct platform_driver pxafb_driver = {
1385 .name = "pxa2xx-fb",
1386 .bus = &platform_bus_type,
1387 .probe = pxafb_probe, 1385 .probe = pxafb_probe,
1388#ifdef CONFIG_PM 1386#ifdef CONFIG_PM
1389 .suspend = pxafb_suspend, 1387 .suspend = pxafb_suspend,
1390 .resume = pxafb_resume, 1388 .resume = pxafb_resume,
1391#endif 1389#endif
1390 .driver = {
1391 .name = "pxa2xx-fb",
1392 },
1392}; 1393};
1393 1394
1394#ifndef MODULE 1395#ifndef MODULE
@@ -1415,7 +1416,7 @@ int __devinit pxafb_init(void)
1415 return -ENODEV; 1416 return -ENODEV;
1416 pxafb_setup(option); 1417 pxafb_setup(option);
1417#endif 1418#endif
1418 return driver_register(&pxafb_driver); 1419 return platform_driver_register(&pxafb_driver);
1419} 1420}
1420 1421
1421module_init(pxafb_init); 1422module_init(pxafb_init);
diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c
index bfc41f2c902a..fc91dbf896d2 100644
--- a/drivers/video/q40fb.c
+++ b/drivers/video/q40fb.c
@@ -86,9 +86,8 @@ static struct fb_ops q40fb_ops = {
86 .fb_imageblit = cfb_imageblit, 86 .fb_imageblit = cfb_imageblit,
87}; 87};
88 88
89static int __init q40fb_probe(struct device *device) 89static int __init q40fb_probe(struct platform_device *dev)
90{ 90{
91 struct platform_device *dev = to_platform_device(device);
92 struct fb_info *info; 91 struct fb_info *info;
93 92
94 if (!MACH_IS_Q40) 93 if (!MACH_IS_Q40)
@@ -128,10 +127,11 @@ static int __init q40fb_probe(struct device *device)
128 return 0; 127 return 0;
129} 128}
130 129
131static struct device_driver q40fb_driver = { 130static struct platform_driver q40fb_driver = {
132 .name = "q40fb",
133 .bus = &platform_bus_type,
134 .probe = q40fb_probe, 131 .probe = q40fb_probe,
132 .driver = {
133 .name = "q40fb",
134 },
135}; 135};
136 136
137static struct platform_device q40fb_device = { 137static struct platform_device q40fb_device = {
@@ -145,12 +145,12 @@ int __init q40fb_init(void)
145 if (fb_get_options("q40fb", NULL)) 145 if (fb_get_options("q40fb", NULL))
146 return -ENODEV; 146 return -ENODEV;
147 147
148 ret = driver_register(&q40fb_driver); 148 ret = platform_driver_register(&q40fb_driver);
149 149
150 if (!ret) { 150 if (!ret) {
151 ret = platform_device_register(&q40fb_device); 151 ret = platform_device_register(&q40fb_device);
152 if (ret) 152 if (ret)
153 driver_unregister(&q40fb_driver); 153 platform_driver_unregister(&q40fb_driver);
154 } 154 }
155 return ret; 155 return ret;
156} 156}
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c
index 3edbd14c5c46..e5d0f92eeae3 100644
--- a/drivers/video/s1d13xxxfb.c
+++ b/drivers/video/s1d13xxxfb.c
@@ -503,10 +503,9 @@ s1d13xxxfb_fetch_hw_state(struct fb_info *info)
503 503
504 504
505static int 505static int
506s1d13xxxfb_remove(struct device *dev) 506s1d13xxxfb_remove(struct platform_device *pdev)
507{ 507{
508 struct fb_info *info = dev_get_drvdata(dev); 508 struct fb_info *info = platform_get_drvdata(pdev);
509 struct platform_device *pdev = to_platform_device(dev);
510 struct s1d13xxxfb_par *par = NULL; 509 struct s1d13xxxfb_par *par = NULL;
511 510
512 if (info) { 511 if (info) {
@@ -534,9 +533,8 @@ s1d13xxxfb_remove(struct device *dev)
534} 533}
535 534
536static int __devinit 535static int __devinit
537s1d13xxxfb_probe(struct device *dev) 536s1d13xxxfb_probe(struct platform_device *pdev)
538{ 537{
539 struct platform_device *pdev = to_platform_device(dev);
540 struct s1d13xxxfb_par *default_par; 538 struct s1d13xxxfb_par *default_par;
541 struct fb_info *info; 539 struct fb_info *info;
542 struct s1d13xxxfb_pdata *pdata = NULL; 540 struct s1d13xxxfb_pdata *pdata = NULL;
@@ -548,8 +546,8 @@ s1d13xxxfb_probe(struct device *dev)
548 printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); 546 printk(KERN_INFO "Epson S1D13XXX FB Driver\n");
549 547
550 /* enable platform-dependent hardware glue, if any */ 548 /* enable platform-dependent hardware glue, if any */
551 if (dev->platform_data) 549 if (pdev->dev.platform_data)
552 pdata = dev->platform_data; 550 pdata = pdev->dev.platform_data;
553 551
554 if (pdata && pdata->platform_init_video) 552 if (pdata && pdata->platform_init_video)
555 pdata->platform_init_video(); 553 pdata->platform_init_video();
@@ -572,14 +570,14 @@ s1d13xxxfb_probe(struct device *dev)
572 570
573 if (!request_mem_region(pdev->resource[0].start, 571 if (!request_mem_region(pdev->resource[0].start,
574 pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { 572 pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) {
575 dev_dbg(dev, "request_mem_region failed\n"); 573 dev_dbg(&pdev->dev, "request_mem_region failed\n");
576 ret = -EBUSY; 574 ret = -EBUSY;
577 goto bail; 575 goto bail;
578 } 576 }
579 577
580 if (!request_mem_region(pdev->resource[1].start, 578 if (!request_mem_region(pdev->resource[1].start,
581 pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { 579 pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) {
582 dev_dbg(dev, "request_mem_region failed\n"); 580 dev_dbg(&pdev->dev, "request_mem_region failed\n");
583 ret = -EBUSY; 581 ret = -EBUSY;
584 goto bail; 582 goto bail;
585 } 583 }
@@ -640,7 +638,7 @@ s1d13xxxfb_probe(struct device *dev)
640 goto bail; 638 goto bail;
641 } 639 }
642 640
643 dev_set_drvdata(&pdev->dev, info); 641 platform_set_drvdata(pdev, info);
644 642
645 printk(KERN_INFO "fb%d: %s frame buffer device\n", 643 printk(KERN_INFO "fb%d: %s frame buffer device\n",
646 info->node, info->fix.id); 644 info->node, info->fix.id);
@@ -648,15 +646,15 @@ s1d13xxxfb_probe(struct device *dev)
648 return 0; 646 return 0;
649 647
650bail: 648bail:
651 s1d13xxxfb_remove(dev); 649 s1d13xxxfb_remove(pdev);
652 return ret; 650 return ret;
653 651
654} 652}
655 653
656#ifdef CONFIG_PM 654#ifdef CONFIG_PM
657static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) 655static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state)
658{ 656{
659 struct fb_info *info = dev_get_drvdata(dev); 657 struct fb_info *info = platform_get_drvdata(dev);
660 struct s1d13xxxfb_par *s1dfb = info->par; 658 struct s1d13xxxfb_par *s1dfb = info->par;
661 struct s1d13xxxfb_pdata *pdata = NULL; 659 struct s1d13xxxfb_pdata *pdata = NULL;
662 660
@@ -664,8 +662,8 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
664 lcd_enable(s1dfb, 0); 662 lcd_enable(s1dfb, 0);
665 crt_enable(s1dfb, 0); 663 crt_enable(s1dfb, 0);
666 664
667 if (dev->platform_data) 665 if (dev->dev.platform_data)
668 pdata = dev->platform_data; 666 pdata = dev->dev.platform_data;
669 667
670#if 0 668#if 0
671 if (!s1dfb->disp_save) 669 if (!s1dfb->disp_save)
@@ -701,9 +699,9 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
701 return 0; 699 return 0;
702} 700}
703 701
704static int s1d13xxxfb_resume(struct device *dev) 702static int s1d13xxxfb_resume(struct platform_device *dev)
705{ 703{
706 struct fb_info *info = dev_get_drvdata(dev); 704 struct fb_info *info = platform_get_drvdata(dev);
707 struct s1d13xxxfb_par *s1dfb = info->par; 705 struct s1d13xxxfb_par *s1dfb = info->par;
708 struct s1d13xxxfb_pdata *pdata = NULL; 706 struct s1d13xxxfb_pdata *pdata = NULL;
709 707
@@ -714,8 +712,8 @@ static int s1d13xxxfb_resume(struct device *dev)
714 while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) 712 while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01))
715 udelay(10); 713 udelay(10);
716 714
717 if (dev->platform_data) 715 if (dev->dev.platform_data)
718 pdata = dev->platform_data; 716 pdata = dev->dev.platform_data;
719 717
720 if (s1dfb->regs_save) { 718 if (s1dfb->regs_save) {
721 /* will write RO regs, *should* get away with it :) */ 719 /* will write RO regs, *should* get away with it :) */
@@ -741,15 +739,16 @@ static int s1d13xxxfb_resume(struct device *dev)
741} 739}
742#endif /* CONFIG_PM */ 740#endif /* CONFIG_PM */
743 741
744static struct device_driver s1d13xxxfb_driver = { 742static struct platform_driver s1d13xxxfb_driver = {
745 .name = S1D_DEVICENAME,
746 .bus = &platform_bus_type,
747 .probe = s1d13xxxfb_probe, 743 .probe = s1d13xxxfb_probe,
748 .remove = s1d13xxxfb_remove, 744 .remove = s1d13xxxfb_remove,
749#ifdef CONFIG_PM 745#ifdef CONFIG_PM
750 .suspend = s1d13xxxfb_suspend, 746 .suspend = s1d13xxxfb_suspend,
751 .resume = s1d13xxxfb_resume 747 .resume = s1d13xxxfb_resume,
752#endif 748#endif
749 .driver = {
750 .name = S1D_DEVICENAME,
751 },
753}; 752};
754 753
755 754
@@ -759,14 +758,14 @@ s1d13xxxfb_init(void)
759 if (fb_get_options("s1d13xxxfb", NULL)) 758 if (fb_get_options("s1d13xxxfb", NULL))
760 return -ENODEV; 759 return -ENODEV;
761 760
762 return driver_register(&s1d13xxxfb_driver); 761 return platform_driver_register(&s1d13xxxfb_driver);
763} 762}
764 763
765 764
766static void __exit 765static void __exit
767s1d13xxxfb_exit(void) 766s1d13xxxfb_exit(void)
768{ 767{
769 driver_unregister(&s1d13xxxfb_driver); 768 platform_driver_unregister(&s1d13xxxfb_driver);
770} 769}
771 770
772module_init(s1d13xxxfb_init); 771module_init(s1d13xxxfb_init);
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 855a6778b9eb..ce6e749db3a7 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -634,19 +634,18 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r)
634 634
635static char driver_name[]="s3c2410fb"; 635static char driver_name[]="s3c2410fb";
636 636
637int __init s3c2410fb_probe(struct device *dev) 637int __init s3c2410fb_probe(struct platform_device *pdev)
638{ 638{
639 struct s3c2410fb_info *info; 639 struct s3c2410fb_info *info;
640 struct fb_info *fbinfo; 640 struct fb_info *fbinfo;
641 struct platform_device *pdev = to_platform_device(dev);
642 struct s3c2410fb_hw *mregs; 641 struct s3c2410fb_hw *mregs;
643 int ret; 642 int ret;
644 int irq; 643 int irq;
645 int i; 644 int i;
646 645
647 mach_info = dev->platform_data; 646 mach_info = pdev->dev.platform_data;
648 if (mach_info == NULL) { 647 if (mach_info == NULL) {
649 dev_err(dev,"no platform data for lcd, cannot attach\n"); 648 dev_err(&pdev->dev,"no platform data for lcd, cannot attach\n");
650 return -EINVAL; 649 return -EINVAL;
651 } 650 }
652 651
@@ -654,11 +653,11 @@ int __init s3c2410fb_probe(struct device *dev)
654 653
655 irq = platform_get_irq(pdev, 0); 654 irq = platform_get_irq(pdev, 0);
656 if (irq < 0) { 655 if (irq < 0) {
657 dev_err(dev, "no irq for device\n"); 656 dev_err(&pdev->dev, "no irq for device\n");
658 return -ENOENT; 657 return -ENOENT;
659 } 658 }
660 659
661 fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), dev); 660 fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), &pdev->dev);
662 if (!fbinfo) { 661 if (!fbinfo) {
663 return -ENOMEM; 662 return -ENOMEM;
664 } 663 }
@@ -666,7 +665,7 @@ int __init s3c2410fb_probe(struct device *dev)
666 665
667 info = fbinfo->par; 666 info = fbinfo->par;
668 info->fb = fbinfo; 667 info->fb = fbinfo;
669 dev_set_drvdata(dev, fbinfo); 668 platform_set_drvdata(pdev, fbinfo);
670 669
671 s3c2410fb_init_registers(info); 670 s3c2410fb_init_registers(info);
672 671
@@ -676,7 +675,7 @@ int __init s3c2410fb_probe(struct device *dev)
676 675
677 memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); 676 memcpy(&info->regs, &mach_info->regs, sizeof(info->regs));
678 677
679 info->mach_info = dev->platform_data; 678 info->mach_info = pdev->dev.platform_data;
680 679
681 fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; 680 fbinfo->fix.type = FB_TYPE_PACKED_PIXELS;
682 fbinfo->fix.type_aux = 0; 681 fbinfo->fix.type_aux = 0;
@@ -735,7 +734,7 @@ int __init s3c2410fb_probe(struct device *dev)
735 734
736 ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); 735 ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info);
737 if (ret) { 736 if (ret) {
738 dev_err(dev, "cannot get irq %d - err %d\n", irq, ret); 737 dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret);
739 ret = -EBUSY; 738 ret = -EBUSY;
740 goto release_mem; 739 goto release_mem;
741 } 740 }
@@ -773,7 +772,7 @@ int __init s3c2410fb_probe(struct device *dev)
773 } 772 }
774 773
775 /* create device files */ 774 /* create device files */
776 device_create_file(dev, &dev_attr_debug); 775 device_create_file(&pdev->dev, &dev_attr_debug);
777 776
778 printk(KERN_INFO "fb%d: %s frame buffer device\n", 777 printk(KERN_INFO "fb%d: %s frame buffer device\n",
779 fbinfo->node, fbinfo->fix.id); 778 fbinfo->node, fbinfo->fix.id);
@@ -816,10 +815,9 @@ static void s3c2410fb_stop_lcd(void)
816/* 815/*
817 * Cleanup 816 * Cleanup
818 */ 817 */
819static int s3c2410fb_remove(struct device *dev) 818static int s3c2410fb_remove(struct platform_device *pdev)
820{ 819{
821 struct platform_device *pdev = to_platform_device(dev); 820 struct fb_info *fbinfo = platform_get_drvdata(pdev);
822 struct fb_info *fbinfo = dev_get_drvdata(dev);
823 struct s3c2410fb_info *info = fbinfo->par; 821 struct s3c2410fb_info *info = fbinfo->par;
824 int irq; 822 int irq;
825 823
@@ -847,9 +845,9 @@ static int s3c2410fb_remove(struct device *dev)
847 845
848/* suspend and resume support for the lcd controller */ 846/* suspend and resume support for the lcd controller */
849 847
850static int s3c2410fb_suspend(struct device *dev, pm_message_t state) 848static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
851{ 849{
852 struct fb_info *fbinfo = dev_get_drvdata(dev); 850 struct fb_info *fbinfo = platform_get_drvdata(dev);
853 struct s3c2410fb_info *info = fbinfo->par; 851 struct s3c2410fb_info *info = fbinfo->par;
854 852
855 s3c2410fb_stop_lcd(); 853 s3c2410fb_stop_lcd();
@@ -864,9 +862,9 @@ static int s3c2410fb_suspend(struct device *dev, pm_message_t state)
864 return 0; 862 return 0;
865} 863}
866 864
867static int s3c2410fb_resume(struct device *dev) 865static int s3c2410fb_resume(struct platform_device *dev)
868{ 866{
869 struct fb_info *fbinfo = dev_get_drvdata(dev); 867 struct fb_info *fbinfo = platform_get_drvdata(dev);
870 struct s3c2410fb_info *info = fbinfo->par; 868 struct s3c2410fb_info *info = fbinfo->par;
871 869
872 clk_enable(info->clk); 870 clk_enable(info->clk);
@@ -882,24 +880,25 @@ static int s3c2410fb_resume(struct device *dev)
882#define s3c2410fb_resume NULL 880#define s3c2410fb_resume NULL
883#endif 881#endif
884 882
885static struct device_driver s3c2410fb_driver = { 883static struct platform_driver s3c2410fb_driver = {
886 .name = "s3c2410-lcd",
887 .owner = THIS_MODULE,
888 .bus = &platform_bus_type,
889 .probe = s3c2410fb_probe, 884 .probe = s3c2410fb_probe,
885 .remove = s3c2410fb_remove,
890 .suspend = s3c2410fb_suspend, 886 .suspend = s3c2410fb_suspend,
891 .resume = s3c2410fb_resume, 887 .resume = s3c2410fb_resume,
892 .remove = s3c2410fb_remove 888 .driver = {
889 .name = "s3c2410-lcd",
890 .owner = THIS_MODULE,
891 },
893}; 892};
894 893
895int __devinit s3c2410fb_init(void) 894int __devinit s3c2410fb_init(void)
896{ 895{
897 return driver_register(&s3c2410fb_driver); 896 return platform_driver_register(&s3c2410fb_driver);
898} 897}
899 898
900static void __exit s3c2410fb_cleanup(void) 899static void __exit s3c2410fb_cleanup(void)
901{ 900{
902 driver_unregister(&s3c2410fb_driver); 901 platform_driver_unregister(&s3c2410fb_driver);
903} 902}
904 903
905 904
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index a5184575cfae..2ea1354e439f 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -1308,17 +1308,17 @@ sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val,
1308 * Power management hooks. Note that we won't be called from IRQ context, 1308 * Power management hooks. Note that we won't be called from IRQ context,
1309 * unlike the blank functions above, so we may sleep. 1309 * unlike the blank functions above, so we may sleep.
1310 */ 1310 */
1311static int sa1100fb_suspend(struct device *dev, pm_message_t state) 1311static int sa1100fb_suspend(struct platform_device *dev, pm_message_t state)
1312{ 1312{
1313 struct sa1100fb_info *fbi = dev_get_drvdata(dev); 1313 struct sa1100fb_info *fbi = platform_get_drvdata(dev);
1314 1314
1315 set_ctrlr_state(fbi, C_DISABLE_PM); 1315 set_ctrlr_state(fbi, C_DISABLE_PM);
1316 return 0; 1316 return 0;
1317} 1317}
1318 1318
1319static int sa1100fb_resume(struct device *dev) 1319static int sa1100fb_resume(struct platform_device *dev)
1320{ 1320{
1321 struct sa1100fb_info *fbi = dev_get_drvdata(dev); 1321 struct sa1100fb_info *fbi = platform_get_drvdata(dev);
1322 1322
1323 set_ctrlr_state(fbi, C_ENABLE_PM); 1323 set_ctrlr_state(fbi, C_ENABLE_PM);
1324 return 0; 1324 return 0;
@@ -1452,7 +1452,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
1452 return fbi; 1452 return fbi;
1453} 1453}
1454 1454
1455static int __init sa1100fb_probe(struct device *dev) 1455static int __init sa1100fb_probe(struct platform_device *pdev)
1456{ 1456{
1457 struct sa1100fb_info *fbi; 1457 struct sa1100fb_info *fbi;
1458 int ret; 1458 int ret;
@@ -1460,7 +1460,7 @@ static int __init sa1100fb_probe(struct device *dev)
1460 if (!request_mem_region(0xb0100000, 0x10000, "LCD")) 1460 if (!request_mem_region(0xb0100000, 0x10000, "LCD"))
1461 return -EBUSY; 1461 return -EBUSY;
1462 1462
1463 fbi = sa1100fb_init_fbinfo(dev); 1463 fbi = sa1100fb_init_fbinfo(&pdev->dev);
1464 ret = -ENOMEM; 1464 ret = -ENOMEM;
1465 if (!fbi) 1465 if (!fbi)
1466 goto failed; 1466 goto failed;
@@ -1488,7 +1488,7 @@ static int __init sa1100fb_probe(struct device *dev)
1488 */ 1488 */
1489 sa1100fb_check_var(&fbi->fb.var, &fbi->fb); 1489 sa1100fb_check_var(&fbi->fb.var, &fbi->fb);
1490 1490
1491 dev_set_drvdata(dev, fbi); 1491 platform_set_drvdata(pdev, fbi);
1492 1492
1493 ret = register_framebuffer(&fbi->fb); 1493 ret = register_framebuffer(&fbi->fb);
1494 if (ret < 0) 1494 if (ret < 0)
@@ -1505,18 +1505,19 @@ static int __init sa1100fb_probe(struct device *dev)
1505 return 0; 1505 return 0;
1506 1506
1507failed: 1507failed:
1508 dev_set_drvdata(dev, NULL); 1508 platform_set_drvdata(pdev, NULL);
1509 kfree(fbi); 1509 kfree(fbi);
1510 release_mem_region(0xb0100000, 0x10000); 1510 release_mem_region(0xb0100000, 0x10000);
1511 return ret; 1511 return ret;
1512} 1512}
1513 1513
1514static struct device_driver sa1100fb_driver = { 1514static struct platform_driver sa1100fb_driver = {
1515 .name = "sa11x0-fb",
1516 .bus = &platform_bus_type,
1517 .probe = sa1100fb_probe, 1515 .probe = sa1100fb_probe,
1518 .suspend = sa1100fb_suspend, 1516 .suspend = sa1100fb_suspend,
1519 .resume = sa1100fb_resume, 1517 .resume = sa1100fb_resume,
1518 .driver = {
1519 .name = "sa11x0-fb",
1520 },
1520}; 1521};
1521 1522
1522int __init sa1100fb_init(void) 1523int __init sa1100fb_init(void)
@@ -1524,7 +1525,7 @@ int __init sa1100fb_init(void)
1524 if (fb_get_options("sa1100fb", NULL)) 1525 if (fb_get_options("sa1100fb", NULL))
1525 return -ENODEV; 1526 return -ENODEV;
1526 1527
1527 return driver_register(&sa1100fb_driver); 1528 return platform_driver_register(&sa1100fb_driver);
1528} 1529}
1529 1530
1530int __init sa1100fb_setup(char *options) 1531int __init sa1100fb_setup(char *options)
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c
index 2e8769dd345a..7054660767e4 100644
--- a/drivers/video/sgivwfb.c
+++ b/drivers/video/sgivwfb.c
@@ -750,9 +750,8 @@ int __init sgivwfb_setup(char *options)
750/* 750/*
751 * Initialisation 751 * Initialisation
752 */ 752 */
753static int __init sgivwfb_probe(struct device *device) 753static int __init sgivwfb_probe(struct platform_device *dev)
754{ 754{
755 struct platform_device *dev = to_platform_device(device);
756 struct sgivw_par *par; 755 struct sgivw_par *par;
757 struct fb_info *info; 756 struct fb_info *info;
758 char *monitor; 757 char *monitor;
@@ -813,7 +812,7 @@ static int __init sgivwfb_probe(struct device *device)
813 goto fail_register_framebuffer; 812 goto fail_register_framebuffer;
814 } 813 }
815 814
816 dev_set_drvdata(&dev->dev, info); 815 platform_set_drvdata(dev, info);
817 816
818 printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n", 817 printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n",
819 info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys); 818 info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys);
@@ -831,9 +830,9 @@ fail_ioremap_regs:
831 return -ENXIO; 830 return -ENXIO;
832} 831}
833 832
834static int sgivwfb_remove(struct device *device) 833static int sgivwfb_remove(struct platform_device *dev)
835{ 834{
836 struct fb_info *info = dev_get_drvdata(device); 835 struct fb_info *info = platform_get_drvdata(dev);
837 836
838 if (info) { 837 if (info) {
839 struct sgivw_par *par = info->par; 838 struct sgivw_par *par = info->par;
@@ -847,11 +846,12 @@ static int sgivwfb_remove(struct device *device)
847 return 0; 846 return 0;
848} 847}
849 848
850static struct device_driver sgivwfb_driver = { 849static struct platform_driver sgivwfb_driver = {
851 .name = "sgivwfb",
852 .bus = &platform_bus_type,
853 .probe = sgivwfb_probe, 850 .probe = sgivwfb_probe,
854 .remove = sgivwfb_remove, 851 .remove = sgivwfb_remove,
852 .driver = {
853 .name = "sgivwfb",
854 },
855}; 855};
856 856
857static struct platform_device *sgivwfb_device; 857static struct platform_device *sgivwfb_device;
@@ -867,7 +867,7 @@ int __init sgivwfb_init(void)
867 return -ENODEV; 867 return -ENODEV;
868 sgivwfb_setup(option); 868 sgivwfb_setup(option);
869#endif 869#endif
870 ret = driver_register(&sgivwfb_driver); 870 ret = platform_driver_register(&sgivwfb_driver);
871 if (!ret) { 871 if (!ret) {
872 sgivwfb_device = platform_device_alloc("sgivwfb", 0); 872 sgivwfb_device = platform_device_alloc("sgivwfb", 0);
873 if (sgivwfb_device) { 873 if (sgivwfb_device) {
@@ -875,7 +875,7 @@ int __init sgivwfb_init(void)
875 } else 875 } else
876 ret = -ENOMEM; 876 ret = -ENOMEM;
877 if (ret) { 877 if (ret) {
878 driver_unregister(&sgivwfb_driver); 878 platform_driver_unregister(&sgivwfb_driver);
879 platform_device_put(sgivwfb_device); 879 platform_device_put(sgivwfb_device);
880 } 880 }
881 } 881 }
@@ -890,7 +890,7 @@ MODULE_LICENSE("GPL");
890static void __exit sgivwfb_exit(void) 890static void __exit sgivwfb_exit(void)
891{ 891{
892 platform_device_unregister(sgivwfb_device); 892 platform_device_unregister(sgivwfb_device);
893 driver_unregister(&sgivwfb_driver); 893 platform_driver_unregister(&sgivwfb_driver);
894} 894}
895 895
896module_exit(sgivwfb_exit); 896module_exit(sgivwfb_exit);
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index e25eae1a78c1..2c3aa2fcfd91 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -245,9 +245,8 @@ static int __init vesafb_setup(char *options)
245 return 0; 245 return 0;
246} 246}
247 247
248static int __init vesafb_probe(struct device *device) 248static int __init vesafb_probe(struct platform_device *dev)
249{ 249{
250 struct platform_device *dev = to_platform_device(device);
251 struct fb_info *info; 250 struct fb_info *info;
252 int i, err; 251 int i, err;
253 unsigned int size_vmode; 252 unsigned int size_vmode;
@@ -480,10 +479,11 @@ err:
480 return err; 479 return err;
481} 480}
482 481
483static struct device_driver vesafb_driver = { 482static struct platform_driver vesafb_driver = {
484 .name = "vesafb",
485 .bus = &platform_bus_type,
486 .probe = vesafb_probe, 483 .probe = vesafb_probe,
484 .driver = {
485 .name = "vesafb",
486 },
487}; 487};
488 488
489static struct platform_device vesafb_device = { 489static struct platform_device vesafb_device = {
@@ -498,12 +498,12 @@ static int __init vesafb_init(void)
498 /* ignore error return of fb_get_options */ 498 /* ignore error return of fb_get_options */
499 fb_get_options("vesafb", &option); 499 fb_get_options("vesafb", &option);
500 vesafb_setup(option); 500 vesafb_setup(option);
501 ret = driver_register(&vesafb_driver); 501 ret = platform_driver_register(&vesafb_driver);
502 502
503 if (!ret) { 503 if (!ret) {
504 ret = platform_device_register(&vesafb_device); 504 ret = platform_device_register(&vesafb_device);
505 if (ret) 505 if (ret)
506 driver_unregister(&vesafb_driver); 506 platform_driver_unregister(&vesafb_driver);
507 } 507 }
508 return ret; 508 return ret;
509} 509}
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c
index 8794dc5d2466..ffa1ad474226 100644
--- a/drivers/video/vfb.c
+++ b/drivers/video/vfb.c
@@ -403,9 +403,8 @@ static void vfb_platform_release(struct device *device)
403 // This is called when the reference count goes to zero. 403 // This is called when the reference count goes to zero.
404} 404}
405 405
406static int __init vfb_probe(struct device *device) 406static int __init vfb_probe(struct platform_device *dev)
407{ 407{
408 struct platform_device *dev = to_platform_device(device);
409 struct fb_info *info; 408 struct fb_info *info;
410 int retval = -ENOMEM; 409 int retval = -ENOMEM;
411 410
@@ -447,7 +446,7 @@ static int __init vfb_probe(struct device *device)
447 retval = register_framebuffer(info); 446 retval = register_framebuffer(info);
448 if (retval < 0) 447 if (retval < 0)
449 goto err2; 448 goto err2;
450 dev_set_drvdata(&dev->dev, info); 449 platform_set_drvdata(dev, info);
451 450
452 printk(KERN_INFO 451 printk(KERN_INFO
453 "fb%d: Virtual frame buffer device, using %ldK of video memory\n", 452 "fb%d: Virtual frame buffer device, using %ldK of video memory\n",
@@ -462,9 +461,9 @@ err:
462 return retval; 461 return retval;
463} 462}
464 463
465static int vfb_remove(struct device *device) 464static int vfb_remove(struct platform_device *dev)
466{ 465{
467 struct fb_info *info = dev_get_drvdata(device); 466 struct fb_info *info = platform_get_drvdata(dev);
468 467
469 if (info) { 468 if (info) {
470 unregister_framebuffer(info); 469 unregister_framebuffer(info);
@@ -474,11 +473,12 @@ static int vfb_remove(struct device *device)
474 return 0; 473 return 0;
475} 474}
476 475
477static struct device_driver vfb_driver = { 476static struct platform_driver vfb_driver = {
478 .name = "vfb",
479 .bus = &platform_bus_type,
480 .probe = vfb_probe, 477 .probe = vfb_probe,
481 .remove = vfb_remove, 478 .remove = vfb_remove,
479 .driver = {
480 .name = "vfb",
481 },
482}; 482};
483 483
484static struct platform_device vfb_device = { 484static struct platform_device vfb_device = {
@@ -504,12 +504,12 @@ static int __init vfb_init(void)
504 if (!vfb_enable) 504 if (!vfb_enable)
505 return -ENXIO; 505 return -ENXIO;
506 506
507 ret = driver_register(&vfb_driver); 507 ret = platform_driver_register(&vfb_driver);
508 508
509 if (!ret) { 509 if (!ret) {
510 ret = platform_device_register(&vfb_device); 510 ret = platform_device_register(&vfb_device);
511 if (ret) 511 if (ret)
512 driver_unregister(&vfb_driver); 512 platform_driver_unregister(&vfb_driver);
513 } 513 }
514 return ret; 514 return ret;
515} 515}
@@ -520,7 +520,7 @@ module_init(vfb_init);
520static void __exit vfb_exit(void) 520static void __exit vfb_exit(void)
521{ 521{
522 platform_device_unregister(&vfb_device); 522 platform_device_unregister(&vfb_device);
523 driver_unregister(&vfb_driver); 523 platform_driver_unregister(&vfb_driver);
524} 524}
525 525
526module_exit(vfb_exit); 526module_exit(vfb_exit);
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index 48e70f153c4b..daa46051f55d 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -437,9 +437,9 @@ static void w100fb_restore_vidmem(struct w100fb_par *par)
437 } 437 }
438} 438}
439 439
440static int w100fb_suspend(struct device *dev, pm_message_t state) 440static int w100fb_suspend(struct platform_device *dev, pm_message_t state)
441{ 441{
442 struct fb_info *info = dev_get_drvdata(dev); 442 struct fb_info *info = platform_get_drvdata(dev);
443 struct w100fb_par *par=info->par; 443 struct w100fb_par *par=info->par;
444 struct w100_tg_info *tg = par->mach->tg; 444 struct w100_tg_info *tg = par->mach->tg;
445 445
@@ -452,9 +452,9 @@ static int w100fb_suspend(struct device *dev, pm_message_t state)
452 return 0; 452 return 0;
453} 453}
454 454
455static int w100fb_resume(struct device *dev) 455static int w100fb_resume(struct platform_device *dev)
456{ 456{
457 struct fb_info *info = dev_get_drvdata(dev); 457 struct fb_info *info = platform_get_drvdata(dev);
458 struct w100fb_par *par=info->par; 458 struct w100fb_par *par=info->par;
459 struct w100_tg_info *tg = par->mach->tg; 459 struct w100_tg_info *tg = par->mach->tg;
460 460
@@ -473,13 +473,12 @@ static int w100fb_resume(struct device *dev)
473#endif 473#endif
474 474
475 475
476int __init w100fb_probe(struct device *dev) 476int __init w100fb_probe(struct platform_device *pdev)
477{ 477{
478 int err = -EIO; 478 int err = -EIO;
479 struct w100fb_mach_info *inf; 479 struct w100fb_mach_info *inf;
480 struct fb_info *info = NULL; 480 struct fb_info *info = NULL;
481 struct w100fb_par *par; 481 struct w100fb_par *par;
482 struct platform_device *pdev = to_platform_device(dev);
483 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 482 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
484 unsigned int chip_id; 483 unsigned int chip_id;
485 484
@@ -522,9 +521,9 @@ int __init w100fb_probe(struct device *dev)
522 } 521 }
523 522
524 par = info->par; 523 par = info->par;
525 dev_set_drvdata(dev, info); 524 platform_set_drvdata(pdev, info);
526 525
527 inf = dev->platform_data; 526 inf = pdev->dev.platform_data;
528 par->chip_id = chip_id; 527 par->chip_id = chip_id;
529 par->mach = inf; 528 par->mach = inf;
530 par->fastpll_mode = 0; 529 par->fastpll_mode = 0;
@@ -600,10 +599,10 @@ int __init w100fb_probe(struct device *dev)
600 goto out; 599 goto out;
601 } 600 }
602 601
603 device_create_file(dev, &dev_attr_fastpllclk); 602 device_create_file(&pdev->dev, &dev_attr_fastpllclk);
604 device_create_file(dev, &dev_attr_reg_read); 603 device_create_file(&pdev->dev, &dev_attr_reg_read);
605 device_create_file(dev, &dev_attr_reg_write); 604 device_create_file(&pdev->dev, &dev_attr_reg_write);
606 device_create_file(dev, &dev_attr_flip); 605 device_create_file(&pdev->dev, &dev_attr_flip);
607 606
608 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); 607 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
609 return 0; 608 return 0;
@@ -622,15 +621,15 @@ out:
622} 621}
623 622
624 623
625static int w100fb_remove(struct device *dev) 624static int w100fb_remove(struct platform_device *pdev)
626{ 625{
627 struct fb_info *info = dev_get_drvdata(dev); 626 struct fb_info *info = platform_get_drvdata(pdev);
628 struct w100fb_par *par=info->par; 627 struct w100fb_par *par=info->par;
629 628
630 device_remove_file(dev, &dev_attr_fastpllclk); 629 device_remove_file(&pdev->dev, &dev_attr_fastpllclk);
631 device_remove_file(dev, &dev_attr_reg_read); 630 device_remove_file(&pdev->dev, &dev_attr_reg_read);
632 device_remove_file(dev, &dev_attr_reg_write); 631 device_remove_file(&pdev->dev, &dev_attr_reg_write);
633 device_remove_file(dev, &dev_attr_flip); 632 device_remove_file(&pdev->dev, &dev_attr_flip);
634 633
635 unregister_framebuffer(info); 634 unregister_framebuffer(info);
636 635
@@ -1448,23 +1447,24 @@ static void w100_vsync(void)
1448 writel(0x00000002, remapped_regs + mmGEN_INT_STATUS); 1447 writel(0x00000002, remapped_regs + mmGEN_INT_STATUS);
1449} 1448}
1450 1449
1451static struct device_driver w100fb_driver = { 1450static struct platform_driver w100fb_driver = {
1452 .name = "w100fb",
1453 .bus = &platform_bus_type,
1454 .probe = w100fb_probe, 1451 .probe = w100fb_probe,
1455 .remove = w100fb_remove, 1452 .remove = w100fb_remove,
1456 .suspend = w100fb_suspend, 1453 .suspend = w100fb_suspend,
1457 .resume = w100fb_resume, 1454 .resume = w100fb_resume,
1455 .driver = {
1456 .name = "w100fb",
1457 },
1458}; 1458};
1459 1459
1460int __devinit w100fb_init(void) 1460int __devinit w100fb_init(void)
1461{ 1461{
1462 return driver_register(&w100fb_driver); 1462 return platform_driver_register(&w100fb_driver);
1463} 1463}
1464 1464
1465void __exit w100fb_cleanup(void) 1465void __exit w100fb_cleanup(void)
1466{ 1466{
1467 driver_unregister(&w100fb_driver); 1467 platform_driver_unregister(&w100fb_driver);
1468} 1468}
1469 1469
1470module_init(w100fb_init); 1470module_init(w100fb_init);
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index d1f9da498729..c96c8a2aa1c2 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -275,9 +275,9 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card)
275 return 0; 275 return 0;
276} 276}
277 277
278static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) 278static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state)
279{ 279{
280 snd_card_t *card = dev_get_drvdata(_dev); 280 snd_card_t *card = platform_get_drvdata(dev);
281 int ret = 0; 281 int ret = 0;
282 282
283 if (card) 283 if (card)
@@ -286,9 +286,9 @@ static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state)
286 return ret; 286 return ret;
287} 287}
288 288
289static int pxa2xx_ac97_resume(struct device *_dev) 289static int pxa2xx_ac97_resume(struct platform_device *dev)
290{ 290{
291 snd_card_t *card = dev_get_drvdata(_dev); 291 snd_card_t *card = platform_get_drvdata(dev);
292 int ret = 0; 292 int ret = 0;
293 293
294 if (card) 294 if (card)
@@ -302,7 +302,7 @@ static int pxa2xx_ac97_resume(struct device *_dev)
302#define pxa2xx_ac97_resume NULL 302#define pxa2xx_ac97_resume NULL
303#endif 303#endif
304 304
305static int pxa2xx_ac97_probe(struct device *dev) 305static int pxa2xx_ac97_probe(struct platform_device *dev)
306{ 306{
307 snd_card_t *card; 307 snd_card_t *card;
308 ac97_bus_t *ac97_bus; 308 ac97_bus_t *ac97_bus;
@@ -315,8 +315,8 @@ static int pxa2xx_ac97_probe(struct device *dev)
315 if (!card) 315 if (!card)
316 goto err; 316 goto err;
317 317
318 card->dev = dev; 318 card->dev = &dev->dev;
319 strncpy(card->driver, dev->driver->name, sizeof(card->driver)); 319 strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
320 320
321 ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); 321 ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
322 if (ret) 322 if (ret)
@@ -347,13 +347,13 @@ static int pxa2xx_ac97_probe(struct device *dev)
347 snprintf(card->shortname, sizeof(card->shortname), 347 snprintf(card->shortname, sizeof(card->shortname),
348 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97)); 348 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
349 snprintf(card->longname, sizeof(card->longname), 349 snprintf(card->longname, sizeof(card->longname),
350 "%s (%s)", dev->driver->name, card->mixername); 350 "%s (%s)", dev->dev.driver->name, card->mixername);
351 351
352 snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, 352 snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend,
353 pxa2xx_ac97_do_resume, NULL); 353 pxa2xx_ac97_do_resume, NULL);
354 ret = snd_card_register(card); 354 ret = snd_card_register(card);
355 if (ret == 0) { 355 if (ret == 0) {
356 dev_set_drvdata(dev, card); 356 platform_set_drvdata(dev, card);
357 return 0; 357 return 0;
358 } 358 }
359 359
@@ -368,13 +368,13 @@ static int pxa2xx_ac97_probe(struct device *dev)
368 return ret; 368 return ret;
369} 369}
370 370
371static int pxa2xx_ac97_remove(struct device *dev) 371static int pxa2xx_ac97_remove(struct platform_device *dev)
372{ 372{
373 snd_card_t *card = dev_get_drvdata(dev); 373 snd_card_t *card = platform_get_drvdata(dev);
374 374
375 if (card) { 375 if (card) {
376 snd_card_free(card); 376 snd_card_free(card);
377 dev_set_drvdata(dev, NULL); 377 platform_set_drvdata(dev, NULL);
378 GCR |= GCR_ACLINK_OFF; 378 GCR |= GCR_ACLINK_OFF;
379 free_irq(IRQ_AC97, NULL); 379 free_irq(IRQ_AC97, NULL);
380 pxa_set_cken(CKEN2_AC97, 0); 380 pxa_set_cken(CKEN2_AC97, 0);
@@ -383,23 +383,24 @@ static int pxa2xx_ac97_remove(struct device *dev)
383 return 0; 383 return 0;
384} 384}
385 385
386static struct device_driver pxa2xx_ac97_driver = { 386static struct platform_driver pxa2xx_ac97_driver = {
387 .name = "pxa2xx-ac97",
388 .bus = &platform_bus_type,
389 .probe = pxa2xx_ac97_probe, 387 .probe = pxa2xx_ac97_probe,
390 .remove = pxa2xx_ac97_remove, 388 .remove = pxa2xx_ac97_remove,
391 .suspend = pxa2xx_ac97_suspend, 389 .suspend = pxa2xx_ac97_suspend,
392 .resume = pxa2xx_ac97_resume, 390 .resume = pxa2xx_ac97_resume,
391 .driver = {
392 .name = "pxa2xx-ac97",
393 },
393}; 394};
394 395
395static int __init pxa2xx_ac97_init(void) 396static int __init pxa2xx_ac97_init(void)
396{ 397{
397 return driver_register(&pxa2xx_ac97_driver); 398 return platform_driver_register(&pxa2xx_ac97_driver);
398} 399}
399 400
400static void __exit pxa2xx_ac97_exit(void) 401static void __exit pxa2xx_ac97_exit(void)
401{ 402{
402 driver_unregister(&pxa2xx_ac97_driver); 403 platform_driver_unregister(&pxa2xx_ac97_driver);
403} 404}
404 405
405module_init(pxa2xx_ac97_init); 406module_init(pxa2xx_ac97_init);
diff --git a/sound/core/init.c b/sound/core/init.c
index d9ee27ae9a51..33813f92ab52 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -674,23 +674,24 @@ struct snd_generic_device {
674 snd_card_t *card; 674 snd_card_t *card;
675}; 675};
676 676
677#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card 677#define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card
678 678
679#define SND_GENERIC_NAME "snd_generic" 679#define SND_GENERIC_NAME "snd_generic"
680 680
681#ifdef CONFIG_PM 681#ifdef CONFIG_PM
682static int snd_generic_suspend(struct device *dev, pm_message_t state); 682static int snd_generic_suspend(struct platform_device *dev, pm_message_t state);
683static int snd_generic_resume(struct device *dev); 683static int snd_generic_resume(struct platform_device *dev);
684#endif 684#endif
685 685
686/* initialized in sound.c */ 686/* initialized in sound.c */
687struct device_driver snd_generic_driver = { 687struct platform_driver snd_generic_driver = {
688 .name = SND_GENERIC_NAME,
689 .bus = &platform_bus_type,
690#ifdef CONFIG_PM 688#ifdef CONFIG_PM
691 .suspend = snd_generic_suspend, 689 .suspend = snd_generic_suspend,
692 .resume = snd_generic_resume, 690 .resume = snd_generic_resume,
693#endif 691#endif
692 .driver = {
693 .name = SND_GENERIC_NAME,
694 },
694}; 695};
695 696
696void snd_generic_device_release(struct device *dev) 697void snd_generic_device_release(struct device *dev)
@@ -821,7 +822,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
821 822
822#ifdef CONFIG_SND_GENERIC_DRIVER 823#ifdef CONFIG_SND_GENERIC_DRIVER
823/* suspend/resume callbacks for snd_generic platform device */ 824/* suspend/resume callbacks for snd_generic platform device */
824static int snd_generic_suspend(struct device *dev, pm_message_t state) 825static int snd_generic_suspend(struct platform_device *dev, pm_message_t state)
825{ 826{
826 snd_card_t *card; 827 snd_card_t *card;
827 828
@@ -834,7 +835,7 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state)
834 return 0; 835 return 0;
835} 836}
836 837
837static int snd_generic_resume(struct device *dev) 838static int snd_generic_resume(struct platform_device *dev)
838{ 839{
839 snd_card_t *card; 840 snd_card_t *card;
840 841
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 1139dd8ca8eb..6e7cad1e947e 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -32,7 +32,7 @@
32#include <sound/initval.h> 32#include <sound/initval.h>
33#include <linux/kmod.h> 33#include <linux/kmod.h>
34#include <linux/devfs_fs_kernel.h> 34#include <linux/devfs_fs_kernel.h>
35#include <linux/device.h> 35#include <linux/platform_device.h>
36 36
37#define SNDRV_OS_MINORS 256 37#define SNDRV_OS_MINORS 256
38 38
@@ -329,7 +329,7 @@ int __exit snd_minor_info_done(void)
329 */ 329 */
330 330
331#ifdef CONFIG_SND_GENERIC_DRIVER 331#ifdef CONFIG_SND_GENERIC_DRIVER
332extern struct device_driver snd_generic_driver; 332extern struct platform_driver snd_generic_driver;
333#endif 333#endif
334 334
335static int __init alsa_sound_init(void) 335static int __init alsa_sound_init(void)
@@ -357,7 +357,7 @@ static int __init alsa_sound_init(void)
357 } 357 }
358 snd_info_minor_register(); 358 snd_info_minor_register();
359#ifdef CONFIG_SND_GENERIC_DRIVER 359#ifdef CONFIG_SND_GENERIC_DRIVER
360 driver_register(&snd_generic_driver); 360 platform_driver_register(&snd_generic_driver);
361#endif 361#endif
362 for (controlnum = 0; controlnum < cards_limit; controlnum++) 362 for (controlnum = 0; controlnum < cards_limit; controlnum++)
363 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); 363 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
@@ -375,7 +375,7 @@ static void __exit alsa_sound_exit(void)
375 devfs_remove("snd/controlC%d", controlnum); 375 devfs_remove("snd/controlC%d", controlnum);
376 376
377#ifdef CONFIG_SND_GENERIC_DRIVER 377#ifdef CONFIG_SND_GENERIC_DRIVER
378 driver_unregister(&snd_generic_driver); 378 platform_driver_unregister(&snd_generic_driver);
379#endif 379#endif
380 snd_info_minor_unregister(); 380 snd_info_minor_unregister();
381 snd_info_done(); 381 snd_info_done();