summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2019-04-03 12:06:37 +0200
committerMarco Felsch <m.felsch@pengutronix.de>2019-04-03 13:35:42 +0200
commitd6264b2dcd9f500101bd2cfcacf6a4e62f640674 (patch)
tree3c76266e3d55a8300f3fb00a329f164af8e0fd3b
parent080c3e533f38a2e765a7287ec9d7af5cf579a5d0 (diff)
downloadlinux-0-day-d6264b2dcd9f500101bd2cfcacf6a4e62f640674.tar.gz
linux-0-day-d6264b2dcd9f500101bd2cfcacf6a4e62f640674.tar.xz
media: ov7670: get rid of extra ifdefs
We can drop the ifdef dance since the v4l2_subdev_get_try_format return the correct value in both cases with or without CONFIG_VIDEO_V4L2_SUBDEV_API is enabled. The patch is based on Lubomir's series [1]. [1] https://patchwork.kernel.org/cover/10703017/ Cc: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
-rw-r--r--drivers/media/i2c/ov7670.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index a7d26b294eb5..81fa36e1b60e 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1080,9 +1080,7 @@ static int ov7670_set_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
int ret;
if (format->pad)
@@ -1092,13 +1090,13 @@ 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, &info->fmt, &info->wsize);
@@ -1117,18 +1115,15 @@ 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;
}