Commit 2dbcb6fb authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: media/i2c: don't return ENOTTY if SUBDEV_API is not set

If CONFIG_VIDEO_V4L2_SUBDEV_API is not set, then it is still possible
to call set_fmt for V4L2_SUBDEV_FORMAT_TRY, the result is just not
stored. So return 0 instead of -ENOTTY.

Calling get_fmt with V4L2_SUBDEV_FORMAT_TRY should return -EINVAL
instead of -ENOTTY, after all the get_fmt functionality is still
present, just not supported for TRY.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 596a5a58
...@@ -533,7 +533,7 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, ...@@ -533,7 +533,7 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd,
format->format = *mf; format->format = *mf;
return 0; return 0;
#else #else
return -ENOTTY; return -EINVAL;
#endif #endif
} }
......
...@@ -929,7 +929,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, ...@@ -929,7 +929,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
format->format = *mf; format->format = *mf;
return 0; return 0;
#else #else
return -ENOTTY; return -EINVAL;
#endif #endif
} }
......
...@@ -1055,7 +1055,7 @@ static int ov2659_get_fmt(struct v4l2_subdev *sd, ...@@ -1055,7 +1055,7 @@ static int ov2659_get_fmt(struct v4l2_subdev *sd,
mutex_unlock(&ov2659->lock); mutex_unlock(&ov2659->lock);
return 0; return 0;
#else #else
return -ENOTTY; return -EINVAL;
#endif #endif
} }
...@@ -1131,8 +1131,6 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, ...@@ -1131,8 +1131,6 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
*mf = fmt->format; *mf = fmt->format;
#else
ret = -ENOTTY;
#endif #endif
} else { } else {
s64 val; s64 val;
......
...@@ -675,7 +675,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, ...@@ -675,7 +675,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
fmt = v4l2_subdev_get_try_format(&sensor->sd, cfg, format->pad); fmt = v4l2_subdev_get_try_format(&sensor->sd, cfg, format->pad);
#else #else
ret = -ENOTTY; ret = -EINVAL;
#endif #endif
} else { } else {
fmt = &sensor->fmt; fmt = &sensor->fmt;
...@@ -723,10 +723,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, ...@@ -723,10 +723,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
try_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); try_fmt = v4l2_subdev_get_try_format(sd, cfg, 0);
format->format = *try_fmt; format->format = *try_fmt;
#else
ret = -ENOTTY;
#endif #endif
goto unlock; goto unlock;
} }
......
...@@ -823,9 +823,6 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd, ...@@ -823,9 +823,6 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd,
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
*v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format;
#else
mutex_unlock(&ov5695->mutex);
return -ENOTTY;
#endif #endif
} else { } else {
ov5695->cur_mode = mode; ov5695->cur_mode = mode;
...@@ -856,7 +853,7 @@ static int ov5695_get_fmt(struct v4l2_subdev *sd, ...@@ -856,7 +853,7 @@ static int ov5695_get_fmt(struct v4l2_subdev *sd,
fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
#else #else
mutex_unlock(&ov5695->mutex); mutex_unlock(&ov5695->mutex);
return -ENOTTY; return -EINVAL;
#endif #endif
} else { } else {
fmt->format.width = mode->width; fmt->format.width = mode->width;
......
...@@ -827,13 +827,9 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd, ...@@ -827,13 +827,9 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd,
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
*mbus_fmt = format->format; *mbus_fmt = format->format;
#endif
mutex_unlock(&ov7740->mutex); mutex_unlock(&ov7740->mutex);
return 0; return 0;
#else
ret = -ENOTTY;
goto error;
#endif
} }
ret = ov7740_try_fmt_internal(sd, &format->format, &ovfmt, &fsize); ret = ov7740_try_fmt_internal(sd, &format->format, &ovfmt, &fsize);
...@@ -868,7 +864,7 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd, ...@@ -868,7 +864,7 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd,
format->format = *mbus_fmt; format->format = *mbus_fmt;
ret = 0; ret = 0;
#else #else
ret = -ENOTTY; ret = -EINVAL;
#endif #endif
} else { } else {
format->format = ov7740->format; format->format = ov7740->format;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment