summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-08-19 16:55:00 +1000
committerDave Airlie <airlied@linux.ie>2006-08-19 16:55:00 +1000
commit3a681bb4c12ee1042eb31ec565a3eb2ecccddd3d (patch)
treed4cc3b0f3b10cd4ebd24f3b9721b7f83ad089783
parentcc71393559b94ba491059822d7cad388460a0ddf (diff)
remove local copies of pci domain/bus/slot/num
-rw-r--r--linux-core/drmP.h10
-rw-r--r--linux-core/drm_ioctl.c12
-rw-r--r--linux-core/drm_irq.c6
-rw-r--r--linux-core/drm_stub.c6
4 files changed, 17 insertions, 17 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 6cbb810f..642ab4b0 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -747,10 +747,6 @@ typedef struct drm_device {
drm_agp_head_t *agp; /**< AGP data */
struct pci_dev *pdev; /**< PCI device structure */
- int pci_domain; /**< PCI bus domain number */
- int pci_bus; /**< PCI bus number */
- int pci_slot; /**< PCI slot number */
- int pci_func; /**< PCI function number */
#ifdef __alpha__
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
struct pci_controler *hose;
@@ -776,6 +772,12 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
return ((dev->driver->driver_features & feature) ? 1 : 0);
}
+#ifdef __alpha__
+#define drm_get_pci_domain(dev) dev->hose->bus->number
+#else
+#define drm_get_pci_domain(dev) pci_domain_nr(dev->pdev->bus)
+#endif
+
#if __OS_HAS_AGP
static inline int drm_core_has_AGP(struct drm_device *dev)
{
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c
index 54024e1b..2ea6af08 100644
--- a/linux-core/drm_ioctl.c
+++ b/linux-core/drm_ioctl.c
@@ -125,9 +125,10 @@ int drm_setunique(struct inode *inode, struct file *filp,
domain = bus >> 8;
bus &= 0xff;
- if ((domain != dev->pci_domain) ||
- (bus != dev->pci_bus) ||
- (slot != dev->pci_slot) || (func != dev->pci_func))
+ if ((domain != drm_get_pci_domain(dev)) ||
+ (bus != dev->pdev->bus->number) ||
+ (slot != PCI_SLOT(dev->pdev->devfn)) ||
+ (func != PCI_FUNC(dev->pdev->devfn)))
return -EINVAL;
return 0;
@@ -145,7 +146,10 @@ static int drm_set_busid(drm_device_t * dev)
return ENOMEM;
len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
- dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func);
+ drm_get_pci_domain(dev),
+ dev->pdev->bus->number,
+ PCI_SLOT(dev->pdev->devfn),
+ PCI_FUNC(dev->pdev->devfn));
if (len > dev->unique_len)
DRM_ERROR("buffer overflow");
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index d76fd51d..21a649bc 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -64,9 +64,9 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
if (copy_from_user(&p, argp, sizeof(p)))
return -EFAULT;
- if ((p.busnum >> 8) != dev->pci_domain ||
- (p.busnum & 0xff) != dev->pci_bus ||
- p.devnum != dev->pci_slot || p.funcnum != dev->pci_func)
+ if ((p.busnum >> 8) != drm_get_pci_domain(dev) ||
+ (p.busnum & 0xff) != dev->pdev->bus->number ||
+ p.devnum != PCI_SLOT(dev->pdev->devfn) || p.funcnum != PCI_FUNC(dev->pdev->devfn))
return -EINVAL;
p.irq = dev->irq;
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 25bb5f33..e4d61dcf 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -69,13 +69,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
#ifdef __alpha__
dev->hose = pdev->sysdata;
- dev->pci_domain = dev->hose->bus->number;
-#else
- dev->pci_domain = 0;
#endif
- dev->pci_bus = pdev->bus->number;
- dev->pci_slot = PCI_SLOT(pdev->devfn);
- dev->pci_func = PCI_FUNC(pdev->devfn);
dev->irq = pdev->irq;
dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);