All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pciback: Fix invalid use of pci_match_id()
@ 2009-02-27  8:34 Yosuke Iwamatsu
  0 siblings, 0 replies; only message in thread
From: Yosuke Iwamatsu @ 2009-02-27  8:34 UTC (permalink / raw)
  To: xen-devel

We cannot use pci_match_id() because the first argument (tmp_quirk->devid)
is not an array of pci device ids. Instead this patch adds a utility function
to compare a pci_device_id and a pci_dev.

Thank you,
-----------------------
Yosuke Iwamatsu
        NEC Corporation


Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>

diff -r 2f1b770d84e5 drivers/xen/pciback/conf_space_quirks.c
--- a/drivers/xen/pciback/conf_space_quirks.c	Tue Feb 17 11:31:13 2009 +0000
+++ b/drivers/xen/pciback/conf_space_quirks.c	Thu Feb 26 17:09:13 2009 +0900
@@ -13,13 +13,25 @@
 
 LIST_HEAD(pciback_quirks);
 
+static inline const struct pci_device_id *
+match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
+{
+	if ((id->vendor == PCI_ANY_ID || id->vendor == dev->vendor) &&
+	    (id->device == PCI_ANY_ID || id->device == dev->device) &&
+	    (id->subvendor == PCI_ANY_ID || id->subvendor == dev->subsystem_vendor) &&
+	    (id->subdevice == PCI_ANY_ID || id->subdevice == dev->subsystem_device) &&
+	    !((id->class ^ dev->class) & id->class_mask))
+		return id;
+	return NULL;
+}
+
 struct pciback_config_quirk *pciback_find_quirk(struct pci_dev *dev)
 {
 	struct pciback_config_quirk *tmp_quirk;
 
 	list_for_each_entry(tmp_quirk, &pciback_quirks, quirks_list)
-	    if (pci_match_id(&tmp_quirk->devid, dev))
-		goto out;
+		if (match_one_device(&tmp_quirk->devid, dev) != NULL)
+			goto out;
 	tmp_quirk = NULL;
 	printk(KERN_DEBUG
 	       "quirk didn't match any device pciback knows about\n");

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-27  8:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27  8:34 [PATCH] pciback: Fix invalid use of pci_match_id() Yosuke Iwamatsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.