ia64/linux-2.6.18-xen.hg

changeset 735:5888ffa4b252

pci: small fix of aerdrv_core, add one new function of get_device by BDF

Signed-off-by: Jiang Yunhong<yunhong.jiang@intel.com>
Signed-off-by: Ke Liping<liping.ke@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Nov 24 11:03:21 2008 +0000 (2008-11-24)
parents df84c4c22a0a
children 412b24a36929
files drivers/pci/pcie/aer/aerdrv_core.c drivers/pci/search.c include/linux/pci.h
line diff
     1.1 --- a/drivers/pci/pcie/aer/aerdrv_core.c	Mon Nov 24 11:02:43 2008 +0000
     1.2 +++ b/drivers/pci/pcie/aer/aerdrv_core.c	Mon Nov 24 11:03:21 2008 +0000
     1.3 @@ -263,7 +263,7 @@ static void report_resume(struct pci_dev
     1.4  
     1.5  	if (!dev->driver ||
     1.6  		!dev->driver->err_handler ||
     1.7 -		!dev->driver->err_handler->slot_reset)
     1.8 +		!dev->driver->err_handler->resume)
     1.9  		return;
    1.10  
    1.11  	err_handler = dev->driver->err_handler;
     2.1 --- a/drivers/pci/search.c	Mon Nov 24 11:02:43 2008 +0000
     2.2 +++ b/drivers/pci/search.c	Mon Nov 24 11:03:21 2008 +0000
     2.3 @@ -380,6 +380,36 @@ exit:
     2.4  	up_read(&pci_bus_sem);
     2.5  	return found;
     2.6  }
     2.7 +
     2.8 +/**
     2.9 + * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot
    2.10 + * @bus: number of PCI bus on which desired PCI device resides
    2.11 + * @devfn: encodes number of PCI slot in which the desired PCI
    2.12 + * device resides and the logical device number within that slot
    2.13 + * in case of multi-function devices.
    2.14 + *
    2.15 + * Note: the bus/slot search is limited to PCI domain (segment) 0.
    2.16 + *
    2.17 + * Given a PCI bus and slot/function number, the desired PCI device
    2.18 + * is located in system global list of PCI devices.  If the device
    2.19 + * is found, a pointer to its data structure is returned.  If no
    2.20 + * device is found, %NULL is returned. The returned device has its
    2.21 + * reference count bumped by one.
    2.22 + */
    2.23 +
    2.24 +struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
    2.25 +{
    2.26 +	struct pci_dev *dev = NULL;
    2.27 +
    2.28 +	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
    2.29 +		if (pci_domain_nr(dev->bus) == 0 &&
    2.30 +		   (dev->bus->number == bus && dev->devfn == devfn))
    2.31 +			return dev;
    2.32 +	}
    2.33 +	return NULL;
    2.34 +}
    2.35 +
    2.36 +
    2.37  EXPORT_SYMBOL(pci_dev_present);
    2.38  
    2.39  EXPORT_SYMBOL(pci_find_bus);
    2.40 @@ -390,4 +420,5 @@ EXPORT_SYMBOL(pci_find_slot);
    2.41  EXPORT_SYMBOL(pci_get_device);
    2.42  EXPORT_SYMBOL(pci_get_subsys);
    2.43  EXPORT_SYMBOL(pci_get_slot);
    2.44 +EXPORT_SYMBOL(pci_get_bus_and_slot);
    2.45  EXPORT_SYMBOL(pci_get_class);
     3.1 --- a/include/linux/pci.h	Mon Nov 24 11:02:43 2008 +0000
     3.2 +++ b/include/linux/pci.h	Mon Nov 24 11:03:21 2008 +0000
     3.3 @@ -456,6 +456,7 @@ struct pci_dev *pci_get_subsys (unsigned
     3.4  				unsigned int ss_vendor, unsigned int ss_device,
     3.5  				struct pci_dev *from);
     3.6  struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn);
     3.7 +struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
     3.8  struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from);
     3.9  int pci_dev_present(const struct pci_device_id *ids);
    3.10  
    3.11 @@ -655,6 +656,11 @@ static inline struct pci_dev *pci_find_d
    3.12  static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn)
    3.13  { return NULL; }
    3.14  
    3.15 +
    3.16 +static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
    3.17 +{
    3.18 +	return NULL;
    3.19 +}
    3.20  static inline struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from)
    3.21  { return NULL; }
    3.22