diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-11-03 15:09:27 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-04-23 04:32:50 -0400 |
commit | bb0f1b5c1695b4399cfd2359c114ae63edbb3ad8 (patch) | |
tree | 2b5eb0a2b6e44168ab4af4f8393d5fcee8e2beee | |
parent | a319c1a47855eef2e1789527688b8dfdcf101dba (diff) |
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: Thierry Reding <treding@nvidia.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | Documentation/DocBook/drm.tmpl | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/psb_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_irq.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_irq_kms.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/shmobile/shmob_drm_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 |
14 files changed, 17 insertions, 32 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 677a02553ec0..83dd0b043c28 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -342,21 +342,13 @@ char *date;</synopsis> | |||
342 | <sect4> | 342 | <sect4> |
343 | <title>Managed IRQ Registration</title> | 343 | <title>Managed IRQ Registration</title> |
344 | <para> | 344 | <para> |
345 | Both the <function>drm_irq_install</function> and | ||
346 | <function>drm_irq_uninstall</function> functions get the device IRQ by | ||
347 | calling <function>drm_dev_to_irq</function>. This inline function will | ||
348 | call a bus-specific operation to retrieve the IRQ number. For platform | ||
349 | devices, <function>platform_get_irq</function>(..., 0) is used to | ||
350 | retrieve the IRQ number. | ||
351 | </para> | ||
352 | <para> | ||
353 | <function>drm_irq_install</function> starts by calling the | 345 | <function>drm_irq_install</function> starts by calling the |
354 | <methodname>irq_preinstall</methodname> driver operation. The operation | 346 | <methodname>irq_preinstall</methodname> driver operation. The operation |
355 | is optional and must make sure that the interrupt will not get fired by | 347 | is optional and must make sure that the interrupt will not get fired by |
356 | clearing all pending interrupt flags or disabling the interrupt. | 348 | clearing all pending interrupt flags or disabling the interrupt. |
357 | </para> | 349 | </para> |
358 | <para> | 350 | <para> |
359 | The IRQ will then be requested by a call to | 351 | The passed-in IRQ will then be requested by a call to |
360 | <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver | 352 | <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver |
361 | feature flag is set, a shared (IRQF_SHARED) IRQ handler will be | 353 | feature flag is set, a shared (IRQF_SHARED) IRQ handler will be |
362 | requested. | 354 | requested. |
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 32982da82694..567cfbde0883 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c | |||
@@ -173,7 +173,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) | |||
173 | if (ret) | 173 | if (ret) |
174 | goto err_kms; | 174 | goto err_kms; |
175 | 175 | ||
176 | ret = drm_irq_install(dev); | 176 | ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0)); |
177 | if (ret) | 177 | if (ret) |
178 | goto err_kms; | 178 | goto err_kms; |
179 | 179 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index cbf6f259bfe4..de38bc9b6581 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -233,11 +233,6 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state) | |||
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | static inline int drm_dev_to_irq(struct drm_device *dev) | ||
237 | { | ||
238 | return dev->driver->bus->get_irq(dev); | ||
239 | } | ||
240 | |||
241 | /** | 236 | /** |
242 | * Install IRQ handler. | 237 | * Install IRQ handler. |
243 | * | 238 | * |
@@ -247,14 +242,12 @@ static inline int drm_dev_to_irq(struct drm_device *dev) | |||
247 | * \c irq_preinstall() and \c irq_postinstall() functions | 242 | * \c irq_preinstall() and \c irq_postinstall() functions |
248 | * before and after the installation. | 243 | * before and after the installation. |
249 | */ | 244 | */ |
250 | int drm_irq_install(struct drm_device *dev) | 245 | int drm_irq_install(struct drm_device *dev, int irq) |
251 | { | 246 | { |
252 | int ret, irq; | 247 | int ret; |
253 | unsigned long sh_flags = 0; | 248 | unsigned long sh_flags = 0; |
254 | char *irqname; | 249 | char *irqname; |
255 | 250 | ||
256 | irq = drm_dev_to_irq(dev); | ||
257 | |||
258 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) | 251 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) |
259 | return -EINVAL; | 252 | return -EINVAL; |
260 | 253 | ||
@@ -399,7 +392,7 @@ int drm_control(struct drm_device *dev, void *data, | |||
399 | ctl->irq != irq) | 392 | ctl->irq != irq) |
400 | return -EINVAL; | 393 | return -EINVAL; |
401 | mutex_lock(&dev->struct_mutex); | 394 | mutex_lock(&dev->struct_mutex); |
402 | ret = drm_irq_install(dev); | 395 | ret = drm_irq_install(dev, irq); |
403 | mutex_unlock(&dev->struct_mutex); | 396 | mutex_unlock(&dev->struct_mutex); |
404 | 397 | ||
405 | return ret; | 398 | return ret; |
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index b686e56646eb..0a3101a3db19 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c | |||
@@ -354,7 +354,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) | |||
354 | PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); | 354 | PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); |
355 | spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); | 355 | spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); |
356 | 356 | ||
357 | drm_irq_install(dev); | 357 | drm_irq_install(dev, dev->pdev->irq); |
358 | 358 | ||
359 | dev->vblank_disable_allowed = true; | 359 | dev->vblank_disable_allowed = true; |
360 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ | 360 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 283ff06001bc..42de2808e53d 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1327,7 +1327,7 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1327 | 1327 | ||
1328 | intel_power_domains_init_hw(dev_priv); | 1328 | intel_power_domains_init_hw(dev_priv); |
1329 | 1329 | ||
1330 | ret = drm_irq_install(dev); | 1330 | ret = drm_irq_install(dev, dev->pdev->irq); |
1331 | if (ret) | 1331 | if (ret) |
1332 | goto cleanup_gem_stolen; | 1332 | goto cleanup_gem_stolen; |
1333 | 1333 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 87ce105910f2..6124b491a19e 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -574,7 +574,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) | |||
574 | mutex_unlock(&dev->struct_mutex); | 574 | mutex_unlock(&dev->struct_mutex); |
575 | 575 | ||
576 | /* We need working interrupts for modeset enabling ... */ | 576 | /* We need working interrupts for modeset enabling ... */ |
577 | drm_irq_install(dev); | 577 | drm_irq_install(dev, dev->pdev->irq); |
578 | 578 | ||
579 | intel_modeset_init_hw(dev); | 579 | intel_modeset_init_hw(dev); |
580 | 580 | ||
@@ -752,7 +752,7 @@ int i915_reset(struct drm_device *dev) | |||
752 | * being false when they shouldn't be able to. | 752 | * being false when they shouldn't be able to. |
753 | */ | 753 | */ |
754 | drm_irq_uninstall(dev); | 754 | drm_irq_uninstall(dev); |
755 | drm_irq_install(dev); | 755 | drm_irq_install(dev, dev->pdev->irq); |
756 | 756 | ||
757 | /* rps/rc6 re-init is necessary to restore state lost after the | 757 | /* rps/rc6 re-init is necessary to restore state lost after the |
758 | * reset and the re-install of drm irq. Skip for ironlake per | 758 | * reset and the re-install of drm irq. Skip for ironlake per |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d2cc19a7023f..a94938f08698 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -4523,7 +4523,7 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, | |||
4523 | 4523 | ||
4524 | BUG_ON(!list_empty(&dev_priv->gtt.base.active_list)); | 4524 | BUG_ON(!list_empty(&dev_priv->gtt.base.active_list)); |
4525 | 4525 | ||
4526 | ret = drm_irq_install(dev); | 4526 | ret = drm_irq_install(dev, dev->pdev->irq); |
4527 | if (ret) | 4527 | if (ret) |
4528 | goto cleanup_ringbuffer; | 4528 | goto cleanup_ringbuffer; |
4529 | mutex_unlock(&dev->struct_mutex); | 4529 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index f9de156b9e65..50ec1bed5820 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -288,7 +288,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags) | |||
288 | } | 288 | } |
289 | 289 | ||
290 | pm_runtime_get_sync(dev->dev); | 290 | pm_runtime_get_sync(dev->dev); |
291 | ret = drm_irq_install(dev); | 291 | ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0)); |
292 | pm_runtime_put_sync(dev->dev); | 292 | pm_runtime_put_sync(dev->dev); |
293 | if (ret < 0) { | 293 | if (ret < 0) { |
294 | dev_err(dev->dev, "failed to install IRQ handler\n"); | 294 | dev_err(dev->dev, "failed to install IRQ handler\n"); |
diff --git a/drivers/gpu/drm/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c index 28f84b4fce32..34d6a85e9023 100644 --- a/drivers/gpu/drm/qxl/qxl_irq.c +++ b/drivers/gpu/drm/qxl/qxl_irq.c | |||
@@ -87,7 +87,7 @@ int qxl_irq_init(struct qxl_device *qdev) | |||
87 | atomic_set(&qdev->irq_received_cursor, 0); | 87 | atomic_set(&qdev->irq_received_cursor, 0); |
88 | atomic_set(&qdev->irq_received_io_cmd, 0); | 88 | atomic_set(&qdev->irq_received_io_cmd, 0); |
89 | qdev->irq_received_error = 0; | 89 | qdev->irq_received_error = 0; |
90 | ret = drm_irq_install(qdev->ddev); | 90 | ret = drm_irq_install(qdev->ddev, qdev->ddev->pdev->irq); |
91 | qdev->ram_header->int_mask = QXL_INTERRUPT_MASK; | 91 | qdev->ram_header->int_mask = QXL_INTERRUPT_MASK; |
92 | if (unlikely(ret != 0)) { | 92 | if (unlikely(ret != 0)) { |
93 | DRM_ERROR("Failed installing irq: %d\n", ret); | 93 | DRM_ERROR("Failed installing irq: %d\n", ret); |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 089c9ffb0aa9..16807afab362 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -287,7 +287,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) | |||
287 | INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func); | 287 | INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func); |
288 | 288 | ||
289 | rdev->irq.installed = true; | 289 | rdev->irq.installed = true; |
290 | r = drm_irq_install(rdev->ddev); | 290 | r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq); |
291 | if (r) { | 291 | if (r) { |
292 | rdev->irq.installed = false; | 292 | rdev->irq.installed = false; |
293 | flush_work(&rdev->hotplug_work); | 293 | flush_work(&rdev->hotplug_work); |
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index c839c9c89efb..82c84c7fd4f6 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c | |||
@@ -185,7 +185,7 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) | |||
185 | goto done; | 185 | goto done; |
186 | } | 186 | } |
187 | 187 | ||
188 | ret = drm_irq_install(dev); | 188 | ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0)); |
189 | if (ret < 0) { | 189 | if (ret < 0) { |
190 | dev_err(&pdev->dev, "failed to install IRQ handler\n"); | 190 | dev_err(&pdev->dev, "failed to install IRQ handler\n"); |
191 | goto done; | 191 | goto done; |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 171a8203892c..b20b69488dc9 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | |||
@@ -268,7 +268,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) | |||
268 | } | 268 | } |
269 | 269 | ||
270 | pm_runtime_get_sync(dev->dev); | 270 | pm_runtime_get_sync(dev->dev); |
271 | ret = drm_irq_install(dev); | 271 | ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0)); |
272 | pm_runtime_put_sync(dev->dev); | 272 | pm_runtime_put_sync(dev->dev); |
273 | if (ret < 0) { | 273 | if (ret < 0) { |
274 | dev_err(dev->dev, "failed to install IRQ handler\n"); | 274 | dev_err(dev->dev, "failed to install IRQ handler\n"); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 4a223bbea3b3..6bdd15eea7e8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -806,7 +806,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
806 | } | 806 | } |
807 | 807 | ||
808 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | 808 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { |
809 | ret = drm_irq_install(dev); | 809 | ret = drm_irq_install(dev, dev->pdev->irq); |
810 | if (ret != 0) { | 810 | if (ret != 0) { |
811 | DRM_ERROR("Failed installing irq: %d\n", ret); | 811 | DRM_ERROR("Failed installing irq: %d\n", ret); |
812 | goto out_no_irq; | 812 | goto out_no_irq; |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 8e8c392d6fa8..7a7cfe88b9bf 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1353,7 +1353,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev, | |||
1353 | /* IRQ support (drm_irq.h) */ | 1353 | /* IRQ support (drm_irq.h) */ |
1354 | extern int drm_control(struct drm_device *dev, void *data, | 1354 | extern int drm_control(struct drm_device *dev, void *data, |
1355 | struct drm_file *file_priv); | 1355 | struct drm_file *file_priv); |
1356 | extern int drm_irq_install(struct drm_device *dev); | 1356 | extern int drm_irq_install(struct drm_device *dev, int irq); |
1357 | extern int drm_irq_uninstall(struct drm_device *dev); | 1357 | extern int drm_irq_uninstall(struct drm_device *dev); |
1358 | 1358 | ||
1359 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); | 1359 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); |