diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-19 15:32:00 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-20 19:55:14 +0000 |
commit | 66cd6bd66667433f56feecdcc94a2bb228d5a7ca (patch) | |
tree | af79f2757c2735e750255526fcf0e2c451fa4381 | |
parent | e484681a43964502bf7e61a1701bb85ab6befab3 (diff) |
compatibility code for pci_get_bus_and_slot()
-rw-r--r-- | linux-core/drm_compat.c | 15 | ||||
-rw-r--r-- | linux-core/drm_compat.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c index cd4ff7df..e95269ec 100644 --- a/linux-core/drm_compat.c +++ b/linux-core/drm_compat.c @@ -764,3 +764,18 @@ unsigned long round_jiffies_relative(unsigned long j) } EXPORT_SYMBOL(round_jiffies_relative); #endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) +struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) +{ + struct pci_dev *dev = NULL; + + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + if (pci_domain_nr(dev->bus) == 0 && + (dev->bus->number == bus && dev->devfn == devfn)) + return dev; + } + return NULL; +} +EXPORT_SYMBOL(pci_get_bus_and_slot); +#endif diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 92dcbc21..78545768 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -335,4 +335,8 @@ void *idr_replace(struct idr *idp, void *ptr, int id); extern unsigned long round_jiffies_relative(unsigned long j); #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) +extern struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); +#endif + #endif |