[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181128171918.160643-5-lkundrak@v3.sk>
Date: Wed, 28 Nov 2018 18:19:16 +0100
From: Lubomir Rintel <lkundrak@...sk>
To: "Lad, Prabhakar" <prabhakar.csengg@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rui Miguel Silva <rmfrfs@...il.com>,
Shunqian Zheng <zhengsq@...k-chips.com>,
Jonathan Corbet <corbet@....net>,
Wenyou Yang <wenyou.yang@...rochip.com>
Cc: Jacopo Mondi <jacopo@...ndi.org>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, Lubomir Rintel <lkundrak@...sk>
Subject: [PATCH 4/6] media: ov2680: get rid of extra ifdefs
Stubbed v4l2_subdev_get_try_format() will return a correct error when
configured without CONFIG_VIDEO_V4L2_SUBDEV_API.
Signed-off-by: Lubomir Rintel <lkundrak@...sk>
---
drivers/media/i2c/ov2680.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
index 0e34e15b67b3..f8b873aaacec 100644
--- a/drivers/media/i2c/ov2680.c
+++ b/drivers/media/i2c/ov2680.c
@@ -680,11 +680,9 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
mutex_lock(&sensor->lock);
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
fmt = v4l2_subdev_get_try_format(&sensor->sd, cfg, format->pad);
-#else
- ret = -ENOTTY;
-#endif
+ if (IS_ERR(fmt))
+ return PTR_ERR(fmt);
} else {
fmt = &sensor->fmt;
}
@@ -703,9 +701,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
{
struct ov2680_dev *sensor = to_ov2680_dev(sd);
struct v4l2_mbus_framefmt *fmt = &format->format;
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
struct v4l2_mbus_framefmt *try_fmt;
-#endif
const struct ov2680_mode_info *mode;
int ret = 0;
@@ -728,12 +724,11 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
}
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
try_fmt = v4l2_subdev_get_try_format(sd, cfg, 0);
- format->format = *try_fmt;
-#else
- ret = -ENOTTY;
-#endif
+ if (IS_ERR(try_fmt))
+ ret = PTR_ERR(try_fmt);
+ else
+ format->format = *try_fmt;
goto unlock;
}
--
2.19.1
Powered by blists - more mailing lists