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/dm9000.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net/dm9000.c')
-rw-r--r-- | drivers/net/dm9000.c | 35 |
1 files changed, 17 insertions, 18 deletions
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); |