Subject: Re: linux-next: build failure after merge of the header_cleanup tree

From: Ville Syrjälä <[email-masked]>
Date: Tue, 19 Dec 2023 15:53:38 +0200

On Tue, Dec 19, 2023 at 02:57:34PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> On Mon, 18 Dec 2023 17:40:30 +1100 Stephen Rothwell <[email-masked]> wrote:
> >
> > After merging the header_cleanup tree, today's linux-next build (arm
> > multi_v7_defconfig) failed like this:
> > 
> > In file included from include/linux/kernel.h:27,
> >                  from drivers/gpu/ipu-v3/ipu-dp.c:7:
> > include/drm/drm_color_mgmt.h: In function 'drm_color_lut_extract':
> > include/drm/drm_color_mgmt.h:45:46: error: implicit declaration of function 'mul_u32_u32' [-Werror=implicit-function-declaration]
> >    45 |                 return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
> >       |                                              ^~~~~~~~~~~
> > include/linux/math.h:104:36: note: in definition of macro 'DIV_ROUND_CLOSEST_ULL'
> >   104 |         unsigned long long _tmp = (x) + (__d) / 2;      \
> >       |                                    ^
> > In file included from include/linux/time.h:6,
> >                  from include/linux/videodev2.h:59,
> >                  from include/video/imx-ipu-v3.h:16,
> >                  from drivers/gpu/ipu-v3/ipu-dp.c:14:
> > include/linux/math64.h: At top level:
> > include/linux/math64.h:155:19: error: conflicting types for 'mul_u32_u32'; have 'u64(u32,  u32)' {aka 'long long unsigned int(unsigned int,  unsigned int)'}
> >   155 | static inline u64 mul_u32_u32(u32 a, u32 b)
> >       |                   ^~~~~~~~~~~
> > include/drm/drm_color_mgmt.h:45:46: note: previous implicit declaration of 'mul_u32_u32' with type 'int()'
> >    45 |                 return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
> >       |                                              ^~~~~~~~~~~
> > include/linux/math.h:104:36: note: in definition of macro 'DIV_ROUND_CLOSEST_ULL'
> >   104 |         unsigned long long _tmp = (x) + (__d) / 2;      \
> >       |                                    ^
> > cc1: some warnings being treated as errors
> > In file included from include/linux/kernel.h:27,
> >                  from drivers/gpu/drm/omapdrm/dss/dispc_coefs.c:7:
> > include/drm/drm_color_mgmt.h: In function 'drm_color_lut_extract':
> > include/drm/drm_color_mgmt.h:45:46: error: implicit declaration of function 'mul_u32_u32' [-Werror=implicit-function-declaration]
> >    45 |                 return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
> >       |                                              ^~~~~~~~~~~
> > include/linux/math.h:104:36: note: in definition of macro 'DIV_ROUND_CLOSEST_ULL'
> >   104 |         unsigned long long _tmp = (x) + (__d) / 2;      \
> >       |                                    ^
> > In file included from include/linux/jiffies.h:7,
> >                  from include/linux/ktime.h:25,
> >                  from include/linux/timer.h:6,
> >                  from include/linux/workqueue.h:9,
> >                  from include/linux/mm_types.h:19,
> >                  from include/linux/mmzone.h:22,
> >                  from include/linux/gfp.h:7,
> >                  from include/linux/stackdepot.h:25,
> >                  from include/drm/drm_modeset_lock.h:28,
> >                  from include/drm/drm_crtc.h:30,
> >                  from drivers/gpu/drm/omapdrm/dss/omapdss.h:11,
> >                  from drivers/gpu/drm/omapdrm/dss/dispc_coefs.c:9:
> > include/linux/math64.h: At top level:
> > include/linux/math64.h:155:19: error: conflicting types for 'mul_u32_u32'; have 'u64(u32,  u32)' {aka 'long long unsigned int(unsigned int,  unsigned int)'}
> >   155 | static inline u64 mul_u32_u32(u32 a, u32 b)
> >       |                   ^~~~~~~~~~~
> > include/drm/drm_color_mgmt.h:45:46: note: previous implicit declaration of 'mul_u32_u32' with type 'int()'
> >    45 |                 return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
> >       |                                              ^~~~~~~~~~~
> > include/linux/math.h:104:36: note: in definition of macro 'DIV_ROUND_CLOSEST_ULL'
> >   104 |         unsigned long long _tmp = (x) + (__d) / 2;      \
> >       |                                    ^
> > cc1: some warnings being treated as errors
> 
> This turns out to be a semantic conflict (or exposing a bug in commit
> 
>  c6fbb6bca108 ("drm: Fix color LUT rounding")
> 
> from the drm tree.
> 
> I have applied the following merge fix up patch (which should probably
> be applied to the drm tree, if possible).
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Tue, 19 Dec 2023 14:43:41 +1100
> Subject: [PATCH] drm: using mul_u32_u32() requires linux/math64.h
> 
> Some pending include file cleanups produced this error:
> 
> In file included from include/linux/kernel.h:27,
>                  from drivers/gpu/ipu-v3/ipu-dp.c:7:
> include/drm/drm_color_mgmt.h: In function 'drm_color_lut_extract':
> include/drm/drm_color_mgmt.h:45:46: error: implicit declaration of function 'mul_u32_u32' [-Werror=implicit-function-declaration]
>    45 |                 return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
>       |                                              ^~~~~~~~~~~
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>

Mea culpa.

I slapped on a
Fixes: c6fbb6bca108 ("drm: Fix color LUT rounding")

and applied this to drm-misc-next-fixes. Thanks.

> ---
>  include/drm/drm_color_mgmt.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
> index 54b2b2467bfd..ed81741036d7 100644
> --- a/include/drm/drm_color_mgmt.h
> +++ b/include/drm/drm_color_mgmt.h
> @@ -24,6 +24,7 @@
>  #define __DRM_COLOR_MGMT_H__
>  
>  #include <linux/ctype.h>
> +#include <linux/math64.h>
>  #include <drm/drm_property.h>
>  
>  struct drm_crtc;
> -- 
> 2.40.1
> 
> -- 
> Cheers,
> Stephen Rothwell

-- 
Ville Syrjälä
Intel