drm/i915/debugfs: move debug printing to intel_display_power.c
authorJani Nikula <jani.nikula@intel.com>
Tue, 16 Nov 2021 17:14:32 +0000 (19:14 +0200)
committerJani Nikula <jani.nikula@intel.com>
Fri, 19 Nov 2021 13:12:05 +0000 (15:12 +0200)
The debugfs should have no special privileges to look into the
implementation guts. Move the actual debug printing of power domains to
intel_display_power.c.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211116171434.20516-3-jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_display_debugfs.c
drivers/gpu/drm/i915/display/intel_display_power.c
drivers/gpu/drm/i915/display/intel_display_power.h

index 3f5a5e1..acf70ae 100644 (file)
@@ -471,28 +471,9 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_edp_psr_debug_fops,
 
 static int i915_power_domain_info(struct seq_file *m, void *unused)
 {
-       struct drm_i915_private *dev_priv = node_to_i915(m->private);
-       struct i915_power_domains *power_domains = &dev_priv->power_domains;
-       int i;
-
-       mutex_lock(&power_domains->lock);
-
-       seq_printf(m, "%-25s %s\n", "Power well/domain", "Use count");
-       for (i = 0; i < power_domains->power_well_count; i++) {
-               struct i915_power_well *power_well;
-               enum intel_display_power_domain power_domain;
-
-               power_well = &power_domains->power_wells[i];
-               seq_printf(m, "%-25s %d\n", power_well->desc->name,
-                          power_well->count);
-
-               for_each_power_domain(power_domain, power_well->desc->domains)
-                       seq_printf(m, "  %-23s %d\n",
-                                intel_display_power_domain_str(power_domain),
-                                power_domains->domain_use_count[power_domain]);
-       }
+       struct drm_i915_private *i915 = node_to_i915(m->private);
 
-       mutex_unlock(&power_domains->lock);
+       intel_display_power_debug(i915, m);
 
        return 0;
 }
index d30639a..5ebc758 100644 (file)
@@ -6397,3 +6397,28 @@ void intel_display_power_resume(struct drm_i915_private *i915)
                hsw_disable_pc8(i915);
        }
 }
+
+void intel_display_power_debug(struct drm_i915_private *i915, struct seq_file *m)
+{
+       struct i915_power_domains *power_domains = &i915->power_domains;
+       int i;
+
+       mutex_lock(&power_domains->lock);
+
+       seq_printf(m, "%-25s %s\n", "Power well/domain", "Use count");
+       for (i = 0; i < power_domains->power_well_count; i++) {
+               struct i915_power_well *power_well;
+               enum intel_display_power_domain power_domain;
+
+               power_well = &power_domains->power_wells[i];
+               seq_printf(m, "%-25s %d\n", power_well->desc->name,
+                          power_well->count);
+
+               for_each_power_domain(power_domain, power_well->desc->domains)
+                       seq_printf(m, "  %-23s %d\n",
+                                  intel_display_power_domain_str(power_domain),
+                                  power_domains->domain_use_count[power_domain]);
+       }
+
+       mutex_unlock(&power_domains->lock);
+}
index d54b757..b28cc1f 100644 (file)
@@ -391,6 +391,8 @@ intel_display_power_put_all_in_set(struct drm_i915_private *i915,
        intel_display_power_put_mask_in_set(i915, power_domain_set, power_domain_set->mask);
 }
 
+void intel_display_power_debug(struct drm_i915_private *i915, struct seq_file *m);
+
 /*
  * FIXME: We should probably switch this to a 0-based scheme to be consistent
  * with how we now name/number DBUF_CTL instances.