[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] pciback: Fix invalid use of pci_match_id()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1235991476 0
# Node ID 5b779f8109662803b7d292ef1effbf68be3319d2
# Parent  ae2cf9ef03acd34c2fd747c924aa9660467055a1
pciback: Fix invalid use of pci_match_id()

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.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
---
 drivers/xen/pciback/conf_space_quirks.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff -r ae2cf9ef03ac -r 5b779f810966 drivers/xen/pciback/conf_space_quirks.c
--- a/drivers/xen/pciback/conf_space_quirks.c   Mon Mar 02 10:54:44 2009 +0000
+++ b/drivers/xen/pciback/conf_space_quirks.c   Mon Mar 02 10:57:56 2009 +0000
@@ -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");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.