Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12a37687 authored by Jiri Slaby's avatar Jiri Slaby Committed by John W. Linville
Browse files

[PATCH] pci: bcm43xx avoid pci_find_device



bcm43xx avoid pci_find_device

Change pci_find_device to safer pci_get_device with support for more
devices.

Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 91769e7d
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -2146,6 +2146,13 @@ static int bcm43xx_upload_initvals(struct bcm43xx_private *bcm)
	return err;
}

#ifdef CONFIG_BCM947XX
static struct pci_device_id bcm43xx_47xx_ids[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
	{ 0 }
};
#endif

static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
{
	int res;
@@ -2155,11 +2162,15 @@ static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
	bcm->irq = bcm->pci_dev->irq;
#ifdef CONFIG_BCM947XX
	if (bcm->pci_dev->bus->number == 0) {
		struct pci_dev *d = NULL;
		/* FIXME: we will probably need more device IDs here... */
		d = pci_find_device(PCI_VENDOR_ID_BROADCOM, 0x4324, NULL);
		struct pci_dev *d;
		struct pci_device_id *id;
		for (id = bcm43xx_47xx_ids; id->vendor; id++) {
			d = pci_get_device(id->vendor, id->device, NULL);
			if (d != NULL) {
				bcm->irq = d->irq;
				pci_dev_put(d);
				break;
			}
		}
	}
#endif