diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/net | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/depca.c | 26 | ||||
-rw-r--r-- | drivers/net/dm9000.c | 35 | ||||
-rw-r--r-- | drivers/net/gianfar.c | 28 | ||||
-rw-r--r-- | drivers/net/irda/sa1100_ir.c | 28 | ||||
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 27 | ||||
-rw-r--r-- | drivers/net/jazzsonic.c | 21 | ||||
-rw-r--r-- | drivers/net/macsonic.c | 21 | ||||
-rw-r--r-- | drivers/net/mv643xx_eth.c | 40 | ||||
-rw-r--r-- | drivers/net/smc91x.c | 38 | ||||
-rw-r--r-- | drivers/net/tokenring/proteon.c | 17 | ||||
-rw-r--r-- | drivers/net/tokenring/skisa.c | 17 |
11 files changed, 153 insertions, 145 deletions
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 | ||
401 | static int depca_isa_probe (struct device *); | 401 | static int depca_isa_probe (struct platform_device *); |
402 | 402 | ||
403 | static struct device_driver depca_isa_driver = { | 403 | static 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 | |||
408 | static 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 | ||
1528 | static int __init depca_isa_probe (struct device *device) | 1534 | static 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 ------------------------------------- */ |
152 | static int dm9000_probe(struct device *); | 152 | static int dm9000_probe(struct platform_device *); |
153 | static int dm9000_open(struct net_device *); | 153 | static int dm9000_open(struct net_device *); |
154 | static int dm9000_start_xmit(struct sk_buff *, struct net_device *); | 154 | static int dm9000_start_xmit(struct sk_buff *, struct net_device *); |
155 | static int dm9000_stop(struct net_device *); | 155 | static 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 | */ |
381 | static int | 381 | static int |
382 | dm9000_probe(struct device *dev) | 382 | dm9000_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 | ||
1143 | static int | 1142 | static int |
1144 | dm9000_drv_suspend(struct device *dev, pm_message_t state) | 1143 | dm9000_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 | ||
1157 | static int | 1156 | static int |
1158 | dm9000_drv_resume(struct device *dev) | 1157 | dm9000_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 | ||
1175 | static int | 1174 | static int |
1176 | dm9000_drv_remove(struct device *dev) | 1175 | dm9000_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 | ||
1192 | static struct device_driver dm9000_driver = { | 1190 | static 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 | ||
1201 | static int __init | 1200 | static 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 | ||
1209 | static void __exit | 1208 | static void __exit |
1210 | dm9000_cleanup(void) | 1209 | dm9000_cleanup(void) |
1211 | { | 1210 | { |
1212 | driver_unregister(&dm9000_driver); | 1211 | platform_driver_unregister(&dm9000_driver); |
1213 | } | 1212 | } |
1214 | 1213 | ||
1215 | module_init(dm9000_init); | 1214 | module_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); | |||
127 | static void adjust_link(struct net_device *dev); | 127 | static void adjust_link(struct net_device *dev); |
128 | static void init_registers(struct net_device *dev); | 128 | static void init_registers(struct net_device *dev); |
129 | static int init_phy(struct net_device *dev); | 129 | static int init_phy(struct net_device *dev); |
130 | static int gfar_probe(struct device *device); | 130 | static int gfar_probe(struct platform_device *pdev); |
131 | static int gfar_remove(struct device *device); | 131 | static int gfar_remove(struct platform_device *pdev); |
132 | static void free_skb_resources(struct gfar_private *priv); | 132 | static void free_skb_resources(struct gfar_private *priv); |
133 | static void gfar_set_multi(struct net_device *dev); | 133 | static void gfar_set_multi(struct net_device *dev); |
134 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 134 | static 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 */ |
160 | static int gfar_probe(struct device *device) | 160 | static 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 | ||
381 | static int gfar_remove(struct device *device) | 380 | static 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 */ |
1865 | static struct device_driver gfar_driver = { | 1864 | static 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 | ||
1872 | static int __init gfar_init(void) | 1872 | static 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 | ||
1887 | static void __exit gfar_exit(void) | 1887 | static 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 | */ |
294 | static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | 294 | static 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 | */ |
319 | static int sa1100_irda_resume(struct device *_dev) | 319 | static 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 | ||
889 | static int sa1100_irda_probe(struct device *_dev) | 889 | static 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 | ||
988 | static int sa1100_irda_remove(struct device *_dev) | 987 | static 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 | ||
1007 | static struct device_driver sa1100ir_driver = { | 1006 | static 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 | ||
1016 | static int __init sa1100_irda_init(void) | 1016 | static 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 | ||
1029 | static void __exit sa1100_irda_exit(void) | 1029 | static void __exit sa1100_irda_exit(void) |
1030 | { | 1030 | { |
1031 | driver_unregister(&sa1100ir_driver); | 1031 | platform_driver_unregister(&sa1100ir_driver); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | module_init(sa1100_irda_init); | 1034 | module_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 | ||
217 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state); | 217 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state); |
218 | static int smsc_ircc_resume(struct device *dev); | 218 | static int smsc_ircc_resume(struct platform_device *dev); |
219 | 219 | ||
220 | static struct device_driver smsc_ircc_driver = { | 220 | static 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 | ||
1688 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | 1689 | static 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 | ||
1709 | static int smsc_ircc_resume(struct device *dev) | 1710 | static 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 | */ |
197 | static int __init jazz_sonic_probe(struct device *device) | 197 | static 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 | ||
267 | static int __devexit jazz_sonic_device_remove (struct device *device) | 267 | static 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 | ||
281 | static struct device_driver jazz_sonic_driver = { | 281 | static 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 | ||
288 | static int __init jazz_sonic_init_module(void) | 289 | static 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 | ||
314 | static void __exit jazz_sonic_cleanup_module(void) | 315 | static 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 | ||
528 | static int __init mac_sonic_probe(struct device *device) | 528 | static 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 | ||
582 | static int __devexit mac_sonic_device_remove (struct device *device) | 582 | static 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 | ||
595 | static struct device_driver mac_sonic_driver = { | 595 | static 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 | ||
602 | static int __init mac_sonic_init_module(void) | 603 | static 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 | ||
629 | static void __exit mac_sonic_cleanup_module(void) | 630 | static 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 | */ |
1390 | static int mv643xx_eth_probe(struct device *ddev) | 1390 | static 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 | ||
1549 | static int mv643xx_eth_remove(struct device *ddev) | 1548 | static 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 | ||
1561 | static int mv643xx_eth_shared_probe(struct device *ddev) | 1560 | static 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 | ||
1581 | static int mv643xx_eth_shared_remove(struct device *ddev) | 1579 | static 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 | ||
1589 | static struct device_driver mv643xx_eth_driver = { | 1587 | static 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 | ||
1596 | static struct device_driver mv643xx_eth_shared_driver = { | 1595 | static 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 | */ |
1634 | static void __exit mv643xx_cleanup_module(void) | 1634 | static 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 | ||
1640 | module_init(mv643xx_init_module); | 1640 | module_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 | */ |
2186 | static int smc_drv_probe(struct device *dev) | 2186 | static 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 | ||
2266 | static int smc_drv_remove(struct device *dev) | 2265 | static 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 | ||
2298 | static int smc_drv_suspend(struct device *dev, pm_message_t state) | 2296 | static 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 | ||
2312 | static int smc_drv_resume(struct device *dev) | 2310 | static 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 | ||
2331 | static struct device_driver smc_driver = { | 2328 | static 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 | ||
2340 | static int __init smc_init(void) | 2338 | static 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 | ||
2354 | static void __exit smc_cleanup(void) | 2352 | static void __exit smc_cleanup(void) |
2355 | { | 2353 | { |
2356 | driver_unregister(&smc_driver); | 2354 | platform_driver_unregister(&smc_driver); |
2357 | } | 2355 | } |
2358 | 2356 | ||
2359 | module_init(smc_init); | 2357 | module_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 | ||
345 | static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; | 345 | static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; |
346 | 346 | ||
347 | static struct device_driver proteon_driver = { | 347 | static struct platform_driver proteon_driver = { |
348 | .name = "proteon", | 348 | .driver = { |
349 | .bus = &platform_bus_type, | 349 | .name = "proteon", |
350 | }, | ||
350 | }; | 351 | }; |
351 | 352 | ||
352 | static int __init proteon_init(void) | 353 | static 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 | ||
415 | module_init(proteon_init); | 416 | module_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 | ||
355 | static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; | 355 | static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; |
356 | 356 | ||
357 | static struct device_driver sk_isa_driver = { | 357 | static struct platform_driver sk_isa_driver = { |
358 | .name = "skisa", | 358 | .driver = { |
359 | .bus = &platform_bus_type, | 359 | .name = "skisa", |
360 | }, | ||
360 | }; | 361 | }; |
361 | 362 | ||
362 | static int __init sk_isa_init(void) | 363 | static 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 | ||
425 | module_init(sk_isa_init); | 426 | module_init(sk_isa_init); |