[PATCH v2 01/12] media: v4l2-common: Constify media_pad argument to v4l2_get_link_freq()
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Aug 20 17:09:33 PDT 2025
The v4l2_get_link_freq() macro doesn't modify the pad argument. Make it
possible to call it with a const media_pad pointer.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
drivers/media/v4l2-core/v4l2-common.c | 2 +-
include/media/v4l2-common.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index a5334aa35992..4d686338e345 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -551,7 +551,7 @@ s64 __v4l2_get_link_freq_ctrl(struct v4l2_ctrl_handler *handler,
EXPORT_SYMBOL_GPL(__v4l2_get_link_freq_ctrl);
#ifdef CONFIG_MEDIA_CONTROLLER
-s64 __v4l2_get_link_freq_pad(struct media_pad *pad, unsigned int mul,
+s64 __v4l2_get_link_freq_pad(const struct media_pad *pad, unsigned int mul,
unsigned int div)
{
struct v4l2_mbus_config mbus_config = {};
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 39dd0c78d70f..ede24e60dbec 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -580,10 +580,11 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat,
#ifdef CONFIG_MEDIA_CONTROLLER
#define v4l2_get_link_freq(pad, mul, div) \
_Generic(pad, \
+ const struct media_pad *: __v4l2_get_link_freq_pad, \
struct media_pad *: __v4l2_get_link_freq_pad, \
struct v4l2_ctrl_handler *: __v4l2_get_link_freq_ctrl) \
(pad, mul, div)
-s64 __v4l2_get_link_freq_pad(struct media_pad *pad, unsigned int mul,
+s64 __v4l2_get_link_freq_pad(const struct media_pad *pad, unsigned int mul,
unsigned int div);
#else
#define v4l2_get_link_freq(handler, mul, div) \
--
Regards,
Laurent Pinchart
More information about the linux-arm-kernel
mailing list