Commit 33229601 authored by Dave Airlie's avatar Dave Airlie

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: default avatarDave Airlie <airlied@linux.ie>
parent 242ef0e1
...@@ -699,7 +699,6 @@ typedef struct drm_device { ...@@ -699,7 +699,6 @@ typedef struct drm_device {
drm_agp_head_t *agp; /**< AGP data */ drm_agp_head_t *agp; /**< AGP data */
struct pci_dev *pdev; /**< PCI device structure */ struct pci_dev *pdev; /**< PCI device structure */
int pci_domain; /**< PCI bus domain number */
#ifdef __alpha__ #ifdef __alpha__
struct pci_controller *hose; struct pci_controller *hose;
#endif #endif
...@@ -721,6 +720,12 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev, ...@@ -721,6 +720,12 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
return ((dev->driver->driver_features & feature) ? 1 : 0); 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 #if __OS_HAS_AGP
static inline int drm_core_has_AGP(struct drm_device *dev) static inline int drm_core_has_AGP(struct drm_device *dev)
{ {
......
...@@ -127,7 +127,7 @@ int drm_setunique(struct inode *inode, struct file *filp, ...@@ -127,7 +127,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
domain = bus >> 8; domain = bus >> 8;
bus &= 0xff; bus &= 0xff;
if ((domain != dev->pci_domain) || if ((domain != drm_get_pci_domain(dev)) ||
(bus != dev->pdev->bus->number) || (bus != dev->pdev->bus->number) ||
(slot != PCI_SLOT(dev->pdev->devfn)) || (slot != PCI_SLOT(dev->pdev->devfn)) ||
(func != PCI_FUNC(dev->pdev->devfn))) (func != PCI_FUNC(dev->pdev->devfn)))
...@@ -149,7 +149,7 @@ static int drm_set_busid(drm_device_t * dev) ...@@ -149,7 +149,7 @@ static int drm_set_busid(drm_device_t * dev)
return ENOMEM; return ENOMEM;
len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", 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_SLOT(dev->pdev->devfn),
PCI_FUNC(dev->pdev->devfn)); PCI_FUNC(dev->pdev->devfn));
......
...@@ -64,7 +64,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp, ...@@ -64,7 +64,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
if (copy_from_user(&p, argp, sizeof(p))) if (copy_from_user(&p, argp, sizeof(p)))
return -EFAULT; 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.busnum & 0xff) != dev->pdev->bus->number ||
p.devnum != PCI_SLOT(dev->pdev->devfn) || p.funcnum != PCI_FUNC(dev->pdev->devfn)) p.devnum != PCI_SLOT(dev->pdev->devfn) || p.funcnum != PCI_FUNC(dev->pdev->devfn))
return -EINVAL; return -EINVAL;
......
...@@ -68,9 +68,6 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, ...@@ -68,9 +68,6 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
#ifdef __alpha__ #ifdef __alpha__
dev->hose = pdev->sysdata; dev->hose = pdev->sysdata;
dev->pci_domain = dev->hose->bus->number;
#else
dev->pci_domain = 0;
#endif #endif
dev->irq = pdev->irq; dev->irq = pdev->irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment