Message ID | 20230505205101.54569-4-sakari.ailus@linux.intel.com |
---|---|
State | Superseded |
Headers | show |
Series | Random cleanups | expand |
Hi Sakari, Thank you for the patch. On Fri, May 05, 2023 at 11:51:01PM +0300, Sakari Ailus wrote: > Use unsigned int values annoted by "U" for u32 fields. While this is a > good practice, there doesn't appear to be a bug that this patch would fix. > > The patch has been generated using the following command: > > perl -i -pe 's/\([0-9]+\K <</U <</g' -- include/uapi/linux/media.h How about using the _BITUL() macro from include/uapi/linux/const.h ? > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > include/uapi/linux/media.h | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h > index 3ddadaea849f..edb8dfef9eba 100644 > --- a/include/uapi/linux/media.h > +++ b/include/uapi/linux/media.h > @@ -140,8 +140,8 @@ struct media_device_info { > #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002) > > /* Entity flags */ > -#define MEDIA_ENT_FL_DEFAULT (1 << 0) > -#define MEDIA_ENT_FL_CONNECTOR (1 << 1) > +#define MEDIA_ENT_FL_DEFAULT (1U << 0) > +#define MEDIA_ENT_FL_CONNECTOR (1U << 1) > > /* OR with the entity id value to find the next entity */ > #define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) > @@ -205,9 +205,9 @@ struct media_entity_desc { > }; > }; > > -#define MEDIA_PAD_FL_SINK (1 << 0) > -#define MEDIA_PAD_FL_SOURCE (1 << 1) > -#define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) > +#define MEDIA_PAD_FL_SINK (1U << 0) > +#define MEDIA_PAD_FL_SOURCE (1U << 1) > +#define MEDIA_PAD_FL_MUST_CONNECT (1U << 2) > > struct media_pad_desc { > __u32 entity; /* entity ID */ > @@ -216,14 +216,14 @@ struct media_pad_desc { > __u32 reserved[2]; > }; > > -#define MEDIA_LNK_FL_ENABLED (1 << 0) > -#define MEDIA_LNK_FL_IMMUTABLE (1 << 1) > -#define MEDIA_LNK_FL_DYNAMIC (1 << 2) > +#define MEDIA_LNK_FL_ENABLED (1U << 0) > +#define MEDIA_LNK_FL_IMMUTABLE (1U << 1) > +#define MEDIA_LNK_FL_DYNAMIC (1U << 2) > > #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) > -# define MEDIA_LNK_FL_DATA_LINK (0 << 28) > -# define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) > -# define MEDIA_LNK_FL_ANCILLARY_LINK (2 << 28) > +# define MEDIA_LNK_FL_DATA_LINK (0U << 28) > +# define MEDIA_LNK_FL_INTERFACE_LINK (1U << 28) > +# define MEDIA_LNK_FL_ANCILLARY_LINK (2U << 28) > > struct media_link_desc { > struct media_pad_desc source; > @@ -293,7 +293,7 @@ struct media_links_enum { > * struct media_device_info. > */ > #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ > - ((media_version) >= ((4 << 16) | (19 << 8) | 0)) > + ((media_version) >= ((4U << 16) | (19U << 8) | 0)) > > struct media_v2_entity { > __u32 id; > @@ -328,7 +328,7 @@ struct media_v2_interface { > * struct media_device_info. > */ > #define MEDIA_V2_PAD_HAS_INDEX(media_version) \ > - ((media_version) >= ((4 << 16) | (19 << 8) | 0)) > + ((media_version) >= ((4U << 16) | (19U << 8) | 0)) > > struct media_v2_pad { > __u32 id; > @@ -432,7 +432,7 @@ struct media_v2_topology { > #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) > > /* Obsolete symbol for media_version, no longer used in the kernel */ > -#define MEDIA_API_VERSION ((0 << 16) | (1 << 8) | 0) > +#define MEDIA_API_VERSION ((0U << 16) | (1U << 8) | 0) > > #endif >
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 3ddadaea849f..edb8dfef9eba 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -140,8 +140,8 @@ struct media_device_info { #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002) /* Entity flags */ -#define MEDIA_ENT_FL_DEFAULT (1 << 0) -#define MEDIA_ENT_FL_CONNECTOR (1 << 1) +#define MEDIA_ENT_FL_DEFAULT (1U << 0) +#define MEDIA_ENT_FL_CONNECTOR (1U << 1) /* OR with the entity id value to find the next entity */ #define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) @@ -205,9 +205,9 @@ struct media_entity_desc { }; }; -#define MEDIA_PAD_FL_SINK (1 << 0) -#define MEDIA_PAD_FL_SOURCE (1 << 1) -#define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) +#define MEDIA_PAD_FL_SINK (1U << 0) +#define MEDIA_PAD_FL_SOURCE (1U << 1) +#define MEDIA_PAD_FL_MUST_CONNECT (1U << 2) struct media_pad_desc { __u32 entity; /* entity ID */ @@ -216,14 +216,14 @@ struct media_pad_desc { __u32 reserved[2]; }; -#define MEDIA_LNK_FL_ENABLED (1 << 0) -#define MEDIA_LNK_FL_IMMUTABLE (1 << 1) -#define MEDIA_LNK_FL_DYNAMIC (1 << 2) +#define MEDIA_LNK_FL_ENABLED (1U << 0) +#define MEDIA_LNK_FL_IMMUTABLE (1U << 1) +#define MEDIA_LNK_FL_DYNAMIC (1U << 2) #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) -# define MEDIA_LNK_FL_DATA_LINK (0 << 28) -# define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) -# define MEDIA_LNK_FL_ANCILLARY_LINK (2 << 28) +# define MEDIA_LNK_FL_DATA_LINK (0U << 28) +# define MEDIA_LNK_FL_INTERFACE_LINK (1U << 28) +# define MEDIA_LNK_FL_ANCILLARY_LINK (2U << 28) struct media_link_desc { struct media_pad_desc source; @@ -293,7 +293,7 @@ struct media_links_enum { * struct media_device_info. */ #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ - ((media_version) >= ((4 << 16) | (19 << 8) | 0)) + ((media_version) >= ((4U << 16) | (19U << 8) | 0)) struct media_v2_entity { __u32 id; @@ -328,7 +328,7 @@ struct media_v2_interface { * struct media_device_info. */ #define MEDIA_V2_PAD_HAS_INDEX(media_version) \ - ((media_version) >= ((4 << 16) | (19 << 8) | 0)) + ((media_version) >= ((4U << 16) | (19U << 8) | 0)) struct media_v2_pad { __u32 id; @@ -432,7 +432,7 @@ struct media_v2_topology { #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) /* Obsolete symbol for media_version, no longer used in the kernel */ -#define MEDIA_API_VERSION ((0 << 16) | (1 << 8) | 0) +#define MEDIA_API_VERSION ((0U << 16) | (1U << 8) | 0) #endif
Use unsigned int values annoted by "U" for u32 fields. While this is a good practice, there doesn't appear to be a bug that this patch would fix. The patch has been generated using the following command: perl -i -pe 's/\([0-9]+\K <</U <</g' -- include/uapi/linux/media.h Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- include/uapi/linux/media.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)