summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2019-04-03 11:14:55 +0200
committerMarco Felsch <m.felsch@pengutronix.de>2019-04-03 13:35:42 +0200
commit4ee8fb25de956c006c2cd217f17f073a917bd7bf (patch)
treea6b674c89abe29d3b690be5d2f5b8288360d1c65
parentf7a1578195593cf638656ae2d592297ad77a0856 (diff)
downloadlinux-0-day-4ee8fb25de956c006c2cd217f17f073a917bd7bf.tar.gz
linux-0-day-4ee8fb25de956c006c2cd217f17f073a917bd7bf.tar.xz
media: ov2680: 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/ov2680.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
index b10bcfabaeeb..ea750e8304fe 100644
--- a/drivers/media/i2c/ov2680.c
+++ b/drivers/media/i2c/ov2680.c
@@ -672,11 +672,11 @@ 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)) {
+ ret = PTR_ERR(fmt);
+ goto unlock;
+ }
} else {
fmt = &sensor->fmt;
}
@@ -684,6 +684,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
if (fmt)
format->format = *fmt;
+unlock:
mutex_unlock(&sensor->lock);
return ret;
@@ -695,9 +696,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;
@@ -720,13 +719,12 @@ 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);
+ if (IS_ERR(try_fmt)) {
+ ret = PTR_ERR(try_fmt);
+ goto unlock;
+ }
format->format = *try_fmt;
-#else
- ret = -ENOTTY;
-#endif
-
goto unlock;
}