drm/i915: Remove runtime suspended boolean from intel_runtime_pm struct
authorJouni Högander <jouni.hogander@intel.com>
Wed, 13 Sep 2023 10:04:30 +0000 (13:04 +0300)
committerJouni Högander <jouni.hogander@intel.com>
Mon, 18 Sep 2023 05:42:58 +0000 (08:42 +0300)
It's not necessary to carry separate suspended status information in
intel_runtime_pm struct as this information is already in underlying device
structure. Remove it and use pm_runtime_suspended() to obtain suspended
status information when needed.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230913100430.3433969-1-jouni.hogander@intel.com
drivers/gpu/drm/i915/display/intel_display_power.c
drivers/gpu/drm/i915/i915_driver.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/intel_runtime_pm.c
drivers/gpu/drm/i915/intel_runtime_pm.h

index 68cf5e6b0b46c2c91509ce82a09f87078deb650f..889bb26009a2e370dabd60273beeda7d9b1c6ef5 100644 (file)
@@ -216,7 +216,7 @@ bool __intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
        struct i915_power_well *power_well;
        bool is_enabled;
 
-       if (dev_priv->runtime_pm.suspended)
+       if (pm_runtime_suspended(dev_priv->drm.dev))
                return false;
 
        is_enabled = true;
index b5e1f72cc3ce4b654d1dfee665dedaf891f0d520..e5d693904123ec27a3b3500d35b21a0b34b3340a 100644 (file)
@@ -1571,8 +1571,6 @@ static int intel_runtime_suspend(struct device *kdev)
        if (root_pdev)
                pci_d3cold_disable(root_pdev);
 
-       rpm->suspended = true;
-
        /*
         * FIXME: We really should find a document that references the arguments
         * used below!
@@ -1623,7 +1621,6 @@ static int intel_runtime_resume(struct device *kdev)
        disable_rpm_wakeref_asserts(rpm);
 
        intel_opregion_notify_adapter(dev_priv, PCI_D0);
-       rpm->suspended = false;
 
        root_pdev = pcie_find_root_port(pdev);
        if (root_pdev)
index 4008bb09fdb5d85ab53867ee5a0413efb236448e..a60bab177c557ae57bf8d838ddaa1e7635930de7 100644 (file)
@@ -1972,7 +1972,7 @@ static void capture_gen(struct i915_gpu_coredump *error)
        struct drm_i915_private *i915 = error->i915;
 
        error->wakelock = atomic_read(&i915->runtime_pm.wakeref_count);
-       error->suspended = i915->runtime_pm.suspended;
+       error->suspended = pm_runtime_suspended(i915->drm.dev);
 
        error->iommu = i915_vtd_active(i915);
        error->reset_count = i915_reset_count(&i915->gpu_error);
index 6d8e5e5c0cba28b9ed23a212128b367e7111b370..8743153fad878f8be4e2d9b77c7a93e0ee8c2c56 100644 (file)
@@ -652,7 +652,6 @@ void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)
 
        rpm->kdev = kdev;
        rpm->available = HAS_RUNTIME_PM(i915);
-       rpm->suspended = false;
        atomic_set(&rpm->wakeref_count, 0);
 
        init_intel_runtime_pm_wakeref(rpm);
index 764b183ae45293b363b0874cd00abc9ffb73f118..f79cda7a2503dcb9c0ab84b34fd2f281cc64576f 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef __INTEL_RUNTIME_PM_H__
 #define __INTEL_RUNTIME_PM_H__
 
+#include <linux/pm_runtime.h>
 #include <linux/types.h>
 
 #include "intel_wakeref.h"
@@ -43,7 +44,6 @@ struct intel_runtime_pm {
        atomic_t wakeref_count;
        struct device *kdev; /* points to i915->drm.dev */
        bool available;
-       bool suspended;
        bool irqs_enabled;
        bool no_wakeref_tracking;
 
@@ -110,7 +110,7 @@ intel_rpm_wakelock_count(int wakeref_count)
 static inline void
 assert_rpm_device_not_suspended(struct intel_runtime_pm *rpm)
 {
-       WARN_ONCE(rpm->suspended,
+       WARN_ONCE(pm_runtime_suspended(rpm->kdev),
                  "Device suspended during HW access\n");
 }