Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/fourcc: fix integer type usage in uapi header

Kernel uapi headers are supposed to use __[us]{8,16,32,64} types defined
by <linux/types.h> as opposed to 'uint32_t' and similar. See [1] for the
relevant discussion about this topic. In this particular case, the usage
of 'uint64_t' escaped headers_check as these macros are not being called
here. However, the following program triggers a compilation error:

#include <drm/drm_fourcc.h>

int main()
{
unsigned long x = AMD_FMT_MOD_CLEAR(RB);
return 0;
}

gcc error:
drm.c:5:27: error: ‘uint64_t’ undeclared (first use in this function)
5 | unsigned long x = AMD_FMT_MOD_CLEAR(RB);
| ^~~~~~~~~~~~~~~~~

This patch changes AMD_FMT_MOD_{SET,CLEAR} macros to use the correct
integer types, which fixes the above issue.

[1] https://lkml.org/lkml/2019/6/5/18

Fixes: 8ba16d599374 ("drm/fourcc: Add AMD DRM modifiers.")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Carlos Llamas and committed by
Alex Deucher
3d313f09 f12d07d6

+2 -2
+2 -2
include/uapi/drm/drm_fourcc.h
··· 1446 1446 #define AMD_FMT_MOD_PIPE_MASK 0x7 1447 1447 1448 1448 #define AMD_FMT_MOD_SET(field, value) \ 1449 - ((uint64_t)(value) << AMD_FMT_MOD_##field##_SHIFT) 1449 + ((__u64)(value) << AMD_FMT_MOD_##field##_SHIFT) 1450 1450 #define AMD_FMT_MOD_GET(field, value) \ 1451 1451 (((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK) 1452 1452 #define AMD_FMT_MOD_CLEAR(field) \ 1453 - (~((uint64_t)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT)) 1453 + (~((__u64)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT)) 1454 1454 1455 1455 #if defined(__cplusplus) 1456 1456 }