diff mbox series

[v6,09/12] media: ov5640: Make the return rate type more explicit

Message ID 0f291e65286bbf7ec5e2a59f63f9791c4e526405.1543826654.git-series.maxime.ripard@bootlin.com (mailing list archive)
State New, archived
Headers show
Series media: ov5640: Misc cleanup and improvements | expand

Commit Message

Maxime Ripard Dec. 3, 2018, 8:44 a.m. UTC
In the ov5640_try_frame_interval function, the ret variable actually holds
the frame rate index to use, which is represented by the enum
ov5640_frame_rate in the driver.

Make it more obvious.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
---
 drivers/media/i2c/ov5640.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jagan Teki Dec. 18, 2018, 1:49 p.m. UTC | #1
On Mon, Dec 3, 2018 at 2:14 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>
> In the ov5640_try_frame_interval function, the ret variable actually holds
> the frame rate index to use, which is represented by the enum
> ov5640_frame_rate in the driver.
>
> Make it more obvious.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
> ---
>  drivers/media/i2c/ov5640.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index abca08d669be..6cdf5ee0e4fa 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -2052,8 +2052,8 @@ static int ov5640_try_frame_interval(struct ov5640_dev *sensor,
>                                      u32 width, u32 height)
>  {
>         const struct ov5640_mode_info *mode;
> +       enum ov5640_frame_rate rate = OV5640_30_FPS;

This is breaking setting 15fps via media-ctl.

Initializing rate to OV5640_15_FPS will satisfy all fps rate changes.
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index abca08d669be..6cdf5ee0e4fa 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -2052,8 +2052,8 @@  static int ov5640_try_frame_interval(struct ov5640_dev *sensor,
 				     u32 width, u32 height)
 {
 	const struct ov5640_mode_info *mode;
+	enum ov5640_frame_rate rate = OV5640_30_FPS;
 	u32 minfps, maxfps, fps;
-	int ret;
 
 	minfps = ov5640_framerates[OV5640_15_FPS];
 	maxfps = ov5640_framerates[OV5640_30_FPS];
@@ -2076,10 +2076,10 @@  static int ov5640_try_frame_interval(struct ov5640_dev *sensor,
 	else
 		fi->denominator = minfps;
 
-	ret = (fi->denominator == minfps) ? OV5640_15_FPS : OV5640_30_FPS;
+	rate = (fi->denominator == minfps) ? OV5640_15_FPS : OV5640_30_FPS;
 
-	mode = ov5640_find_mode(sensor, ret, width, height, false);
-	return mode ? ret : -EINVAL;
+	mode = ov5640_find_mode(sensor, rate, width, height, false);
+	return mode ? rate : -EINVAL;
 }
 
 static int ov5640_get_fmt(struct v4l2_subdev *sd,