Commit eaaf8f0f authored by Daniel Vetter's avatar Daniel Vetter

drm/pci: fold in irq_by_busid support

This is a ums-only ioctl, and we've only ever supported ums (at least
in upstream) on pci devices. So no point in keeping that piece of
legacy logic abstracted within the drm bus driver.

To keep things work without CONFIG_PCI also add a dummy ioctl.

v2: Block the irq_by_busid ioctl for modeset drivers.

v3: Spelling/whitespace polish (Thierry)
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4984979b
...@@ -56,33 +56,6 @@ ...@@ -56,33 +56,6 @@
*/ */
#define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000
/**
* Get interrupt from bus id.
*
* \param inode device inode.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_irq_busid structure.
* \return zero on success or a negative number on failure.
*
* Finds the PCI device with the specified bus id and gets its IRQ number.
* This IOCTL is deprecated, and will now return EINVAL for any busid not equal
* to that of the device that this DRM instance attached to.
*/
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_irq_busid *p = data;
if (!dev->driver->bus->irq_by_busid)
return -EINVAL;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL;
return dev->driver->bus->irq_by_busid(dev, p);
}
/* /*
* Clear vblank timestamp buffer for a crtc. * Clear vblank timestamp buffer for a crtc.
*/ */
......
...@@ -247,7 +247,6 @@ static int drm_pci_set_unique(struct drm_device *dev, ...@@ -247,7 +247,6 @@ static int drm_pci_set_unique(struct drm_device *dev,
return ret; return ret;
} }
static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
{ {
if ((p->busnum >> 8) != drm_get_pci_domain(dev) || if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
...@@ -262,6 +261,37 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) ...@@ -262,6 +261,37 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
return 0; return 0;
} }
/**
* Get interrupt from bus id.
*
* \param inode device inode.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_irq_busid structure.
* \return zero on success or a negative number on failure.
*
* Finds the PCI device with the specified bus id and gets its IRQ number.
* This IOCTL is deprecated, and will now return EINVAL for any busid not equal
* to that of the device that this DRM instance attached to.
*/
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_irq_busid *p = data;
if (drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
/* UMS was only ever support on PCI devices. */
if (WARN_ON(!dev->pdev))
return -EINVAL;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL;
return drm_pci_irq_by_busid(dev, p);
}
static void drm_pci_agp_init(struct drm_device *dev) static void drm_pci_agp_init(struct drm_device *dev)
{ {
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) { if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
...@@ -292,7 +322,6 @@ static struct drm_bus drm_pci_bus = { ...@@ -292,7 +322,6 @@ static struct drm_bus drm_pci_bus = {
.get_name = drm_pci_get_name, .get_name = drm_pci_get_name,
.set_busid = drm_pci_set_busid, .set_busid = drm_pci_set_busid,
.set_unique = drm_pci_set_unique, .set_unique = drm_pci_set_unique,
.irq_by_busid = drm_pci_irq_by_busid,
}; };
/** /**
...@@ -453,6 +482,12 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) ...@@ -453,6 +482,12 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
} }
void drm_pci_agp_destroy(struct drm_device *dev) {} void drm_pci_agp_destroy(struct drm_device *dev) {}
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
return -EINVAL;
}
#endif #endif
EXPORT_SYMBOL(drm_pci_init); EXPORT_SYMBOL(drm_pci_init);
......
...@@ -737,7 +737,6 @@ struct drm_bus { ...@@ -737,7 +737,6 @@ struct drm_bus {
int (*set_busid)(struct drm_device *dev, struct drm_master *master); int (*set_busid)(struct drm_device *dev, struct drm_master *master);
int (*set_unique)(struct drm_device *dev, struct drm_master *master, int (*set_unique)(struct drm_device *dev, struct drm_master *master,
struct drm_unique *unique); struct drm_unique *unique);
int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
}; };
/** /**
......
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