summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/i2c/ov5695.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
index 5d107c53364d6..83fea416c75e1 100644
--- a/drivers/media/i2c/ov5695.c
+++ b/drivers/media/i2c/ov5695.c
@@ -810,6 +810,7 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_format *fmt)
{
struct ov5695 *ov5695 = to_ov5695(sd);
+ struct v4l2_mbus_framefmt *try_fmt;
const struct ov5695_mode *mode;
s64 h_blank, vblank_def;
@@ -821,12 +822,12 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd,
fmt->format.height = mode->height;
fmt->format.field = V4L2_FIELD_NONE;
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
- *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format;
-#else
- mutex_unlock(&ov5695->mutex);
- return -ENOTTY;
-#endif
+ try_fmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
+ if (IS_ERR(try_fmt)) {
+ mutex_unlock(&ov5695->mutex);
+ return PTR_ERR(try_fmt);
+ }
+ *try_fmt = fmt->format;
} else {
ov5695->cur_mode = mode;
h_blank = mode->hts_def - mode->width;
@@ -848,16 +849,17 @@ static int ov5695_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_format *fmt)
{
struct ov5695 *ov5695 = to_ov5695(sd);
+ struct v4l2_mbus_framefmt *try_fmt;
const struct ov5695_mode *mode = ov5695->cur_mode;
mutex_lock(&ov5695->mutex);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
- fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
-#else
- mutex_unlock(&ov5695->mutex);
- return -ENOTTY;
-#endif
+ try_fmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
+ if (IS_ERR(try_fmt)) {
+ mutex_unlock(&ov5695->mutex);
+ return PTR_ERR(try_fmt);
+ }
+ fmt->format = *try_fmt;
} else {
fmt->format.width = mode->width;
fmt->format.height = mode->height;