Yosuke Iwamatsu
2009-Feb-27 08:34 UTC
[Xen-devel] [PATCH] 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. 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"); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel