summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2019-04-03 11:17:57 +0200
committerMarco Felsch <m.felsch@pengutronix.de>2019-04-03 13:35:42 +0200
commit95064c32c0f712cf4c986efd044da88841e1d441 (patch)
tree70a99274e3670843a62ab55e38b1763ec46e62d3
parentd6264b2dcd9f500101bd2cfcacf6a4e62f640674 (diff)
downloadlinux-0-day-mfe/media/v4l2-subdev-stubs.tar.gz
media: ov7740: get rid of extra ifdefsmfe/media/v4l2-subdev-stubs
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/ov7740.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c
index dfece91..e720709 100644
--- a/drivers/media/i2c/ov7740.c
+++ b/drivers/media/i2c/ov7740.c
@@ -780,9 +780,7 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd,
struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev);
const struct ov7740_pixfmt *ovfmt;
const struct ov7740_framesize *fsize;
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
struct v4l2_mbus_framefmt *mbus_fmt;
-#endif
int ret;
mutex_lock(&ov7740->mutex);
@@ -795,16 +793,17 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd,
ret = ov7740_try_fmt_internal(sd, &format->format, NULL, NULL);
if (ret)
goto error;
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
+
mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
+ if (IS_ERR(mbus_fmt)) {
+ ret = PTR_ERR(mbus_fmt);
+ goto error;
+ }
+
*mbus_fmt = format->format;
mutex_unlock(&ov7740->mutex);
return 0;
-#else
- ret = -ENOTTY;
- goto error;
-#endif
}
ret = ov7740_try_fmt_internal(sd, &format->format, &ovfmt, &fsize);
@@ -827,25 +826,25 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_format *format)
{
struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev);
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
struct v4l2_mbus_framefmt *mbus_fmt;
-#endif
int ret = 0;
mutex_lock(&ov7740->mutex);
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)) {
+ ret = PTR_ERR(mbus_fmt);
+ goto error;
+ }
+
format->format = *mbus_fmt;
ret = 0;
-#else
- ret = -ENOTTY;
-#endif
} else {
format->format = ov7740->format;
}
- mutex_unlock(&ov7740->mutex);
+error:
+ mutex_unlock(&ov7740->mutex);
return ret;
}