diff mbox series

[4/8] drm/i915/dmc: fix i915_reg_t usage

Message ID b35d1cab535265d04cd2161b0f8984d5d93af5c4.1647542120.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dmc: cleanups | expand

Commit Message

Jani Nikula March 17, 2022, 6:36 p.m. UTC
i915_reg_t is supposed to be a somewhat opaque data type, not to be
looked inside.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lucas De Marchi March 17, 2022, 7:43 p.m. UTC | #1
On Thu, Mar 17, 2022 at 08:36:16PM +0200, Jani Nikula wrote:
>i915_reg_t is supposed to be a somewhat opaque data type, not to be
>looked inside.
>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>


Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

but maybe also already clean up the remaining one?

$ git grep "i915_reg_t.*= *{ *}"
drivers/gpu/drm/i915/display/intel_display_debugfs.c:   i915_reg_t dc5_reg, dc6_reg = {};
drivers/gpu/drm/i915/gt/intel_ring_submission.c:                        i915_reg_t last_reg = {}; /* keep gcc quiet */

Lucas De Marchi

>---
> drivers/gpu/drm/i915/display/intel_dmc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>index 2e11725a0828..5de13f978e57 100644
>--- a/drivers/gpu/drm/i915/display/intel_dmc.c
>+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>@@ -816,7 +816,7 @@ static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
> 	struct drm_i915_private *i915 = m->private;
> 	intel_wakeref_t wakeref;
> 	struct intel_dmc *dmc;
>-	i915_reg_t dc5_reg, dc6_reg = {};
>+	i915_reg_t dc5_reg, dc6_reg = INVALID_MMIO_REG;
>
> 	if (!HAS_DMC(i915))
> 		return -ENODEV;
>@@ -868,7 +868,7 @@ static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
> 	}
>
> 	seq_printf(m, "DC3 -> DC5 count: %d\n", intel_de_read(i915, dc5_reg));
>-	if (dc6_reg.reg)
>+	if (i915_mmio_reg_valid(dc6_reg))
> 		seq_printf(m, "DC5 -> DC6 count: %d\n",
> 			   intel_de_read(i915, dc6_reg));
>
>-- 
>2.30.2
>
Jani Nikula March 18, 2022, 9:21 a.m. UTC | #2
On Thu, 17 Mar 2022, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> On Thu, Mar 17, 2022 at 08:36:16PM +0200, Jani Nikula wrote:
>>i915_reg_t is supposed to be a somewhat opaque data type, not to be
>>looked inside.
>>
>>Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
>
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>
> but maybe also already clean up the remaining one?
>
> $ git grep "i915_reg_t.*= *{ *}"
> drivers/gpu/drm/i915/display/intel_display_debugfs.c:   i915_reg_t dc5_reg, dc6_reg = {};

So that's the one being fixed here.

> drivers/gpu/drm/i915/gt/intel_ring_submission.c:                        i915_reg_t last_reg = {}; /* keep gcc quiet */

I'll send a separate fix for that, not part of this series.

Thanks,
Jani.

>
> Lucas De Marchi
>
>>---
>> drivers/gpu/drm/i915/display/intel_dmc.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>>index 2e11725a0828..5de13f978e57 100644
>>--- a/drivers/gpu/drm/i915/display/intel_dmc.c
>>+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>>@@ -816,7 +816,7 @@ static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
>> 	struct drm_i915_private *i915 = m->private;
>> 	intel_wakeref_t wakeref;
>> 	struct intel_dmc *dmc;
>>-	i915_reg_t dc5_reg, dc6_reg = {};
>>+	i915_reg_t dc5_reg, dc6_reg = INVALID_MMIO_REG;
>>
>> 	if (!HAS_DMC(i915))
>> 		return -ENODEV;
>>@@ -868,7 +868,7 @@ static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
>> 	}
>>
>> 	seq_printf(m, "DC3 -> DC5 count: %d\n", intel_de_read(i915, dc5_reg));
>>-	if (dc6_reg.reg)
>>+	if (i915_mmio_reg_valid(dc6_reg))
>> 		seq_printf(m, "DC5 -> DC6 count: %d\n",
>> 			   intel_de_read(i915, dc6_reg));
>>
>>-- 
>>2.30.2
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
index 2e11725a0828..5de13f978e57 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
@@ -816,7 +816,7 @@  static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
 	struct drm_i915_private *i915 = m->private;
 	intel_wakeref_t wakeref;
 	struct intel_dmc *dmc;
-	i915_reg_t dc5_reg, dc6_reg = {};
+	i915_reg_t dc5_reg, dc6_reg = INVALID_MMIO_REG;
 
 	if (!HAS_DMC(i915))
 		return -ENODEV;
@@ -868,7 +868,7 @@  static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
 	}
 
 	seq_printf(m, "DC3 -> DC5 count: %d\n", intel_de_read(i915, dc5_reg));
-	if (dc6_reg.reg)
+	if (i915_mmio_reg_valid(dc6_reg))
 		seq_printf(m, "DC5 -> DC6 count: %d\n",
 			   intel_de_read(i915, dc6_reg));