WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] pciback: Fix invalid use of pci_match_id()

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] pciback: Fix invalid use of pci_match_id()
From: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
Date: Fri, 27 Feb 2009 17:34:59 +0900
Delivery-date: Fri, 27 Feb 2009 00:35:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)
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@xxxxxxxxxxxxx>

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");




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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] pciback: Fix invalid use of pci_match_id(), Yosuke Iwamatsu <=