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-changelog

[Xen-changelog] [linux-2.6.18-xen] pciback: Fix invalid use of pci_match

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] pciback: Fix invalid use of pci_match_id()
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 02 Mar 2009 12:05:07 -0800
Delivery-date: Mon, 02 Mar 2009 12:05:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] pciback: Fix invalid use of pci_match_id(), Xen patchbot-linux-2.6.18-xen <=