In case of missing CONFIG_VIDEO_V4L2_SUBDEV_API those helpers aren't available. So each driver have to add ifdefs around those helpers or add the CONFIG_VIDEO_V4L2_SUBDEV_API as dependcy. Make these helpers available in case of CONFIG_VIDEO_V4L2_SUBDEV_API isn't set to avoid ifdefs. This approach is less error prone too. Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- include/media/v4l2-subdev.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 9102d6ca566e..ce48f1fcf295 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -912,8 +912,6 @@ struct v4l2_subdev_fh { #define to_v4l2_subdev_fh(fh) \ container_of(fh, struct v4l2_subdev_fh, vfh) -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) - /** * v4l2_subdev_get_try_format - ancillary routine to call * &struct v4l2_subdev_pad_config->try_fmt @@ -927,9 +925,13 @@ static inline struct v4l2_mbus_framefmt struct v4l2_subdev_pad_config *cfg, unsigned int pad) { +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &cfg[pad].try_fmt; +#else + return NULL; +#endif } /** @@ -945,9 +947,13 @@ static inline struct v4l2_rect struct v4l2_subdev_pad_config *cfg, unsigned int pad) { +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &cfg[pad].try_crop; +#else + return NULL; +#endif } /** @@ -963,11 +969,14 @@ static inline struct v4l2_rect struct v4l2_subdev_pad_config *cfg, unsigned int pad) { +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &cfg[pad].try_compose; -} +#else + return NULL; #endif +} extern const struct v4l2_file_operations v4l2_subdev_fops; -- 2.19.0