diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-30 08:19:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-01 18:21:55 -0400 |
commit | 1aec5bdfed91b50aedbcad43393bcb05033c7ef3 (patch) | |
tree | 258db4a51298bc18f859170e8d611a8e3b406b0f /drivers/net | |
parent | aba7453037c3a90714caae77a622dceaf1173786 (diff) |
net: remove driver_data direct access of struct device
In the near future, the driver core is going to not allow direct access
to the driver_data pointer in struct device. Instead, the functions
dev_get_drvdata() and dev_set_drvdata() should be used. These functions
have been around since the beginning, so are backwards compatible with
all older kernel versions.
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/3c509.c | 12 | ||||
-rw-r--r-- | drivers/net/depca.c | 4 | ||||
-rw-r--r-- | drivers/net/hp100.c | 4 | ||||
-rw-r--r-- | drivers/net/ne3210.c | 4 | ||||
-rw-r--r-- | drivers/net/smc-mca.c | 4 | ||||
-rw-r--r-- | drivers/net/tulip/de4x5.c | 6 | ||||
-rw-r--r-- | drivers/net/usb/hso.c | 4 |
7 files changed, 19 insertions, 19 deletions
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index fbb371921991..393e4e711965 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -653,11 +653,11 @@ static int __init el3_mca_probe(struct device *device) | |||
653 | netdev_boot_setup_check(dev); | 653 | netdev_boot_setup_check(dev); |
654 | 654 | ||
655 | el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA); | 655 | el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA); |
656 | device->driver_data = dev; | 656 | dev_set_drvdata(device, dev); |
657 | err = el3_common_init(dev); | 657 | err = el3_common_init(dev); |
658 | 658 | ||
659 | if (err) { | 659 | if (err) { |
660 | device->driver_data = NULL; | 660 | dev_set_drvdata(device, NULL); |
661 | free_netdev(dev); | 661 | free_netdev(dev); |
662 | return -ENOMEM; | 662 | return -ENOMEM; |
663 | } | 663 | } |
@@ -721,12 +721,12 @@ static int __init el3_eisa_probe (struct device *device) | |||
721 | 721 | ||
722 | /* This remove works for all device types. | 722 | /* This remove works for all device types. |
723 | * | 723 | * |
724 | * The net dev must be stored in the driver_data field */ | 724 | * The net dev must be stored in the driver data field */ |
725 | static int __devexit el3_device_remove (struct device *device) | 725 | static int __devexit el3_device_remove (struct device *device) |
726 | { | 726 | { |
727 | struct net_device *dev; | 727 | struct net_device *dev; |
728 | 728 | ||
729 | dev = device->driver_data; | 729 | dev = dev_get_drvdata(device); |
730 | 730 | ||
731 | el3_common_remove (dev); | 731 | el3_common_remove (dev); |
732 | return 0; | 732 | return 0; |
@@ -1451,7 +1451,7 @@ el3_suspend(struct device *pdev, pm_message_t state) | |||
1451 | struct el3_private *lp; | 1451 | struct el3_private *lp; |
1452 | int ioaddr; | 1452 | int ioaddr; |
1453 | 1453 | ||
1454 | dev = pdev->driver_data; | 1454 | dev = dev_get_drvdata(pdev); |
1455 | lp = netdev_priv(dev); | 1455 | lp = netdev_priv(dev); |
1456 | ioaddr = dev->base_addr; | 1456 | ioaddr = dev->base_addr; |
1457 | 1457 | ||
@@ -1475,7 +1475,7 @@ el3_resume(struct device *pdev) | |||
1475 | struct el3_private *lp; | 1475 | struct el3_private *lp; |
1476 | int ioaddr; | 1476 | int ioaddr; |
1477 | 1477 | ||
1478 | dev = pdev->driver_data; | 1478 | dev = dev_get_drvdata(pdev); |
1479 | lp = netdev_priv(dev); | 1479 | lp = netdev_priv(dev); |
1480 | ioaddr = dev->base_addr; | 1480 | ioaddr = dev->base_addr; |
1481 | 1481 | ||
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 357f565851ed..9301eb28d9e2 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -810,7 +810,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) | |||
810 | 810 | ||
811 | dev->mem_start = 0; | 811 | dev->mem_start = 0; |
812 | 812 | ||
813 | device->driver_data = dev; | 813 | dev_set_drvdata(device, dev); |
814 | SET_NETDEV_DEV (dev, device); | 814 | SET_NETDEV_DEV (dev, device); |
815 | 815 | ||
816 | status = register_netdev(dev); | 816 | status = register_netdev(dev); |
@@ -1614,7 +1614,7 @@ static int __devexit depca_device_remove (struct device *device) | |||
1614 | struct depca_private *lp; | 1614 | struct depca_private *lp; |
1615 | int bus; | 1615 | int bus; |
1616 | 1616 | ||
1617 | dev = device->driver_data; | 1617 | dev = dev_get_drvdata(device); |
1618 | lp = netdev_priv(dev); | 1618 | lp = netdev_priv(dev); |
1619 | 1619 | ||
1620 | unregister_netdev (dev); | 1620 | unregister_netdev (dev); |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index de3f49f991a3..8feda9fe8297 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -2864,7 +2864,7 @@ static int __init hp100_eisa_probe (struct device *gendev) | |||
2864 | printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, | 2864 | printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, |
2865 | dev->base_addr); | 2865 | dev->base_addr); |
2866 | #endif | 2866 | #endif |
2867 | gendev->driver_data = dev; | 2867 | dev_set_drvdata(gendev, dev); |
2868 | return 0; | 2868 | return 0; |
2869 | out1: | 2869 | out1: |
2870 | free_netdev(dev); | 2870 | free_netdev(dev); |
@@ -2873,7 +2873,7 @@ static int __init hp100_eisa_probe (struct device *gendev) | |||
2873 | 2873 | ||
2874 | static int __devexit hp100_eisa_remove (struct device *gendev) | 2874 | static int __devexit hp100_eisa_remove (struct device *gendev) |
2875 | { | 2875 | { |
2876 | struct net_device *dev = gendev->driver_data; | 2876 | struct net_device *dev = dev_get_drvdata(gendev); |
2877 | cleanup_dev(dev); | 2877 | cleanup_dev(dev); |
2878 | return 0; | 2878 | return 0; |
2879 | } | 2879 | } |
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c index 6a843f7350ab..a00bbfb9aed0 100644 --- a/drivers/net/ne3210.c +++ b/drivers/net/ne3210.c | |||
@@ -104,7 +104,7 @@ static int __init ne3210_eisa_probe (struct device *device) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | SET_NETDEV_DEV(dev, device); | 106 | SET_NETDEV_DEV(dev, device); |
107 | device->driver_data = dev; | 107 | dev_set_drvdata(device, dev); |
108 | ioaddr = edev->base_addr; | 108 | ioaddr = edev->base_addr; |
109 | 109 | ||
110 | if (!request_region(ioaddr, NE3210_IO_EXTENT, DRV_NAME)) { | 110 | if (!request_region(ioaddr, NE3210_IO_EXTENT, DRV_NAME)) { |
@@ -225,7 +225,7 @@ static int __init ne3210_eisa_probe (struct device *device) | |||
225 | 225 | ||
226 | static int __devexit ne3210_eisa_remove (struct device *device) | 226 | static int __devexit ne3210_eisa_remove (struct device *device) |
227 | { | 227 | { |
228 | struct net_device *dev = device->driver_data; | 228 | struct net_device *dev = dev_get_drvdata(device); |
229 | unsigned long ioaddr = to_eisa_device (device)->base_addr; | 229 | unsigned long ioaddr = to_eisa_device (device)->base_addr; |
230 | 230 | ||
231 | unregister_netdev (dev); | 231 | unregister_netdev (dev); |
diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c index 8d36d40649ef..c791ef76c1d6 100644 --- a/drivers/net/smc-mca.c +++ b/drivers/net/smc-mca.c | |||
@@ -370,7 +370,7 @@ static int __init ultramca_probe(struct device *gen_dev) | |||
370 | 370 | ||
371 | outb(reg4, ioaddr + 4); | 371 | outb(reg4, ioaddr + 4); |
372 | 372 | ||
373 | gen_dev->driver_data = dev; | 373 | dev_set_drvdata(gen_dev, dev); |
374 | 374 | ||
375 | /* The 8390 isn't at the base address, so fake the offset | 375 | /* The 8390 isn't at the base address, so fake the offset |
376 | */ | 376 | */ |
@@ -531,7 +531,7 @@ static int ultramca_close_card(struct net_device *dev) | |||
531 | static int ultramca_remove(struct device *gen_dev) | 531 | static int ultramca_remove(struct device *gen_dev) |
532 | { | 532 | { |
533 | struct mca_device *mca_dev = to_mca_device(gen_dev); | 533 | struct mca_device *mca_dev = to_mca_device(gen_dev); |
534 | struct net_device *dev = (struct net_device *)gen_dev->driver_data; | 534 | struct net_device *dev = dev_get_drvdata(gen_dev); |
535 | 535 | ||
536 | if (dev) { | 536 | if (dev) { |
537 | /* NB: ultra_close_card() does free_irq */ | 537 | /* NB: ultra_close_card() does free_irq */ |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index f9491bd787d1..32256179a205 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -1099,7 +1099,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1099 | struct pci_dev *pdev = NULL; | 1099 | struct pci_dev *pdev = NULL; |
1100 | int i, status=0; | 1100 | int i, status=0; |
1101 | 1101 | ||
1102 | gendev->driver_data = dev; | 1102 | dev_set_drvdata(gendev, dev); |
1103 | 1103 | ||
1104 | /* Ensure we're not sleeping */ | 1104 | /* Ensure we're not sleeping */ |
1105 | if (lp->bus == EISA) { | 1105 | if (lp->bus == EISA) { |
@@ -2094,7 +2094,7 @@ static int __devexit de4x5_eisa_remove (struct device *device) | |||
2094 | struct net_device *dev; | 2094 | struct net_device *dev; |
2095 | u_long iobase; | 2095 | u_long iobase; |
2096 | 2096 | ||
2097 | dev = device->driver_data; | 2097 | dev = dev_get_drvdata(device); |
2098 | iobase = dev->base_addr; | 2098 | iobase = dev->base_addr; |
2099 | 2099 | ||
2100 | unregister_netdev (dev); | 2100 | unregister_netdev (dev); |
@@ -2338,7 +2338,7 @@ static void __devexit de4x5_pci_remove (struct pci_dev *pdev) | |||
2338 | struct net_device *dev; | 2338 | struct net_device *dev; |
2339 | u_long iobase; | 2339 | u_long iobase; |
2340 | 2340 | ||
2341 | dev = pdev->dev.driver_data; | 2341 | dev = dev_get_drvdata(&pdev->dev); |
2342 | iobase = dev->base_addr; | 2342 | iobase = dev->base_addr; |
2343 | 2343 | ||
2344 | unregister_netdev (dev); | 2344 | unregister_netdev (dev); |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index d696e5fbc176..837135f0390a 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -482,7 +482,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev, | |||
482 | struct device_attribute *attr, | 482 | struct device_attribute *attr, |
483 | char *buf) | 483 | char *buf) |
484 | { | 484 | { |
485 | struct hso_device *hso_dev = dev->driver_data; | 485 | struct hso_device *hso_dev = dev_get_drvdata(dev); |
486 | char *port_name; | 486 | char *port_name; |
487 | 487 | ||
488 | if (!hso_dev) | 488 | if (!hso_dev) |
@@ -2313,7 +2313,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, | |||
2313 | serial->parent->dev = tty_register_device(tty_drv, minor, | 2313 | serial->parent->dev = tty_register_device(tty_drv, minor, |
2314 | &serial->parent->interface->dev); | 2314 | &serial->parent->interface->dev); |
2315 | dev = serial->parent->dev; | 2315 | dev = serial->parent->dev; |
2316 | dev->driver_data = serial->parent; | 2316 | dev_set_drvdata(dev, serial->parent); |
2317 | i = device_create_file(dev, &dev_attr_hsotype); | 2317 | i = device_create_file(dev, &dev_attr_hsotype); |
2318 | 2318 | ||
2319 | /* fill in specific data for later use */ | 2319 | /* fill in specific data for later use */ |