OSDN Git Service

drm/i915: move a few more functions to accept the rpm structure
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Thu, 13 Jun 2019 23:21:53 +0000 (16:21 -0700)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 14 Jun 2019 14:58:33 +0000 (15:58 +0100)
Focusing on the functions called in few places.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190613232156.34940-6-daniele.ceraolospurio@intel.com
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_runtime_pm.c
drivers/gpu/drm/i915/intel_runtime_pm.h
drivers/gpu/drm/i915/selftests/mock_gem_device.c

index 3238635..1fc5af4 100644 (file)
@@ -2459,7 +2459,7 @@ static int i915_runtime_pm_status(struct seq_file *m, void *unused)
        if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)) {
                struct drm_printer p = drm_seq_file_printer(m);
 
-               print_intel_runtime_pm_wakeref(dev_priv, &p);
+               print_intel_runtime_pm_wakeref(&dev_priv->runtime_pm, &p);
        }
 
        return 0;
index 6236d33..65d5990 100644 (file)
@@ -909,7 +909,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv)
        mutex_init(&dev_priv->hdcp_comp_mutex);
 
        i915_memcpy_init_early(dev_priv);
-       intel_runtime_pm_init_early(dev_priv);
+       intel_runtime_pm_init_early(&dev_priv->runtime_pm);
 
        ret = i915_workqueues_init(dev_priv);
        if (ret < 0)
@@ -1751,7 +1751,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
                drm_kms_helper_poll_init(dev);
 
        intel_power_domains_enable(dev_priv);
-       intel_runtime_pm_enable(dev_priv);
+       intel_runtime_pm_enable(&dev_priv->runtime_pm);
 }
 
 /**
@@ -1760,7 +1760,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
  */
 static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 {
-       intel_runtime_pm_disable(dev_priv);
+       intel_runtime_pm_disable(&dev_priv->runtime_pm);
        intel_power_domains_disable(dev_priv);
 
        intel_fbdev_unregister(dev_priv);
@@ -1977,16 +1977,17 @@ void i915_driver_unload(struct drm_device *dev)
 static void i915_driver_release(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
+       struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
 
-       disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
+       disable_rpm_wakeref_asserts(rpm);
 
        i915_gem_fini(dev_priv);
 
        i915_ggtt_cleanup_hw(dev_priv);
        i915_driver_cleanup_mmio(dev_priv);
 
-       enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
-       intel_runtime_pm_cleanup(dev_priv);
+       enable_rpm_wakeref_asserts(rpm);
+       intel_runtime_pm_cleanup(rpm);
 
        i915_driver_cleanup_early(dev_priv);
        i915_driver_destroy(dev_priv);
@@ -2135,9 +2136,10 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct pci_dev *pdev = dev_priv->drm.pdev;
+       struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
        int ret;
 
-       disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
+       disable_rpm_wakeref_asserts(rpm);
 
        i915_gem_suspend_late(dev_priv);
 
@@ -2178,9 +2180,9 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
                pci_set_power_state(pdev, PCI_D3hot);
 
 out:
-       enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
+       enable_rpm_wakeref_asserts(rpm);
        if (!dev_priv->uncore.user_forcewake.count)
-               intel_runtime_pm_cleanup(dev_priv);
+               intel_runtime_pm_cleanup(rpm);
 
        return ret;
 }
@@ -2944,7 +2946,7 @@ static int intel_runtime_suspend(struct device *kdev)
        }
 
        enable_rpm_wakeref_asserts(rpm);
-       intel_runtime_pm_cleanup(dev_priv);
+       intel_runtime_pm_cleanup(rpm);
 
        if (intel_uncore_arm_unclaimed_mmio_detection(&dev_priv->uncore))
                DRM_ERROR("Unclaimed access detected prior to suspending\n");
index 07aaa3e..3d9ea34 100644 (file)
@@ -262,13 +262,12 @@ untrack_all_intel_runtime_pm_wakerefs(struct intel_runtime_pm *rpm)
        dump_and_free_wakeref_tracking(&dbg);
 }
 
-void print_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
+void print_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
                                    struct drm_printer *p)
 {
        struct intel_runtime_pm_debug dbg = {};
 
        do {
-               struct intel_runtime_pm *rpm = &i915->runtime_pm;
                unsigned long alloc = dbg.count;
                depot_stack_handle_t *s;
 
@@ -537,7 +536,7 @@ void intel_runtime_pm_put(struct drm_i915_private *i915, intel_wakeref_t wref)
 
 /**
  * intel_runtime_pm_enable - enable runtime pm
- * @i915: i915 device instance
+ * @rpm: the intel_runtime_pm structure
  *
  * This function enables runtime pm at the end of the driver load sequence.
  *
@@ -545,9 +544,8 @@ void intel_runtime_pm_put(struct drm_i915_private *i915, intel_wakeref_t wref)
  * subordinate display power domains. That is done by
  * intel_power_domains_enable().
  */
-void intel_runtime_pm_enable(struct drm_i915_private *i915)
+void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
 {
-       struct intel_runtime_pm *rpm = &i915->runtime_pm;
        struct device *kdev = rpm->kdev;
 
        /*
@@ -587,9 +585,8 @@ void intel_runtime_pm_enable(struct drm_i915_private *i915)
        pm_runtime_put_autosuspend(kdev);
 }
 
-void intel_runtime_pm_disable(struct drm_i915_private *i915)
+void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
 {
-       struct intel_runtime_pm *rpm = &i915->runtime_pm;
        struct device *kdev = rpm->kdev;
 
        /* Transfer rpm ownership back to core */
@@ -602,9 +599,8 @@ void intel_runtime_pm_disable(struct drm_i915_private *i915)
                pm_runtime_put(kdev);
 }
 
-void intel_runtime_pm_cleanup(struct drm_i915_private *i915)
+void intel_runtime_pm_cleanup(struct intel_runtime_pm *rpm)
 {
-       struct intel_runtime_pm *rpm = &i915->runtime_pm;
        int count = atomic_read(&rpm->wakeref_count);
 
        WARN(count,
@@ -615,9 +611,10 @@ void intel_runtime_pm_cleanup(struct drm_i915_private *i915)
        untrack_all_intel_runtime_pm_wakerefs(rpm);
 }
 
-void intel_runtime_pm_init_early(struct drm_i915_private *i915)
+void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)
 {
-       struct intel_runtime_pm *rpm = &i915->runtime_pm;
+       struct drm_i915_private *i915 =
+                       container_of(rpm, struct drm_i915_private, runtime_pm);
        struct pci_dev *pdev = i915->drm.pdev;
        struct device *kdev = &pdev->dev;
 
index 40c6530..0890e69 100644 (file)
@@ -169,10 +169,10 @@ enable_rpm_wakeref_asserts(struct intel_runtime_pm *rpm)
                   &rpm->wakeref_count);
 }
 
-void intel_runtime_pm_init_early(struct drm_i915_private *dev_priv);
-void intel_runtime_pm_enable(struct drm_i915_private *dev_priv);
-void intel_runtime_pm_disable(struct drm_i915_private *dev_priv);
-void intel_runtime_pm_cleanup(struct drm_i915_private *dev_priv);
+void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm);
+void intel_runtime_pm_enable(struct intel_runtime_pm *rpm);
+void intel_runtime_pm_disable(struct intel_runtime_pm *rpm);
+void intel_runtime_pm_cleanup(struct intel_runtime_pm *rpm);
 
 intel_wakeref_t intel_runtime_pm_get(struct drm_i915_private *i915);
 intel_wakeref_t intel_runtime_pm_get_if_in_use(struct drm_i915_private *i915);
@@ -200,10 +200,10 @@ intel_runtime_pm_put(struct drm_i915_private *i915, intel_wakeref_t wref)
 void intel_runtime_pm_put_raw(struct drm_i915_private *i915, intel_wakeref_t wref);
 
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
-void print_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
+void print_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
                                    struct drm_printer *p);
 #else
-static inline void print_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
+static inline void print_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
                                                  struct drm_printer *p)
 {
 }
index 68bae61..82f2be6 100644 (file)
@@ -166,7 +166,7 @@ struct drm_i915_private *mock_gem_device(void)
        i915->drm.pdev = pdev;
        i915->drm.dev_private = i915;
 
-       intel_runtime_pm_init_early(i915);
+       intel_runtime_pm_init_early(&i915->runtime_pm);
 
        /* Using the global GTT may ask questions about KMS users, so prepare */
        drm_mode_config_init(&i915->drm);