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

Commit 75865858 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

[PATCH] PCI: clean up dynamic pci id logic



The dynamic pci id logic has been bothering me for a while, and now that
I started to look into how to move some of this to the driver core, I
thought it was time to clean it all up.

It ends up making the code smaller, and easier to follow, and fixes a
few bugs at the same time (dynamic ids were not being matched
everywhere, and so could be missed on some call paths for new devices,
semaphore not needed to be grabbed when adding a new id and calling the
driver core, etc.)

I also renamed the function pci_match_device() to pci_match_id() as
that's what it really does.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 299de034
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ static __init struct pci_dev *gx_detect_chipset(void)

	/* detect which companion chip is used */
	while ((gx_pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, gx_pci)) != NULL) {
		if ((pci_match_device (gx_chipset_tbl, gx_pci)) != NULL) {
		if ((pci_match_id(gx_chipset_tbl, gx_pci)) != NULL) {
			return gx_pci;
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -579,7 +579,7 @@ static int __init rng_init (void)

	/* Probe for Intel, AMD RNGs */
	for_each_pci_dev(pdev) {
		ent = pci_match_device (rng_pci_tbl, pdev);
		ent = pci_match_id(rng_pci_tbl, pdev);
		if (ent) {
			rng_ops = &rng_vendor_ops[ent->driver_data];
			goto match;
+1 −1
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
	 */

	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
		if (pci_match_device(i8xx_tco_pci_tbl, dev)) {
		if (pci_match_id(i8xx_tco_pci_tbl, dev)) {
			i8xx_tco_pci = dev;
			break;
		}
+1 −1
Original line number Diff line number Diff line
@@ -847,7 +847,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
		d = list_entry(l, struct pci_driver, node);
		if(d->id_table)
		{
			const struct pci_device_id *id = pci_match_device(d->id_table, dev);
			const struct pci_device_id *id = pci_match_id(d->id_table, dev);
			if(id != NULL)
			{
				if(d->probe(dev, id) >= 0)
+1 −1
Original line number Diff line number Diff line
@@ -3008,7 +3008,7 @@ static int __init parport_pc_init_superio (int autoirq, int autodma)
	int ret = 0;

	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
		id = pci_match_device (parport_pc_pci_tbl, pdev);
		id = pci_match_id(parport_pc_pci_tbl, pdev);
		if (id == NULL || id->driver_data >= last_sio)
			continue;

Loading