9
0
Fork 0

pci: Do not abuse dev->priv for storing data

dev->priv is for private use of the device driver, so do not
use it in the pci core. Instead, introduce a id field in struct
pci_device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This commit is contained in:
Sascha Hauer 2015-04-15 07:25:41 +02:00
parent bd3e501134
commit f49f067bdd
2 changed files with 5 additions and 4 deletions

View File

@ -27,11 +27,11 @@ static int pci_match(struct device_d *dev, struct driver_d *drv)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct pci_driver *pdrv = to_pci_driver(drv);
struct pci_device_id *id;
const struct pci_device_id *id;
for (id = (struct pci_device_id *)pdrv->id_table; id->vendor; id++)
for (id = pdrv->id_table; id->vendor; id++)
if (pci_match_one_device(id, pdev)) {
dev->priv = id;
pdev->id = id;
return 0;
}
@ -43,7 +43,7 @@ static int pci_probe(struct device_d *dev)
struct pci_dev *pdev = to_pci_dev(dev);
struct pci_driver *pdrv = to_pci_driver(dev->driver);
return pdrv->probe(pdev, dev->priv);
return pdrv->probe(pdev, pdev->id);
}
static void pci_remove(struct device_d *dev)

View File

@ -92,6 +92,7 @@ struct pci_dev {
struct pci_bus *bus; /* bus this device is on */
struct pci_bus *subordinate; /* bus this device bridges to */
struct pci_slot *slot; /* Physical slot this device is in */
const struct pci_device_id *id; /* the id this device matches */
struct device_d dev;