drm/i915/gen8: Factor out display interrupt handling
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 12 Jan 2016 16:04:07 +0000 (16:04 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Wed, 13 Jan 2016 10:01:53 +0000 (10:01 +0000)
Tidy quite long interrupt service routine by factoring out
the display part.

This simplifies the exit path a little bit, makes the code
a bit more readable, and potentialy makes code reuse in the
future easier.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1452614647-13973-2-git-send-email-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_irq.c

index 7972ceee6096f24e46bb0156bab9e317d4f15574..25a89373df6340db8bafc7dab346b687ef4c48ff 100644 (file)
@@ -2264,31 +2264,14 @@ static void bxt_hpd_irq_handler(struct drm_device *dev, u32 hotplug_trigger,
        intel_hpd_irq_handler(dev, pin_mask, long_mask);
 }
 
-static irqreturn_t gen8_irq_handler(int irq, void *arg)
+static irqreturn_t
+gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 {
-       struct drm_device *dev = arg;
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       u32 master_ctl, iir;
+       struct drm_device *dev = dev_priv->dev;
        irqreturn_t ret = IRQ_NONE;
+       u32 iir;
        enum pipe pipe;
 
-       if (!intel_irqs_enabled(dev_priv))
-               return IRQ_NONE;
-
-       /* IRQs are synced during runtime_suspend, we don't require a wakeref */
-       disable_rpm_wakeref_asserts(dev_priv);
-
-       master_ctl = I915_READ_FW(GEN8_MASTER_IRQ);
-       master_ctl &= ~GEN8_MASTER_IRQ_CONTROL;
-       if (!master_ctl)
-               goto out;
-
-       I915_WRITE_FW(GEN8_MASTER_IRQ, 0);
-
-       /* Find, clear, then process each source of interrupt */
-
-       ret = gen8_gt_irq_handler(dev_priv, master_ctl);
-
        if (master_ctl & GEN8_DE_MISC_IRQ) {
                iir = I915_READ(GEN8_DE_MISC_IIR);
                if (iir) {
@@ -2422,10 +2405,36 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
                }
        }
 
+       return ret;
+}
+
+static irqreturn_t gen8_irq_handler(int irq, void *arg)
+{
+       struct drm_device *dev = arg;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       u32 master_ctl;
+       irqreturn_t ret;
+
+       if (!intel_irqs_enabled(dev_priv))
+               return IRQ_NONE;
+
+       master_ctl = I915_READ_FW(GEN8_MASTER_IRQ);
+       master_ctl &= ~GEN8_MASTER_IRQ_CONTROL;
+       if (!master_ctl)
+               return IRQ_NONE;
+
+       I915_WRITE_FW(GEN8_MASTER_IRQ, 0);
+
+       /* IRQs are synced during runtime_suspend, we don't require a wakeref */
+       disable_rpm_wakeref_asserts(dev_priv);
+
+       /* Find, clear, then process each source of interrupt */
+       ret = gen8_gt_irq_handler(dev_priv, master_ctl);
+       ret |= gen8_de_irq_handler(dev_priv, master_ctl);
+
        I915_WRITE_FW(GEN8_MASTER_IRQ, GEN8_MASTER_IRQ_CONTROL);
        POSTING_READ_FW(GEN8_MASTER_IRQ);
 
-out:
        enable_rpm_wakeref_asserts(dev_priv);
 
        return ret;