drm/i915: s/pm._irqs_disabled/pm.irqs_enabled/
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 30 Sep 2014 08:56:43 +0000 (10:56 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 3 Oct 2014 09:19:28 +0000 (11:19 +0200)
Double negations just parse harder. Also this allows us to ditch some
init code since clearing to 0 dtrt. Also ditch the assignment in
intel_pm_setup, that's not redundant since we do the assignement now
while setting up interrupts.

While at it do engage in a bit of OCD and wrap up the few lines of
setup/teardown code into little helper functions: intel_irq_fini for
cleanup and intel_irq_init_hw for hw setup.

v2: Use _install/_uninstall for the new wrapper function names as
Paulo suggested.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_pm.c

index d58c711a55c472491cbcc1c7f223fb4b6254b943..515fa6d3c99375bb73a88c8400095adb733725e7 100644 (file)
@@ -1338,14 +1338,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
        intel_power_domains_init_hw(dev_priv);
 
-       /*
-        * We enable some interrupt sources in our postinstall hooks, so mark
-        * interrupts as enabled _before_ actually enabling them to avoid
-        * special cases in our ordering checks.
-        */
-       dev_priv->pm._irqs_disabled = false;
-
-       ret = drm_irq_install(dev, dev->pdev->irq);
+       ret = intel_irq_install(dev_priv);
        if (ret)
                goto cleanup_gem_stolen;
 
index 5dbd5c92b61b415a3197950b5e670bb7b386f777..b4c4f6f1f0e1cc100fa30932b9f32cb4c8c37635 100644 (file)
@@ -1424,7 +1424,7 @@ struct ilk_wm_values {
  */
 struct i915_runtime_pm {
        bool suspended;
-       bool _irqs_disabled;
+       bool irqs_enabled;
 };
 
 enum intel_pipe_crc_source {
@@ -2311,6 +2311,8 @@ void gen6_set_pm_mask(struct drm_i915_private *dev_priv, u32 pm_iir,
                                                        int new_delay);
 extern void intel_irq_init(struct drm_device *dev);
 extern void intel_hpd_init(struct drm_device *dev);
+int intel_irq_install(struct drm_i915_private *dev_priv);
+void intel_irq_uninstall(struct drm_i915_private *dev_priv);
 
 extern void intel_uncore_sanitize(struct drm_device *dev);
 extern void intel_uncore_early_sanitize(struct drm_device *dev,
index eef74ef4736a5797a1643076ba67736623759d4d..c07f576c5974a6fd280016db3fb591ea0b51ef07 100644 (file)
@@ -4675,9 +4675,6 @@ void intel_irq_init(struct drm_device *dev)
 
        pm_qos_add_request(&dev_priv->pm_qos, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
 
-       /* Haven't installed the IRQ handler yet */
-       dev_priv->pm._irqs_disabled = true;
-
        if (IS_GEN2(dev)) {
                dev->max_vblank_count = 0;
                dev->driver->get_vblank_counter = i8xx_get_vblank_counter;
@@ -4786,13 +4783,32 @@ void intel_hpd_init(struct drm_device *dev)
        spin_unlock_irq(&dev_priv->irq_lock);
 }
 
+int intel_irq_install(struct drm_i915_private *dev_priv)
+{
+       /*
+        * We enable some interrupt sources in our postinstall hooks, so mark
+        * interrupts as enabled _before_ actually enabling them to avoid
+        * special cases in our ordering checks.
+        */
+       dev_priv->pm.irqs_enabled = true;
+
+       return drm_irq_install(dev_priv->dev, dev_priv->dev->pdev->irq);
+}
+
+void intel_irq_uninstall(struct drm_i915_private *dev_priv)
+{
+       drm_irq_uninstall(dev_priv->dev);
+       intel_hpd_cancel_work(dev_priv);
+       dev_priv->pm.irqs_enabled = false;
+}
+
 /* Disable interrupts so we can allow runtime PM. */
 void intel_runtime_pm_disable_interrupts(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
        dev->driver->irq_uninstall(dev);
-       dev_priv->pm._irqs_disabled = true;
+       dev_priv->pm.irqs_enabled = false;
 }
 
 /* Restore interrupts so we can recover from runtime PM. */
@@ -4800,7 +4816,7 @@ void intel_runtime_pm_restore_interrupts(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
-       dev_priv->pm._irqs_disabled = false;
+       dev_priv->pm.irqs_enabled = true;
        dev->driver->irq_preinstall(dev);
        dev->driver->irq_postinstall(dev);
 }
index 7877b163b5b960411f02634c7fd06f5ccf4d3ee7..6fc77a100cc66ea9d29fb00df145e4d44e6894e7 100644 (file)
@@ -13372,9 +13372,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
         * Too much stuff here (turning of rps, connectors, ...) would
         * experience fancy races otherwise.
         */
-       drm_irq_uninstall(dev);
-       intel_hpd_cancel_work(dev_priv);
-       dev_priv->pm._irqs_disabled = true;
+       intel_irq_uninstall(dev_priv);
 
        /*
         * Due to the hpd irq storm handling the hotplug work can re-arm the
index 1deb5d837049aee55b28ac9a6895c1558bf6299c..2d029d8aaec1f01e2404c3659cfdece916767e3e 100644 (file)
@@ -772,7 +772,7 @@ static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
         * We only use drm_irq_uninstall() at unload and VT switch, so
         * this is the only thing we need to check.
         */
-       return !dev_priv->pm._irqs_disabled;
+       return dev_priv->pm.irqs_enabled;
 }
 
 int intel_get_crtc_scanline(struct intel_crtc *crtc);
index 95006e0e982b44c1ccd10b2109d3f6cf292b5248..79108059b79b5009ac5dea64aa3b1c91e2ccffb8 100644 (file)
@@ -6531,5 +6531,4 @@ void intel_pm_setup(struct drm_device *dev)
                          intel_gen6_powersave_work);
 
        dev_priv->pm.suspended = false;
-       dev_priv->pm._irqs_disabled = false;
 }