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>
This commit is contained in:
parent
aba7453037
commit
1aec5bdfed
@ -653,11 +653,11 @@ static int __init el3_mca_probe(struct device *device)
|
|||||||
netdev_boot_setup_check(dev);
|
netdev_boot_setup_check(dev);
|
||||||
|
|
||||||
el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA);
|
el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA);
|
||||||
device->driver_data = dev;
|
dev_set_drvdata(device, dev);
|
||||||
err = el3_common_init(dev);
|
err = el3_common_init(dev);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
device->driver_data = NULL;
|
dev_set_drvdata(device, NULL);
|
||||||
free_netdev(dev);
|
free_netdev(dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@ -721,12 +721,12 @@ static int __init el3_eisa_probe (struct device *device)
|
|||||||
|
|
||||||
/* This remove works for all device types.
|
/* This remove works for all device types.
|
||||||
*
|
*
|
||||||
* The net dev must be stored in the driver_data field */
|
* The net dev must be stored in the driver data field */
|
||||||
static int __devexit el3_device_remove (struct device *device)
|
static int __devexit el3_device_remove (struct device *device)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
|
|
||||||
dev = device->driver_data;
|
dev = dev_get_drvdata(device);
|
||||||
|
|
||||||
el3_common_remove (dev);
|
el3_common_remove (dev);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1451,7 +1451,7 @@ el3_suspend(struct device *pdev, pm_message_t state)
|
|||||||
struct el3_private *lp;
|
struct el3_private *lp;
|
||||||
int ioaddr;
|
int ioaddr;
|
||||||
|
|
||||||
dev = pdev->driver_data;
|
dev = dev_get_drvdata(pdev);
|
||||||
lp = netdev_priv(dev);
|
lp = netdev_priv(dev);
|
||||||
ioaddr = dev->base_addr;
|
ioaddr = dev->base_addr;
|
||||||
|
|
||||||
@ -1475,7 +1475,7 @@ el3_resume(struct device *pdev)
|
|||||||
struct el3_private *lp;
|
struct el3_private *lp;
|
||||||
int ioaddr;
|
int ioaddr;
|
||||||
|
|
||||||
dev = pdev->driver_data;
|
dev = dev_get_drvdata(pdev);
|
||||||
lp = netdev_priv(dev);
|
lp = netdev_priv(dev);
|
||||||
ioaddr = dev->base_addr;
|
ioaddr = dev->base_addr;
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
|
|||||||
|
|
||||||
dev->mem_start = 0;
|
dev->mem_start = 0;
|
||||||
|
|
||||||
device->driver_data = dev;
|
dev_set_drvdata(device, dev);
|
||||||
SET_NETDEV_DEV (dev, device);
|
SET_NETDEV_DEV (dev, device);
|
||||||
|
|
||||||
status = register_netdev(dev);
|
status = register_netdev(dev);
|
||||||
@ -1614,7 +1614,7 @@ static int __devexit depca_device_remove (struct device *device)
|
|||||||
struct depca_private *lp;
|
struct depca_private *lp;
|
||||||
int bus;
|
int bus;
|
||||||
|
|
||||||
dev = device->driver_data;
|
dev = dev_get_drvdata(device);
|
||||||
lp = netdev_priv(dev);
|
lp = netdev_priv(dev);
|
||||||
|
|
||||||
unregister_netdev (dev);
|
unregister_netdev (dev);
|
||||||
|
@ -2864,7 +2864,7 @@ static int __init hp100_eisa_probe (struct device *gendev)
|
|||||||
printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name,
|
printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name,
|
||||||
dev->base_addr);
|
dev->base_addr);
|
||||||
#endif
|
#endif
|
||||||
gendev->driver_data = dev;
|
dev_set_drvdata(gendev, dev);
|
||||||
return 0;
|
return 0;
|
||||||
out1:
|
out1:
|
||||||
free_netdev(dev);
|
free_netdev(dev);
|
||||||
@ -2873,7 +2873,7 @@ static int __init hp100_eisa_probe (struct device *gendev)
|
|||||||
|
|
||||||
static int __devexit hp100_eisa_remove (struct device *gendev)
|
static int __devexit hp100_eisa_remove (struct device *gendev)
|
||||||
{
|
{
|
||||||
struct net_device *dev = gendev->driver_data;
|
struct net_device *dev = dev_get_drvdata(gendev);
|
||||||
cleanup_dev(dev);
|
cleanup_dev(dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ static int __init ne3210_eisa_probe (struct device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SET_NETDEV_DEV(dev, device);
|
SET_NETDEV_DEV(dev, device);
|
||||||
device->driver_data = dev;
|
dev_set_drvdata(device, dev);
|
||||||
ioaddr = edev->base_addr;
|
ioaddr = edev->base_addr;
|
||||||
|
|
||||||
if (!request_region(ioaddr, NE3210_IO_EXTENT, DRV_NAME)) {
|
if (!request_region(ioaddr, NE3210_IO_EXTENT, DRV_NAME)) {
|
||||||
@ -225,7 +225,7 @@ static int __init ne3210_eisa_probe (struct device *device)
|
|||||||
|
|
||||||
static int __devexit ne3210_eisa_remove (struct device *device)
|
static int __devexit ne3210_eisa_remove (struct device *device)
|
||||||
{
|
{
|
||||||
struct net_device *dev = device->driver_data;
|
struct net_device *dev = dev_get_drvdata(device);
|
||||||
unsigned long ioaddr = to_eisa_device (device)->base_addr;
|
unsigned long ioaddr = to_eisa_device (device)->base_addr;
|
||||||
|
|
||||||
unregister_netdev (dev);
|
unregister_netdev (dev);
|
||||||
|
@ -370,7 +370,7 @@ static int __init ultramca_probe(struct device *gen_dev)
|
|||||||
|
|
||||||
outb(reg4, ioaddr + 4);
|
outb(reg4, ioaddr + 4);
|
||||||
|
|
||||||
gen_dev->driver_data = dev;
|
dev_set_drvdata(gen_dev, dev);
|
||||||
|
|
||||||
/* The 8390 isn't at the base address, so fake the offset
|
/* The 8390 isn't at the base address, so fake the offset
|
||||||
*/
|
*/
|
||||||
@ -531,7 +531,7 @@ static int ultramca_close_card(struct net_device *dev)
|
|||||||
static int ultramca_remove(struct device *gen_dev)
|
static int ultramca_remove(struct device *gen_dev)
|
||||||
{
|
{
|
||||||
struct mca_device *mca_dev = to_mca_device(gen_dev);
|
struct mca_device *mca_dev = to_mca_device(gen_dev);
|
||||||
struct net_device *dev = (struct net_device *)gen_dev->driver_data;
|
struct net_device *dev = dev_get_drvdata(gen_dev);
|
||||||
|
|
||||||
if (dev) {
|
if (dev) {
|
||||||
/* NB: ultra_close_card() does free_irq */
|
/* NB: ultra_close_card() does free_irq */
|
||||||
|
@ -1099,7 +1099,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
|
|||||||
struct pci_dev *pdev = NULL;
|
struct pci_dev *pdev = NULL;
|
||||||
int i, status=0;
|
int i, status=0;
|
||||||
|
|
||||||
gendev->driver_data = dev;
|
dev_set_drvdata(gendev, dev);
|
||||||
|
|
||||||
/* Ensure we're not sleeping */
|
/* Ensure we're not sleeping */
|
||||||
if (lp->bus == EISA) {
|
if (lp->bus == EISA) {
|
||||||
@ -2094,7 +2094,7 @@ static int __devexit de4x5_eisa_remove (struct device *device)
|
|||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
u_long iobase;
|
u_long iobase;
|
||||||
|
|
||||||
dev = device->driver_data;
|
dev = dev_get_drvdata(device);
|
||||||
iobase = dev->base_addr;
|
iobase = dev->base_addr;
|
||||||
|
|
||||||
unregister_netdev (dev);
|
unregister_netdev (dev);
|
||||||
@ -2338,7 +2338,7 @@ static void __devexit de4x5_pci_remove (struct pci_dev *pdev)
|
|||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
u_long iobase;
|
u_long iobase;
|
||||||
|
|
||||||
dev = pdev->dev.driver_data;
|
dev = dev_get_drvdata(&pdev->dev);
|
||||||
iobase = dev->base_addr;
|
iobase = dev->base_addr;
|
||||||
|
|
||||||
unregister_netdev (dev);
|
unregister_netdev (dev);
|
||||||
|
@ -482,7 +482,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev,
|
|||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct hso_device *hso_dev = dev->driver_data;
|
struct hso_device *hso_dev = dev_get_drvdata(dev);
|
||||||
char *port_name;
|
char *port_name;
|
||||||
|
|
||||||
if (!hso_dev)
|
if (!hso_dev)
|
||||||
@ -2313,7 +2313,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
|
|||||||
serial->parent->dev = tty_register_device(tty_drv, minor,
|
serial->parent->dev = tty_register_device(tty_drv, minor,
|
||||||
&serial->parent->interface->dev);
|
&serial->parent->interface->dev);
|
||||||
dev = serial->parent->dev;
|
dev = serial->parent->dev;
|
||||||
dev->driver_data = serial->parent;
|
dev_set_drvdata(dev, serial->parent);
|
||||||
i = device_create_file(dev, &dev_attr_hsotype);
|
i = device_create_file(dev, &dev_attr_hsotype);
|
||||||
|
|
||||||
/* fill in specific data for later use */
|
/* fill in specific data for later use */
|
||||||
|
Loading…
Reference in New Issue
Block a user