Random cleanups
Subsystems (5)
Sakari Ailus
maintainerv2 cover Random cleanups
Hi all,
These three patches are seemingly random cleanups but are a pre-requisite for another set for supporting generic metadata formats. I'll post that set separately. These three should be merged independently though.
since v1:
- Use _BITUL macro instead.
- Also add U after 0.
Sakari Ailus (3):
media: mc: Make media_get_pad_index() use pad type flag
media: Documentation: Rename meta format files
media: uapi: Use _BITUL macro for assigning bits in u32 fields
.../userspace-api/media/v4l/meta-formats.rst | 14 +++----
...{pixfmt-meta-d4xx.rst => metafmt-d4xx.rst} | 0
...-intel-ipu3.rst => metafmt-intel-ipu3.rst} | 0
...fmt-meta-rkisp1.rst => metafmt-rkisp1.rst} | 0
.../{pixfmt-meta-uvc.rst => metafmt-uvc.rst} | 0
...ixfmt-meta-vivid.rst => metafmt-vivid.rst} | 0
...meta-vsp1-hgo.rst => metafmt-vsp1-hgo.rst} | 0
...meta-vsp1-hgt.rst => metafmt-vsp1-hgt.rst} | 0
MAINTAINERS | 4 +-
drivers/media/dvb-core/dvbdev.c | 4 +-
drivers/media/mc/mc-entity.c | 16 +++-----
drivers/media/usb/au0828/au0828-core.c | 2 +-
drivers/media/v4l2-core/v4l2-mc.c | 38 ++++++++++++-------
include/media/media-entity.h | 4 +-
include/uapi/linux/media.h | 30 +++++++--------
15 files changed, 59 insertions(+), 53 deletions(-)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-d4xx.rst => metafmt-d4xx.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-intel-ipu3.rst => metafmt-intel-ipu3.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-rkisp1.rst => metafmt-rkisp1.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-uvc.rst => metafmt-uvc.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-vivid.rst => metafmt-vivid.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-vsp1-hgo.rst => metafmt-vsp1-hgo.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-vsp1-hgt.rst => metafmt-vsp1-hgt.rst} (100%)Signature · 1 line
2.30.2
This was meant to be v2.
Signature · 1 line
Sakari Ailus
Sakari Ailus
maintainerPATCH v2 1/3 media: mc: Make media_get_pad_index() use pad type flag
In reply to Sakari AilusUse the pad flag specifying the pad type instead of a boolean in preparation for internal source pads.
Also make the loop variable unsigned.
--- drivers/media/dvb-core/dvbdev.c | 4 +-- drivers/media/mc/mc-entity.c | 16 ++++------- drivers/media/usb/au0828/au0828-core.c | 2 +- drivers/media/v4l2-core/v4l2-mc.c | 38 +++++++++++++++++--------- include/media/media-entity.h | 4 +-- 5 files changed, 35 insertions(+), 29 deletions(-)
drivers/media/dvb-core/dvbdev.c +2 -2
@@ -707,7 +707,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap,MEDIA_LNK_FL_ENABLED , false); }else { - pad_sink =media_get_pad_index (tuner, true, + pad_sink =media_get_pad_index (tuner,MEDIA_PAD_FL_SINK ,PAD_SIGNAL_ANALOG );if (pad_sink <0 )return -EINVAL ;
@@ -725,7 +725,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap,if (ntuner && ndemod) {/* NOTE: first found tuner source pad presumed correct */ - pad_source =media_get_pad_index (tuner, false, + pad_source =media_get_pad_index (tuner,MEDIA_PAD_FL_SOURCE ,PAD_SIGNAL_ANALOG );if (pad_source <0 )return -EINVAL ;
drivers/media/mc/mc-entity.c +5 -11
@@ -1052,25 +1052,19 @@ static void __media_entity_remove_link(struct media_entity *entity,kfree (link); } -int media_get_pad_index (struct media_entity *entity,bool is_sink, +int media_get_pad_index (struct media_entity *entity,u32 pad_type,enum media_pad_signal_type sig_type) { -int i; -bool pad_is_sink; +unsigned int i;if (!entity)return -EINVAL ;for (i =0 ; i < entity->num_pads; i++) { -if (entity->pads[i].flags &MEDIA_PAD_FL_SINK ) - pad_is_sink = true; -else if (entity->pads[i].flags &MEDIA_PAD_FL_SOURCE ) - pad_is_sink = false; -else -continue ;/* This is an error! */ - -if (pad_is_sink != is_sink) +if ((entity->pads[i].flags & + (MEDIA_PAD_FL_SINK |MEDIA_PAD_FL_SOURCE )) != pad_type)continue ; +if (entity->pads[i].sig_type == sig_type)return i; }
drivers/media/usb/au0828/au0828-core.c +1 -1
@@ -250,7 +250,7 @@ static void au0828_media_graph_notify(struct media_entity *new, create_link:if (decoder && mixer) { - ret =media_get_pad_index (decoder, false, + ret =media_get_pad_index (decoder,MEDIA_PAD_FL_SOURCE ,PAD_SIGNAL_AUDIO );if (ret >=0 ) ret = media_create_pad_link(decoder, ret,
drivers/media/v4l2-core/v4l2-mc.c +25 -13
@@ -105,9 +105,11 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)/* Link the tuner and IF video output pads */ if (tuner) {if (if_vid) { - pad_source =media_get_pad_index (tuner, false, + pad_source =media_get_pad_index (tuner, +MEDIA_PAD_FL_SOURCE ,PAD_SIGNAL_ANALOG ); - pad_sink =media_get_pad_index (if_vid, true, + pad_sink =media_get_pad_index (if_vid, +MEDIA_PAD_FL_SINK ,PAD_SIGNAL_ANALOG );if (pad_source <0 || pad_sink <0 ) { dev_warn(mdev->dev, "Couldn't get tuner and/or PLL pad(s): (%d, %d)\n",
@@ -122,9 +124,11 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)return ret; } - pad_source =media_get_pad_index (if_vid, false, + pad_source =media_get_pad_index (if_vid, +MEDIA_PAD_FL_SOURCE ,PAD_SIGNAL_ANALOG ); - pad_sink =media_get_pad_index (decoder, true, + pad_sink =media_get_pad_index (decoder, +MEDIA_PAD_FL_SINK ,PAD_SIGNAL_ANALOG );if (pad_source <0 || pad_sink <0 ) { dev_warn(mdev->dev, "get decoder and/or PLL pad(s): (%d, %d)\n",
@@ -139,9 +143,11 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)return ret; } }else { - pad_source =media_get_pad_index (tuner, false, + pad_source =media_get_pad_index (tuner, +MEDIA_PAD_FL_SOURCE ,PAD_SIGNAL_ANALOG ); - pad_sink =media_get_pad_index (decoder, true, + pad_sink =media_get_pad_index (decoder, +MEDIA_PAD_FL_SINK ,PAD_SIGNAL_ANALOG );if (pad_source <0 || pad_sink <0 ) { dev_warn(mdev->dev, "couldn't get tuner and/or decoder pad(s): (%d, %d)\n",
@@ -156,9 +162,11 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) }if (if_aud) { - pad_source =media_get_pad_index (tuner, false, + pad_source =media_get_pad_index (tuner, +MEDIA_PAD_FL_SOURCE ,PAD_SIGNAL_AUDIO ); - pad_sink =media_get_pad_index (if_aud, true, + pad_sink =media_get_pad_index (if_aud, +MEDIA_PAD_FL_SINK ,PAD_SIGNAL_AUDIO );if (pad_source <0 || pad_sink <0 ) { dev_warn(mdev->dev, "couldn't get tuner and/or decoder pad(s) for audio: (%d, %d)\n",
@@ -180,7 +188,8 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)/* Create demod to V4L, VBI and SDR radio links */ if (io_v4l) { - pad_source =media_get_pad_index (decoder, false,PAD_SIGNAL_DV ); + pad_source =media_get_pad_index (decoder,MEDIA_PAD_FL_SOURCE , +PAD_SIGNAL_DV );if (pad_source <0 ) {dev_warn (mdev->dev,"couldn't get decoder output pad for V4L I/O\n" );return -EINVAL ;
@@ -195,7 +204,8 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) }if (io_swradio) { - pad_source =media_get_pad_index (decoder, false,PAD_SIGNAL_DV ); + pad_source =media_get_pad_index (decoder,MEDIA_PAD_FL_SOURCE , +PAD_SIGNAL_DV );if (pad_source <0 ) {dev_warn (mdev->dev,"couldn't get decoder output pad for SDR\n" );return -EINVAL ;
@@ -210,7 +220,8 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) }if (io_vbi) { - pad_source =media_get_pad_index (decoder, false,PAD_SIGNAL_DV ); + pad_source =media_get_pad_index (decoder,MEDIA_PAD_FL_SOURCE , +PAD_SIGNAL_DV );if (pad_source <0 ) {dev_warn (mdev->dev,"couldn't get decoder output pad for VBI\n" );return -EINVAL ;
@@ -231,7 +242,7 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)case MEDIA_ENT_F_CONN_RF :if (!tuner)continue ; - pad_sink =media_get_pad_index (tuner, true, + pad_sink =media_get_pad_index (tuner,MEDIA_PAD_FL_SINK ,PAD_SIGNAL_ANALOG );if (pad_sink <0 ) {dev_warn (mdev->dev,"couldn't get tuner analog pad sink\n" );
@@ -243,7 +254,8 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)break ;case MEDIA_ENT_F_CONN_SVIDEO :case MEDIA_ENT_F_CONN_COMPOSITE : - pad_sink =media_get_pad_index (decoder, true, + pad_sink =media_get_pad_index (decoder, +MEDIA_PAD_FL_SINK ,PAD_SIGNAL_ANALOG );if (pad_sink <0 ) {dev_warn (mdev->dev,"couldn't get decoder analog pad sink\n" );
include/media/media-entity.h +2 -2
@@ -741,7 +741,7 @@ static inline void media_entity_cleanup(struct media_entity *entity) {}* media_get_pad_index() - retrieves a pad index from an entity * * @entity: entity where the pads belong -* @is_sink: true if the pad is a sink, false if it is a source +* @pad_type: the type of the pad, one of MEDIA_PAD_FL_* pad types * @sig_type: type of signal of the pad to be search * * This helper function finds the first pad index inside an entity that
@@ -752,7 +752,7 @@ static inline void media_entity_cleanup(struct media_entity *entity) {}* On success, return the pad number. If the pad was not found or the media * entity is a NULL pointer, return -EINVAL. */ -int media_get_pad_index (struct media_entity *entity,bool is_sink, +int media_get_pad_index (struct media_entity *entity,u32 pad_type,enum media_pad_signal_type sig_type);/**
Signature · 1 line
2.30.2
Sakari Ailus
maintainerPATCH v2 2/3 media: Documentation: Rename meta format files
In reply to Sakari AilusRename meta format files, using "metafmt" prefix instead of "pixfmt-meta". These are metadata formats, not pixel formats.
---
.../userspace-api/media/v4l/meta-formats.rst | 14 +++++++-------
.../v4l/{pixfmt-meta-d4xx.rst => metafmt-d4xx.rst} | 0
...-meta-intel-ipu3.rst => metafmt-intel-ipu3.rst} | 0
.../{pixfmt-meta-rkisp1.rst => metafmt-rkisp1.rst} | 0
.../v4l/{pixfmt-meta-uvc.rst => metafmt-uvc.rst} | 0
.../{pixfmt-meta-vivid.rst => metafmt-vivid.rst} | 0
...xfmt-meta-vsp1-hgo.rst => metafmt-vsp1-hgo.rst} | 0
...xfmt-meta-vsp1-hgt.rst => metafmt-vsp1-hgt.rst} | 0
MAINTAINERS | 4 ++--
9 files changed, 9 insertions(+), 9 deletions(-)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-d4xx.rst => metafmt-d4xx.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-intel-ipu3.rst => metafmt-intel-ipu3.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-rkisp1.rst => metafmt-rkisp1.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-uvc.rst => metafmt-uvc.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-vivid.rst => metafmt-vivid.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-vsp1-hgo.rst => metafmt-vsp1-hgo.rst} (100%)
rename Documentation/userspace-api/media/v4l/{pixfmt-meta-vsp1-hgt.rst => metafmt-vsp1-hgt.rst} (100%)Documentation/userspace-api/media/v4l/meta-formats.rst +7 -7
@@ -12,10 +12,10 @@ These formats are used for the :ref:`metadata` interface only. .. toctree:: :maxdepth: 1 - pixfmt-meta-d4xx - pixfmt-meta-intel-ipu3 - pixfmt-meta-rkisp1 - pixfmt-meta-uvc - pixfmt-meta-vsp1-hgo - pixfmt-meta-vsp1-hgt - pixfmt-meta-vivid + metafmt-d4xx + metafmt-intel-ipu3 + metafmt-rkisp1 + metafmt-uvc + metafmt-vsp1-hgo + metafmt-vsp1-hgt + metafmt-vivid
Documentation/userspace-api/media/v4l/metafmt-d4xx.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-d4xx.rst +0 -0
Documentation/userspace-api/media/v4l/metafmt-intel-ipu3.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-intel-ipu3.rst +0 -0
Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-rkisp1.rst +0 -0
Documentation/userspace-api/media/v4l/metafmt-uvc.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-uvc.rst +0 -0
Documentation/userspace-api/media/v4l/metafmt-vivid.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-vivid.rst +0 -0
Documentation/userspace-api/media/v4l/metafmt-vsp1-hgo.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-vsp1-hgo.rst +0 -0
Documentation/userspace-api/media/v4l/metafmt-vsp1-hgt.rst renamed from Documentation/userspace-api/media/v4l/pixfmt-meta-vsp1-hgt.rst +0 -0
MAINTAINERS +2 -2
@@ -10359,7 +10359,7 @@ L: [email protected] S: Maintained F: Documentation/admin-guide/media/ipu3.rst F: Documentation/admin-guide/media/ipu3_rcb.svg -F: Documentation/userspace-api/media/v4l/pixfmt-meta-intel-ipu3.rst +F: Documentation/userspace-api/media/v4l/metafmt-intel-ipu3.rst F: drivers/staging/media/ipu3/ INTEL IXP4XX CRYPTO SUPPORT
@@ -18026,7 +18026,7 @@ L: [email protected] S: Maintained F: Documentation/admin-guide/media/rkisp1.rst F: Documentation/devicetree/bindings/media/rockchip-isp1.yaml -F: Documentation/userspace-api/media/v4l/pixfmt-meta-rkisp1.rst +F: Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst F: drivers/media/platform/rockchip/rkisp1 F: include/uapi/linux/rkisp1-config.h
Signature · 1 line
2.30.2
Sakari Ailus
maintainerPATCH v2 3/3 media: uapi: Use _BITUL macro for assigning bits in u32 fields
In reply to Sakari AilusUse _BITUL macro for assigning bits in u32 fields. While this is a good practice, there doesn't appear to be a bug that this patch would fix. For multi-bit fields, use U notation (for unsigned int).
The patch has been generated using the following command:
perl -i -pe 's/\([0-9]+\K <</U <</g; s/\(1U\s*<<\s*([0-9]+)\)$/_BITUL($1)/ if ! /MEDIA_LNK_FL_INTERFACE_LINK/ s/\|\s*0\K\)/U\)/' -- include/uapi/linux/media.h
--- include/uapi/linux/media.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
include/uapi/linux/media.h +15 -15
@@ -140,11 +140,11 @@ 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 _BITUL(0) +#define MEDIA_ENT_FL_CONNECTOR _BITUL(1)/* OR with the entity id value to find the next entity */ -#define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) +#define MEDIA_ENT_ID_FLAG_NEXT _BITUL(31)struct media_entity_desc {__u32 id;
@@ -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 _BITUL(0) +#define MEDIA_PAD_FL_SOURCE _BITUL(1) +#define MEDIA_PAD_FL_MUST_CONNECT _BITUL(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 _BITUL(0) +#define MEDIA_LNK_FL_IMMUTABLE _BITUL(1) +#define MEDIA_LNK_FL_DYNAMIC _BITUL(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) | 0U))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) | 0U))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) | 0U)#endif
Signature · 1 line
2.30.2
Re: [PATCH 3/3] media: uapi: Use _BITUL macro for assigning bits in u32 fields
Hi Sakari,
Thank you for the patch.
Quoted 6 lines · Sakari Ailus
Use
_BITULmacro for assigning bits in u32 fields. While this is a good practice, there doesn't appear to be a bug that this patch would fix. For multi-bit fields, use U notation (for unsigned int).The patch has been generated using the following command:
Quoted 7 lines
perl -i -pe 's/\([0-9]+\K <</U <</g; s/\(1U\s*<<\s*([0-9]+)\)$/_BITUL($1)/ if ! /MEDIA_LNK_FL_INTERFACE_LINK/ s/\|\s*0\K\)/U\)/' -- include/uapi/linux/media.hSigned-off-by Sakari Ailus <[email protected]>
This could have been two patches are you make two unrelated modifications, but I don't mind much.
Quoted 84 lines
--- include/uapi/linux/media.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)include/uapi/linux/media.h +15
-15@@ -140,11 +140,11 @@ 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 _BITUL(0) +#define MEDIA_ENT_FL_CONNECTOR _BITUL(1)/* OR with the entity id value to find the next entity */ -#define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) +#define MEDIA_ENT_ID_FLAG_NEXT _BITUL(31)struct media_entity_desc {__u32 id;@@ -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 _BITUL(0) +#define MEDIA_PAD_FL_SOURCE _BITUL(1) +#define MEDIA_PAD_FL_MUST_CONNECT _BITUL(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 _BITUL(0) +#define MEDIA_LNK_FL_IMMUTABLE _BITUL(1) +#define MEDIA_LNK_FL_DYNAMIC _BITUL(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) | 0U))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) | 0U))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) | 0U)#endif
Signature · 3 lines
Regards, Laurent Pinchart
kernel test robot
build botRe: [PATCH 3/3] media: uapi: Use _BITUL macro for assigning bits in u32 fields
In reply to Sakari Ailuskernel test robot noticed the following build warnings:
Hi Sakari,
kernel test robot noticed the following build warnings:
[auto build test WARNING on media-tree/master]
[also build test WARNING on linus/master sailus-media-tree/streams v6.4-rc1 next-20230508] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/media-mc-Make-media_get_pad_index-use-pad-type-flag/20230508-173012 base: git://linuxtv.org/media_tree.git master patch link: https://lore.kernel.org/r/20230508091753.80803-4-sakari.ailus%40linux.intel.com patch subject: [PATCH 3/3] media: uapi: Use _BITUL macro for assigning bits in u32 fields config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20230508/[email protected]/config) compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1462451478f4e2ce6cc6364c2c8aacdb2db57d6b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sakari-Ailus/media-mc-Make-media_get_pad_index-use-pad-type-flag/20230508-173012
git checkout 1462451478f4e2ce6cc6364c2c8aacdb2db57d6b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/media/i2c/ drivers/media/platform/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/acpi.h:15,
from include/linux/i2c.h:13,
from drivers/media/i2c/tvp5150.c:8:
drivers/media/i2c/tvp5150.c: In function 'tvp5150_link_setup':
>> drivers/media/i2c/tvp5150.c:1332:40: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long unsigned int' [-Wformat=]
1332 | dev_dbg_lvl(sd->dev, 1, debug, "link setup '%s':%d->'%s':%d[%d]",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:129:41: note: in definition of macro 'dev_printk'
129 | _dev_printk(level, dev, fmt, ##__VA_ARGS__); \
| ^~~
drivers/media/i2c/tvp5150.c:1332:9: note: in expansion of macro 'dev_dbg_lvl'
1332 | dev_dbg_lvl(sd->dev, 1, debug, "link setup '%s':%d->'%s':%d[%d]",
| ^~~~~~~~~~~
drivers/media/i2c/tvp5150.c:1332:70: note: format string is defined here
1332 | dev_dbg_lvl(sd->dev, 1, debug, "link setup '%s':%d->'%s':%d[%d]",
| ~^
| |
| int
| %ld
drivers/media/i2c/tvp5150.c:1338:29: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long unsigned int' [-Wformat=]
1338 | "link setup '%s':%d->'%s':%d[%d]",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:129:41: note: in definition of macro 'dev_printk'
129 | _dev_printk(level, dev, fmt, ##__VA_ARGS__); \
| ^~~
drivers/media/i2c/tvp5150.c:1337:17: note: in expansion of macro 'dev_dbg_lvl'
1337 | dev_dbg_lvl(sd->dev, 1, debug,
| ^~~~~~~~~~~
drivers/media/i2c/tvp5150.c:1338:59: note: format string is defined here
1338 | "link setup '%s':%d->'%s':%d[%d]",
| ~^
| |
| int
| %ld
--
In file included from include/linux/printk.h:564,
from include/asm-generic/bug.h:22,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:16,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from include/linux/mm_types_task.h:13,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from drivers/media/platform/video-mux.c:10:
drivers/media/platform/video-mux.c: In function 'video_mux_link_setup':
>> drivers/media/platform/video-mux.c:67:26: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long unsigned int' [-Wformat=]
67 | dev_dbg(sd->dev, "link setup '%s':%d->'%s':%d[%d]",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:223:29: note: in definition of macro '__dynamic_func_call_cls'
223 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:249:9: note: in expansion of macro '_dynamic_func_call_cls'
249 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:272:9: note: in expansion of macro '_dynamic_func_call'
272 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/media/platform/video-mux.c:67:9: note: in expansion of macro 'dev_dbg'
67 | dev_dbg(sd->dev, "link setup '%s':%d->'%s':%d[%d]",
| ^~~~~~~
drivers/media/platform/video-mux.c:67:56: note: format string is defined here
67 | dev_dbg(sd->dev, "link setup '%s':%d->'%s':%d[%d]",
| ~^
| |
| int
| %ldvim +1332 drivers/media/i2c/tvp5150.c
0556f1d580d4c1 Marco Felsch 2020-03-12 1299
0556f1d580d4c1 Marco Felsch 2020-03-12 1300 static int tvp5150_s_routing(struct v4l2_subdev *sd, u32 input, u32 output,
0556f1d580d4c1 Marco Felsch 2020-03-12 1301 u32 config);
0556f1d580d4c1 Marco Felsch 2020-03-12 1302
0556f1d580d4c1 Marco Felsch 2020-03-12 1303 static int tvp5150_link_setup(struct media_entity *entity,
0556f1d580d4c1 Marco Felsch 2020-03-12 1304 const struct media_pad *tvp5150_pad,
0556f1d580d4c1 Marco Felsch 2020-03-12 1305 const struct media_pad *remote, u32 flags)
0556f1d580d4c1 Marco Felsch 2020-03-12 1306 {
0556f1d580d4c1 Marco Felsch 2020-03-12 1307 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
0556f1d580d4c1 Marco Felsch 2020-03-12 1308 struct tvp5150 *decoder = to_tvp5150(sd);
0556f1d580d4c1 Marco Felsch 2020-03-12 1309 struct media_pad *other_tvp5150_pad =
0556f1d580d4c1 Marco Felsch 2020-03-12 1310 &decoder->pads[tvp5150_pad->index ^ 1];
0556f1d580d4c1 Marco Felsch 2020-03-12 1311 struct v4l2_fwnode_connector *v4l2c;
0556f1d580d4c1 Marco Felsch 2020-03-12 1312 bool is_svideo = false;
0556f1d580d4c1 Marco Felsch 2020-03-12 1313 unsigned int i;
0556f1d580d4c1 Marco Felsch 2020-03-12 1314 int err;
0556f1d580d4c1 Marco Felsch 2020-03-12 1315
0556f1d580d4c1 Marco Felsch 2020-03-12 1316 /*
0556f1d580d4c1 Marco Felsch 2020-03-12 1317 * The TVP5150 state is determined by the enabled sink pad link(s).
0556f1d580d4c1 Marco Felsch 2020-03-12 1318 * Enabling or disabling the source pad link has no effect.
0556f1d580d4c1 Marco Felsch 2020-03-12 1319 */
0556f1d580d4c1 Marco Felsch 2020-03-12 1320 if (tvp5150_pad->flags & MEDIA_PAD_FL_SOURCE)
0556f1d580d4c1 Marco Felsch 2020-03-12 1321 return 0;
0556f1d580d4c1 Marco Felsch 2020-03-12 1322
0556f1d580d4c1 Marco Felsch 2020-03-12 1323 /* Check if the svideo connector should be enabled */
0556f1d580d4c1 Marco Felsch 2020-03-12 1324 for (i = 0; i < decoder->connectors_num; i++) {
0556f1d580d4c1 Marco Felsch 2020-03-12 1325 if (remote->entity == &decoder->connectors[i].ent) {
0556f1d580d4c1 Marco Felsch 2020-03-12 1326 v4l2c = &decoder->connectors[i].base;
0556f1d580d4c1 Marco Felsch 2020-03-12 1327 is_svideo = v4l2c->type == V4L2_CONN_SVIDEO;
0556f1d580d4c1 Marco Felsch 2020-03-12 1328 break;
0556f1d580d4c1 Marco Felsch 2020-03-12 1329 }
0556f1d580d4c1 Marco Felsch 2020-03-12 1330 }
0556f1d580d4c1 Marco Felsch 2020-03-12 1331
0556f1d580d4c1 Marco Felsch 2020-03-12 @1332 dev_dbg_lvl(sd->dev, 1, debug, "link setup '%s':%d->'%s':%d[%d]",
0556f1d580d4c1 Marco Felsch 2020-03-12 1333 remote->entity->name, remote->index,
0556f1d580d4c1 Marco Felsch 2020-03-12 1334 tvp5150_pad->entity->name, tvp5150_pad->index,
0556f1d580d4c1 Marco Felsch 2020-03-12 1335 flags & MEDIA_LNK_FL_ENABLED);
0556f1d580d4c1 Marco Felsch 2020-03-12 1336 if (is_svideo)
0556f1d580d4c1 Marco Felsch 2020-03-12 1337 dev_dbg_lvl(sd->dev, 1, debug,
0556f1d580d4c1 Marco Felsch 2020-03-12 1338 "link setup '%s':%d->'%s':%d[%d]",
0556f1d580d4c1 Marco Felsch 2020-03-12 1339 remote->entity->name, remote->index,
0556f1d580d4c1 Marco Felsch 2020-03-12 1340 other_tvp5150_pad->entity->name,
0556f1d580d4c1 Marco Felsch 2020-03-12 1341 other_tvp5150_pad->index,
0556f1d580d4c1 Marco Felsch 2020-03-12 1342 flags & MEDIA_LNK_FL_ENABLED);
0556f1d580d4c1 Marco Felsch 2020-03-12 1343
0556f1d580d4c1 Marco Felsch 2020-03-12 1344 /*
0556f1d580d4c1 Marco Felsch 2020-03-12 1345 * The TVP5150 has an internal mux which allows the following setup:
0556f1d580d4c1 Marco Felsch 2020-03-12 1346 *
0556f1d580d4c1 Marco Felsch 2020-03-12 1347 * comp-connector1 --\
0556f1d580d4c1 Marco Felsch 2020-03-12 1348 * |---> AIP1A
0556f1d580d4c1 Marco Felsch 2020-03-12 1349 * /
0556f1d580d4c1 Marco Felsch 2020-03-12 1350 * svideo-connector -|
0556f1d580d4c1 Marco Felsch 2020-03-12 1351 * \
0556f1d580d4c1 Marco Felsch 2020-03-12 1352 * |---> AIP1B
0556f1d580d4c1 Marco Felsch 2020-03-12 1353 * comp-connector2 --/
0556f1d580d4c1 Marco Felsch 2020-03-12 1354 *
0556f1d580d4c1 Marco Felsch 2020-03-12 1355 * We can't rely on user space that the current connector gets disabled
0556f1d580d4c1 Marco Felsch 2020-03-12 1356 * first before enabling the new connector. Disable all active
0556f1d580d4c1 Marco Felsch 2020-03-12 1357 * connector links to be on the safe side.
0556f1d580d4c1 Marco Felsch 2020-03-12 1358 */
0556f1d580d4c1 Marco Felsch 2020-03-12 1359 err = tvp5150_disable_all_input_links(decoder);
0556f1d580d4c1 Marco Felsch 2020-03-12 1360 if (err)
0556f1d580d4c1 Marco Felsch 2020-03-12 1361 return err;
0556f1d580d4c1 Marco Felsch 2020-03-12 1362
0556f1d580d4c1 Marco Felsch 2020-03-12 1363 tvp5150_s_routing(sd, is_svideo ? TVP5150_SVIDEO : tvp5150_pad->index,
0556f1d580d4c1 Marco Felsch 2020-03-12 1364 flags & MEDIA_LNK_FL_ENABLED ? TVP5150_NORMAL :
0556f1d580d4c1 Marco Felsch 2020-03-12 1365 TVP5150_BLACK_SCREEN, 0);
0556f1d580d4c1 Marco Felsch 2020-03-12 1366
0556f1d580d4c1 Marco Felsch 2020-03-12 1367 if (flags & MEDIA_LNK_FL_ENABLED) {
baf178219478c2 Marco Felsch 2020-03-12 1368 struct v4l2_fwnode_connector_analog *v4l2ca;
baf178219478c2 Marco Felsch 2020-03-12 1369 u32 new_norm;
baf178219478c2 Marco Felsch 2020-03-12 1370
0556f1d580d4c1 Marco Felsch 2020-03-12 1371 /*
0556f1d580d4c1 Marco Felsch 2020-03-12 1372 * S-Video connector is conneted to both ports AIP1A and AIP1B.
0556f1d580d4c1 Marco Felsch 2020-03-12 1373 * Both links must be enabled in one-shot regardless which link
0556f1d580d4c1 Marco Felsch 2020-03-12 1374 * the user requests.
0556f1d580d4c1 Marco Felsch 2020-03-12 1375 */
0556f1d580d4c1 Marco Felsch 2020-03-12 1376 if (is_svideo) {
0556f1d580d4c1 Marco Felsch 2020-03-12 1377 err = tvp5150_set_link((struct media_pad *)remote,
0556f1d580d4c1 Marco Felsch 2020-03-12 1378 other_tvp5150_pad, flags);
0556f1d580d4c1 Marco Felsch 2020-03-12 1379 if (err)
0556f1d580d4c1 Marco Felsch 2020-03-12 1380 return err;
0556f1d580d4c1 Marco Felsch 2020-03-12 1381 }
baf178219478c2 Marco Felsch 2020-03-12 1382
baf178219478c2 Marco Felsch 2020-03-12 1383 if (!decoder->connectors_num)
baf178219478c2 Marco Felsch 2020-03-12 1384 return 0;
baf178219478c2 Marco Felsch 2020-03-12 1385
baf178219478c2 Marco Felsch 2020-03-12 1386 /* Update the current connector */
baf178219478c2 Marco Felsch 2020-03-12 1387 decoder->cur_connector =
baf178219478c2 Marco Felsch 2020-03-12 1388 container_of(remote, struct tvp5150_connector, pad);
baf178219478c2 Marco Felsch 2020-03-12 1389
baf178219478c2 Marco Felsch 2020-03-12 1390 /*
baf178219478c2 Marco Felsch 2020-03-12 1391 * Do nothing if the new connector supports the same tv-norms as
baf178219478c2 Marco Felsch 2020-03-12 1392 * the old one.
baf178219478c2 Marco Felsch 2020-03-12 1393 */
baf178219478c2 Marco Felsch 2020-03-12 1394 v4l2ca = &decoder->cur_connector->base.connector.analog;
baf178219478c2 Marco Felsch 2020-03-12 1395 new_norm = decoder->norm & v4l2ca->sdtv_stds;
baf178219478c2 Marco Felsch 2020-03-12 1396 if (decoder->norm == new_norm)
baf178219478c2 Marco Felsch 2020-03-12 1397 return 0;
baf178219478c2 Marco Felsch 2020-03-12 1398
baf178219478c2 Marco Felsch 2020-03-12 1399 /*
baf178219478c2 Marco Felsch 2020-03-12 1400 * Fallback to the new connector tv-norms if we can't find any
baf178219478c2 Marco Felsch 2020-03-12 1401 * common between the current tv-norm and the new one.
baf178219478c2 Marco Felsch 2020-03-12 1402 */
baf178219478c2 Marco Felsch 2020-03-12 1403 tvp5150_s_std(sd, new_norm ? new_norm : v4l2ca->sdtv_stds);
0556f1d580d4c1 Marco Felsch 2020-03-12 1404 }
0556f1d580d4c1 Marco Felsch 2020-03-12 1405
0556f1d580d4c1 Marco Felsch 2020-03-12 1406 return 0;
0556f1d580d4c1 Marco Felsch 2020-03-12 1407 }
0556f1d580d4c1 Marco Felsch 2020-03-12 1408 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests