[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181128171918.160643-7-lkundrak@v3.sk>
Date: Wed, 28 Nov 2018 18:19:18 +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 6/6] media: ov7670: 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/ov7670.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index bc68a3a5b4ec..7d1fdf51bd91 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1013,9 +1013,7 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd,
struct ov7670_format_struct *ovfmt;
struct ov7670_win_size *wsize;
struct ov7670_info *info = to_state(sd);
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
struct v4l2_mbus_framefmt *mbus_fmt;
-#endif
unsigned char com7, com10 = 0;
int ret;
@@ -1026,13 +1024,11 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd,
ret = ov7670_try_fmt_internal(sd, &format->format, NULL, NULL);
if (ret)
return ret;
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
+ if (IS_ERR(mbus_fmt))
+ return PTR_ERR(mbus_fmt);
*mbus_fmt = format->format;
return 0;
-#else
- return -ENOTTY;
-#endif
}
ret = ov7670_try_fmt_internal(sd, &format->format, &ovfmt, &wsize);
@@ -1105,18 +1101,14 @@ static int ov7670_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_format *format)
{
struct ov7670_info *info = to_state(sd);
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
struct v4l2_mbus_framefmt *mbus_fmt;
-#endif
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, 0);
+ if (IS_ERR(mbus_fmt))
+ return PTR_ERR(mbus_fmt);
format->format = *mbus_fmt;
return 0;
-#else
- return -ENOTTY;
-#endif
} else {
format->format = info->format;
}
--
2.19.1
Powered by blists - more mailing lists