Commit bb0f1b5c authored by Daniel Vetter's avatar Daniel Vetter

drm: pass the irq explicitly to drm_irq_install

Unfortunately this requires a drm-wide change, and I didn't see a sane
way around that. Luckily it's fairly simple, we just need to inline
the respective get_irq implementation from either drm_pci.c or
drm_platform.c.

With that we can now also remove drm_dev_to_irq from drm_irq.c.
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 a319c1a4
...@@ -341,14 +341,6 @@ char *date;</synopsis> ...@@ -341,14 +341,6 @@ char *date;</synopsis>
</para> </para>
<sect4> <sect4>
<title>Managed IRQ Registration</title> <title>Managed IRQ Registration</title>
<para>
Both the <function>drm_irq_install</function> and
<function>drm_irq_uninstall</function> functions get the device IRQ by
calling <function>drm_dev_to_irq</function>. This inline function will
call a bus-specific operation to retrieve the IRQ number. For platform
devices, <function>platform_get_irq</function>(..., 0) is used to
retrieve the IRQ number.
</para>
<para> <para>
<function>drm_irq_install</function> starts by calling the <function>drm_irq_install</function> starts by calling the
<methodname>irq_preinstall</methodname> driver operation. The operation <methodname>irq_preinstall</methodname> driver operation. The operation
...@@ -356,7 +348,7 @@ char *date;</synopsis> ...@@ -356,7 +348,7 @@ char *date;</synopsis>
clearing all pending interrupt flags or disabling the interrupt. clearing all pending interrupt flags or disabling the interrupt.
</para> </para>
<para> <para>
The IRQ will then be requested by a call to The passed-in IRQ will then be requested by a call to
<function>request_irq</function>. If the DRIVER_IRQ_SHARED driver <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver
feature flag is set, a shared (IRQF_SHARED) IRQ handler will be feature flag is set, a shared (IRQF_SHARED) IRQ handler will be
requested. requested.
......
...@@ -173,7 +173,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -173,7 +173,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
if (ret) if (ret)
goto err_kms; goto err_kms;
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
if (ret) if (ret)
goto err_kms; goto err_kms;
......
...@@ -233,11 +233,6 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state) ...@@ -233,11 +233,6 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state)
} }
} }
static inline int drm_dev_to_irq(struct drm_device *dev)
{
return dev->driver->bus->get_irq(dev);
}
/** /**
* Install IRQ handler. * Install IRQ handler.
* *
...@@ -247,14 +242,12 @@ static inline int drm_dev_to_irq(struct drm_device *dev) ...@@ -247,14 +242,12 @@ static inline int drm_dev_to_irq(struct drm_device *dev)
* \c irq_preinstall() and \c irq_postinstall() functions * \c irq_preinstall() and \c irq_postinstall() functions
* before and after the installation. * before and after the installation.
*/ */
int drm_irq_install(struct drm_device *dev) int drm_irq_install(struct drm_device *dev, int irq)
{ {
int ret, irq; int ret;
unsigned long sh_flags = 0; unsigned long sh_flags = 0;
char *irqname; char *irqname;
irq = drm_dev_to_irq(dev);
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL; return -EINVAL;
...@@ -399,7 +392,7 @@ int drm_control(struct drm_device *dev, void *data, ...@@ -399,7 +392,7 @@ int drm_control(struct drm_device *dev, void *data,
ctl->irq != irq) ctl->irq != irq)
return -EINVAL; return -EINVAL;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, irq);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return ret; return ret;
......
...@@ -354,7 +354,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -354,7 +354,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
drm_irq_install(dev); drm_irq_install(dev, dev->pdev->irq);
dev->vblank_disable_allowed = true; dev->vblank_disable_allowed = true;
dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
......
...@@ -1327,7 +1327,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -1327,7 +1327,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
intel_power_domains_init_hw(dev_priv); intel_power_domains_init_hw(dev_priv);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, dev->pdev->irq);
if (ret) if (ret)
goto cleanup_gem_stolen; goto cleanup_gem_stolen;
......
...@@ -574,7 +574,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) ...@@ -574,7 +574,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
/* We need working interrupts for modeset enabling ... */ /* We need working interrupts for modeset enabling ... */
drm_irq_install(dev); drm_irq_install(dev, dev->pdev->irq);
intel_modeset_init_hw(dev); intel_modeset_init_hw(dev);
...@@ -752,7 +752,7 @@ int i915_reset(struct drm_device *dev) ...@@ -752,7 +752,7 @@ int i915_reset(struct drm_device *dev)
* being false when they shouldn't be able to. * being false when they shouldn't be able to.
*/ */
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
drm_irq_install(dev); drm_irq_install(dev, dev->pdev->irq);
/* rps/rc6 re-init is necessary to restore state lost after the /* rps/rc6 re-init is necessary to restore state lost after the
* reset and the re-install of drm irq. Skip for ironlake per * reset and the re-install of drm irq. Skip for ironlake per
......
...@@ -4523,7 +4523,7 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, ...@@ -4523,7 +4523,7 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
BUG_ON(!list_empty(&dev_priv->gtt.base.active_list)); BUG_ON(!list_empty(&dev_priv->gtt.base.active_list));
ret = drm_irq_install(dev); ret = drm_irq_install(dev, dev->pdev->irq);
if (ret) if (ret)
goto cleanup_ringbuffer; goto cleanup_ringbuffer;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
......
...@@ -288,7 +288,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags) ...@@ -288,7 +288,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
} }
pm_runtime_get_sync(dev->dev); pm_runtime_get_sync(dev->dev);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
pm_runtime_put_sync(dev->dev); pm_runtime_put_sync(dev->dev);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev, "failed to install IRQ handler\n"); dev_err(dev->dev, "failed to install IRQ handler\n");
......
...@@ -87,7 +87,7 @@ int qxl_irq_init(struct qxl_device *qdev) ...@@ -87,7 +87,7 @@ int qxl_irq_init(struct qxl_device *qdev)
atomic_set(&qdev->irq_received_cursor, 0); atomic_set(&qdev->irq_received_cursor, 0);
atomic_set(&qdev->irq_received_io_cmd, 0); atomic_set(&qdev->irq_received_io_cmd, 0);
qdev->irq_received_error = 0; qdev->irq_received_error = 0;
ret = drm_irq_install(qdev->ddev); ret = drm_irq_install(qdev->ddev, qdev->ddev->pdev->irq);
qdev->ram_header->int_mask = QXL_INTERRUPT_MASK; qdev->ram_header->int_mask = QXL_INTERRUPT_MASK;
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
DRM_ERROR("Failed installing irq: %d\n", ret); DRM_ERROR("Failed installing irq: %d\n", ret);
......
...@@ -287,7 +287,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) ...@@ -287,7 +287,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func); INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func);
rdev->irq.installed = true; rdev->irq.installed = true;
r = drm_irq_install(rdev->ddev); r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq);
if (r) { if (r) {
rdev->irq.installed = false; rdev->irq.installed = false;
flush_work(&rdev->hotplug_work); flush_work(&rdev->hotplug_work);
......
...@@ -185,7 +185,7 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -185,7 +185,7 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags)
goto done; goto done;
} }
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to install IRQ handler\n"); dev_err(&pdev->dev, "failed to install IRQ handler\n");
goto done; goto done;
......
...@@ -268,7 +268,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) ...@@ -268,7 +268,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
} }
pm_runtime_get_sync(dev->dev); pm_runtime_get_sync(dev->dev);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
pm_runtime_put_sync(dev->dev); pm_runtime_put_sync(dev->dev);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev, "failed to install IRQ handler\n"); dev_err(dev->dev, "failed to install IRQ handler\n");
......
...@@ -806,7 +806,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -806,7 +806,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
} }
if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
ret = drm_irq_install(dev); ret = drm_irq_install(dev, dev->pdev->irq);
if (ret != 0) { if (ret != 0) {
DRM_ERROR("Failed installing irq: %d\n", ret); DRM_ERROR("Failed installing irq: %d\n", ret);
goto out_no_irq; goto out_no_irq;
......
...@@ -1353,7 +1353,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev, ...@@ -1353,7 +1353,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
/* IRQ support (drm_irq.h) */ /* IRQ support (drm_irq.h) */
extern int drm_control(struct drm_device *dev, void *data, extern int drm_control(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int drm_irq_install(struct drm_device *dev); extern int drm_irq_install(struct drm_device *dev, int irq);
extern int drm_irq_uninstall(struct drm_device *dev); extern int drm_irq_uninstall(struct drm_device *dev);
extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
......
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