aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-08-07 06:23:42 -0400
committerDave Airlie <airlied@linux.ie>2006-09-21 15:32:30 -0400
commit332296016ee2e808b362de66bf6bec49c396e5bf (patch)
tree4bf9c5794f851f1a54e8468b4da9c0531795e004
parent242ef0e1e7e5bb7e80c3620c1aa55168819d6fb8 (diff)
drm: remove the DRM pci domain
This patch removes the pci_domain from the DRM device structure, and gets it via a macro that either asks the platform or does the alpha special case. jgarzik asked for this to just use the platform magic, but I've no alpha experience and I'd rather not just break it and wait for someone to give out. Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r--drivers/char/drm/drmP.h7
-rw-r--r--drivers/char/drm/drm_ioctl.c4
-rw-r--r--drivers/char/drm/drm_irq.c2
-rw-r--r--drivers/char/drm/drm_stub.c3
4 files changed, 9 insertions, 7 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 9838e8ce6ff2..4f0de974c191 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -699,7 +699,6 @@ typedef struct drm_device {
699 drm_agp_head_t *agp; /**< AGP data */ 699 drm_agp_head_t *agp; /**< AGP data */
700 700
701 struct pci_dev *pdev; /**< PCI device structure */ 701 struct pci_dev *pdev; /**< PCI device structure */
702 int pci_domain; /**< PCI bus domain number */
703#ifdef __alpha__ 702#ifdef __alpha__
704 struct pci_controller *hose; 703 struct pci_controller *hose;
705#endif 704#endif
@@ -721,6 +720,12 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
721 return ((dev->driver->driver_features & feature) ? 1 : 0); 720 return ((dev->driver->driver_features & feature) ? 1 : 0);
722} 721}
723 722
723#ifdef __alpha__
724#define drm_get_pci_domain(dev) dev->hose->bus->number
725#else
726#define drm_get_pci_domain(dev) pci_domain_nr(dev->pdev->bus)
727#endif
728
724#if __OS_HAS_AGP 729#if __OS_HAS_AGP
725static inline int drm_core_has_AGP(struct drm_device *dev) 730static inline int drm_core_has_AGP(struct drm_device *dev)
726{ 731{
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index 9f20c2b5a366..e15899830581 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -127,7 +127,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
127 domain = bus >> 8; 127 domain = bus >> 8;
128 bus &= 0xff; 128 bus &= 0xff;
129 129
130 if ((domain != dev->pci_domain) || 130 if ((domain != drm_get_pci_domain(dev)) ||
131 (bus != dev->pdev->bus->number) || 131 (bus != dev->pdev->bus->number) ||
132 (slot != PCI_SLOT(dev->pdev->devfn)) || 132 (slot != PCI_SLOT(dev->pdev->devfn)) ||
133 (func != PCI_FUNC(dev->pdev->devfn))) 133 (func != PCI_FUNC(dev->pdev->devfn)))
@@ -149,7 +149,7 @@ static int drm_set_busid(drm_device_t * dev)
149 return ENOMEM; 149 return ENOMEM;
150 150
151 len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", 151 len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
152 dev->pci_domain, dev->pdev->bus->number, 152 drm_get_pci_domain(dev), dev->pdev->bus->number,
153 PCI_SLOT(dev->pdev->devfn), 153 PCI_SLOT(dev->pdev->devfn),
154 PCI_FUNC(dev->pdev->devfn)); 154 PCI_FUNC(dev->pdev->devfn));
155 155
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index 41c7020c93ef..4553a3a1e496 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -64,7 +64,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
64 if (copy_from_user(&p, argp, sizeof(p))) 64 if (copy_from_user(&p, argp, sizeof(p)))
65 return -EFAULT; 65 return -EFAULT;
66 66
67 if ((p.busnum >> 8) != dev->pci_domain || 67 if ((p.busnum >> 8) != drm_get_pci_domain(dev) ||
68 (p.busnum & 0xff) != dev->pdev->bus->number || 68 (p.busnum & 0xff) != dev->pdev->bus->number ||
69 p.devnum != PCI_SLOT(dev->pdev->devfn) || p.funcnum != PCI_FUNC(dev->pdev->devfn)) 69 p.devnum != PCI_SLOT(dev->pdev->devfn) || p.funcnum != PCI_FUNC(dev->pdev->devfn))
70 return -EINVAL; 70 return -EINVAL;
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 96449d538e15..b1ead37c51d6 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -68,9 +68,6 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
68 68
69#ifdef __alpha__ 69#ifdef __alpha__
70 dev->hose = pdev->sysdata; 70 dev->hose = pdev->sysdata;
71 dev->pci_domain = dev->hose->bus->number;
72#else
73 dev->pci_domain = 0;
74#endif 71#endif
75 dev->irq = pdev->irq; 72 dev->irq = pdev->irq;
76 73