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/gianfar.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/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 28 |
1 files changed, 14 insertions, 14 deletions
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 | ||