ia64/linux-2.6.18-xen.hg

changeset 801:5b779f810966

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@ab.jp.nec.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 02 10:57:56 2009 +0000 (2009-03-02)
parents ae2cf9ef03ac
children 979f8ccc314c
files drivers/xen/pciback/conf_space_quirks.c
line diff
     1.1 --- a/drivers/xen/pciback/conf_space_quirks.c	Mon Mar 02 10:54:44 2009 +0000
     1.2 +++ b/drivers/xen/pciback/conf_space_quirks.c	Mon Mar 02 10:57:56 2009 +0000
     1.3 @@ -13,13 +13,25 @@
     1.4  
     1.5  LIST_HEAD(pciback_quirks);
     1.6  
     1.7 +static inline const struct pci_device_id *
     1.8 +match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
     1.9 +{
    1.10 +	if ((id->vendor == PCI_ANY_ID || id->vendor == dev->vendor) &&
    1.11 +	    (id->device == PCI_ANY_ID || id->device == dev->device) &&
    1.12 +	    (id->subvendor == PCI_ANY_ID || id->subvendor == dev->subsystem_vendor) &&
    1.13 +	    (id->subdevice == PCI_ANY_ID || id->subdevice == dev->subsystem_device) &&
    1.14 +	    !((id->class ^ dev->class) & id->class_mask))
    1.15 +		return id;
    1.16 +	return NULL;
    1.17 +}
    1.18 +
    1.19  struct pciback_config_quirk *pciback_find_quirk(struct pci_dev *dev)
    1.20  {
    1.21  	struct pciback_config_quirk *tmp_quirk;
    1.22  
    1.23  	list_for_each_entry(tmp_quirk, &pciback_quirks, quirks_list)
    1.24 -	    if (pci_match_id(&tmp_quirk->devid, dev))
    1.25 -		goto out;
    1.26 +		if (match_one_device(&tmp_quirk->devid, dev) != NULL)
    1.27 +			goto out;
    1.28  	tmp_quirk = NULL;
    1.29  	printk(KERN_DEBUG
    1.30  	       "quirk didn't match any device pciback knows about\n");