Commit 7690e63d authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: 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: Leon Woestenberg <leon@sidebranch.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5355d8ca
......@@ -783,7 +783,7 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
goto err_ape;
}
ape->pci_dev = dev;
dev->dev.driver_data = (void *)ape;
dev_set_drvdata(&dev->dev, ape);
printk(KERN_DEBUG "probe() ape = 0x%p\n", ape);
printk(KERN_DEBUG "sizeof(struct ape_chdma_table) = %d.\n",
......@@ -946,19 +946,11 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
static void __devexit remove(struct pci_dev *dev)
{
struct ape_dev *ape;
struct ape_dev *ape = dev_get_drvdata(&dev->dev);
printk(KERN_DEBUG "remove(0x%p)\n", dev);
if ((dev == 0) || (dev->dev.driver_data == 0)) {
printk(KERN_DEBUG "remove(dev = 0x%p) dev->dev.driver_data = 0x%p\n",
dev, (dev? dev->dev.driver_data: NULL));
return;
}
ape = (struct ape_dev *)dev->dev.driver_data;
printk(KERN_DEBUG "remove(dev = 0x%p) where dev->dev.driver_data = 0x%p\n", dev, ape);
if (ape->pci_dev != dev) {
printk(KERN_DEBUG "dev->dev.driver_data->pci_dev (0x%08lx) != dev (0x%08lx)\n",
(unsigned long)ape->pci_dev, (unsigned long)dev);
}
printk(KERN_DEBUG "remove(dev = 0x%p) where ape = 0x%p\n", dev, ape);
/* remove character device */
#if ALTPCIECHDMA_CDEV
sg_exit(ape);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment