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/smc91x.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/smc91x.c')
-rw-r--r-- | drivers/net/smc91x.c | 38 |
1 files changed, 18 insertions, 20 deletions
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); |