public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>,
	Kees Bakker <kees.bakker@xs4all.nl>,
	Patrick Mochel <mochel@osdl.org>,
	Anton Altaparmakov <aia21@cantab.net>,
	Anton Blanchard <anton@samba.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [patch] PCI device matching fix
Date: Mon, 03 Jun 2002 17:41:40 -0700	[thread overview]
Message-ID: <3CFC0CC2.D69F2C57@zip.com.au> (raw)

The new pci_device_probe() is always passing the zeroeth
entry in the id_table to the device's probe method.  It
needs to scan that table for the correct ID first.

This fixes the recent 3c59x strangenesses.


--- 2.5.20/drivers/pci/pci-driver.c~pci-scan	Mon Jun  3 17:37:59 2002
+++ 2.5.20-akpm/drivers/pci/pci-driver.c	Mon Jun  3 17:38:03 2002
@@ -38,12 +38,19 @@ pci_match_device(const struct pci_device
 static int pci_device_probe(struct device * dev)
 {
 	int error = 0;
+	struct pci_driver *drv;
+	struct pci_dev *pci_dev;
 
-	struct pci_driver * drv = list_entry(dev->driver,struct pci_driver,driver);
-	struct pci_dev * pci_dev = list_entry(dev,struct pci_dev,dev);
+	drv = list_entry(dev->driver, struct pci_driver, driver);
+	pci_dev = list_entry(dev, struct pci_dev, dev);
 
-	if (drv->probe)
-		error = drv->probe(pci_dev,drv->id_table);
+	if (drv->probe) {
+		const struct pci_device_id *id;
+
+		id = pci_match_device(drv->id_table, pci_dev);
+		if (id)
+			error = drv->probe(pci_dev, id);
+	}
 	return error > 0 ? 0 : -ENODEV;
 }
 

-

             reply	other threads:[~2002-06-04  0:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-04  0:41 Andrew Morton [this message]
2002-06-04  1:52 ` [patch] PCI device matching fix Anton Altaparmakov
2002-06-04  3:14 ` Patrick Mochel
2002-06-04  5:17   ` Greg KH
2002-06-05 23:15     ` Kai Germaschewski
2002-06-05 23:38       ` Patrick Mochel
2002-06-06  0:08         ` Kai Germaschewski
2002-06-06  0:35           ` Patrick Mochel
2002-06-06  1:23             ` Kai Germaschewski
2002-06-06 19:09               ` Patrick Mochel
2002-06-06 20:00                 ` Kai Germaschewski
2002-06-06 21:57                   ` Patrick Mochel
2002-06-06 22:22                     ` Kai Germaschewski
2002-06-06 22:57                       ` Patrick Mochel
2002-06-06 23:23                         ` Patrick Mochel
2002-06-07  0:02                           ` Kai Germaschewski
2002-06-10 14:16                             ` Patrick Mochel
2002-06-10 14:39                               ` Kai Germaschewski
2002-06-10 16:17                                 ` Patrick Mochel
2002-06-04 12:46 ` Sebastian Droege

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CFC0CC2.D69F2C57@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=aia21@cantab.net \
    --cc=anton@samba.org \
    --cc=kees.bakker@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox