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

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

Hi all,

On Wed, 3 Jan 2024 12:19:11 +1100 Stephen Rothwell <[email-masked]> wrote:
>
> 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
> > 
>
> 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?

OK, the only thing I can find is that there are 2 intel_wakeref.h files
that have different definitions for intel_wakeref_t:

./drivers/gpu/drm/i915/intel_wakeref.h:typedef unsigned long intel_wakeref_t;
./drivers/gpu/drm/xe/compat-i915-headers/intel_wakeref.h:typedef bool intel_wakeref_t;

and the two compilations above seem to use different include paths, but
how the single character change causes that is beyond me.
-- 
Cheers,
Stephen Rothwell