Subject: Re: linux-next: build warning after merge of the drm tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 3 Jan 2024 12:19:11 +1100

Hi all,

On Tue, 2 Jan 2024 11:12:22 +1100 Stephen Rothwell <[email-masked]> wrote:
>
> After merging the drm tree, today's linux-next build (x86_64 allmodconfig)
> produced this warning:
> 
> In file included from include/drm/drm_mm.h:51,
>                  from drivers/gpu/drm/xe/xe_bo_types.h:11,
>                  from drivers/gpu/drm/xe/xe_bo.h:11,
>                  from drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h:11,
>                  from drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:15,
>                  from drivers/gpu/drm/i915/display/intel_display_power.c:8:
> drivers/gpu/drm/i915/display/intel_display_power.c: In function 'print_async_put_domains_state':
> drivers/gpu/drm/i915/display/intel_display_power.c:408:29: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
>   408 |         drm_dbg(&i915->drm, "async_put_wakeref %lu\n",
>       |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
>   409 |                 power_domains->async_put_wakeref);
>       |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>       |                              |
>       |                              int
> 
> Introduced by commit
> 
>   b49e894c3fd8 ("drm/i915: Replace custom intel runtime_pm tracker with ref_tracker library")
> 
> This would be an error except that I am building with CONFIG_WERROR=n

OK, so I have turned off CONFIG_WERROR=n in the run up to the merge
window opening and so this is now a build failure.  I have tried
applying the following patch for today:

From: Stephen Rothwell <[email-masked]>
Date: Wed, 3 Jan 2024 11:40:26 +1100
Subject: [PATCH] fix up for "drm/i915: Replace custom intel runtime_pm tracker
 with ref_tracker library"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/gpu/drm/i915/display/intel_display_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 5f091502719b..f23080a4368d 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -405,7 +405,7 @@ print_async_put_domains_state(struct i915_power_domains *power_domains)
 						     struct drm_i915_private,
 						     display.power.domains);
 
-	drm_dbg(&i915->drm, "async_put_wakeref %lu\n",
+	drm_dbg(&i915->drm, "async_put_wakeref %u\n",
 		power_domains->async_put_wakeref);
 
 	print_power_domains(power_domains, "async_put_domains[0]",
-- 
2.43.0

but that produces this failure:

In file included from include/drm/ttm/ttm_resource.h:34,
                 from include/drm/ttm/ttm_device.h:30,
                 from drivers/gpu/drm/i915/i915_drv.h:37,
                 from drivers/gpu/drm/i915/display/intel_display_power.c:8:  
drivers/gpu/drm/i915/display/intel_display_power.c: In function 'print_async_put_domains_state':
drivers/gpu/drm/i915/display/intel_display_power.c:408:29: error: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'intel_wakeref_t' {aka 'long unsigned int'} [-Werror=format=]
  408 |         drm_dbg(&i915->drm, "async_put_wakeref %u\n",
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
  409 |                 power_domains->async_put_wakeref);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              intel_wakeref_t {aka long unsigned int}

I don't understand how the above patch can change the compilation like
that.  I must be missing something obvious.  Maybe my compiler is
strangely broken?  I have applied the following instead (which at least
builds):

From: Stephen Rothwell <[email-masked]>
Date: Wed, 3 Jan 2024 11:40:26 +1100
Subject: [PATCH] fix up for "drm/i915: Replace custom intel runtime_pm tracker
 with ref_tracker library"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/gpu/drm/i915/display/intel_display_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 5f091502719b..6253ce061d20 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -406,7 +406,7 @@ print_async_put_domains_state(struct i915_power_domains *power_domains)
 						     display.power.domains);
 
 	drm_dbg(&i915->drm, "async_put_wakeref %lu\n",
-		power_domains->async_put_wakeref);
+		(unsigned long int)power_domains->async_put_wakeref);
 
 	print_power_domains(power_domains, "async_put_domains[0]",
 			    &power_domains->async_put_domains[0]);
-- 
2.43.0

-- 
Cheers,
Stephen Rothwell