[PATCH] drm: remove pci domain local copy (02/07)

From: Dave Airlie
Date: Sat Jul 22 2006 - 11:35:42 EST


Just call a function to retrieve the pci domain, this isn't exactly
hotpath code.

Signed-off-by: Dave Airlie <airlied@xxxxxxxx>
(cherry picked from 01852d755753bbfcd5434c55d4d7375580f8338f commit)
---
drivers/char/drm/drmP.h | 10 +++++++++-
drivers/char/drm/drm_ioctl.c | 4 ++--
drivers/char/drm/drm_irq.c | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 5c8f245..4dd28e1 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -711,7 +711,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 */
#ifdef __alpha__
struct pci_controller *hose;
#endif
@@ -733,6 +732,15 @@ static __inline__ int drm_core_check_fea
return ((dev->driver->driver_features & feature) ? 1 : 0);
}

+static inline int drm_get_pci_domain(struct drm_device *dev)
+{
+#ifdef __alpha__
+ return dev->hose->bus->number;
+#else
+ return 0;
+#endif
+}
+
#if __OS_HAS_AGP
static inline int drm_core_has_AGP(struct drm_device *dev)
{
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index 5c020b8..9d9f988 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, s
domain = bus >> 8;
bus &= 0xff;

- if ((domain != dev->pci_domain) ||
+ if ((domain != drm_get_pci_domain(dev)) ||
(bus != dev->pdev->bus->number) ||
(slot != PCI_SLOT(dev->pdev->devfn)) ||
(func != PCI_FUNC(dev->pdev->devfn)))
@@ -149,7 +149,7 @@ static int drm_set_busid(drm_device_t *
return ENOMEM;

len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
- dev->pci_domain, dev->pdev->bus->number,
+ drm_get_pci_domain(dev), dev->pdev->bus->number,
PCI_SLOT(dev->pdev->devfn),
PCI_FUNC(dev->pdev->devfn));

diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index ee4b183..f93d8cd 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
if (copy_from_user(&p, argp, sizeof(p)))
return -EFAULT;

- if ((p.busnum >> 8) != dev->pci_domain ||
+ 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;
--
1.4.1.ga3e6

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/