diff mbox

[16/20] media: adv7180: Fix set_pad_format() passing wrong format

Message ID 1432139980-12619-17-git-send-email-william.towle@codethink.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

William Towle May 20, 2015, 4:39 p.m. UTC
Return a usable format (and resolution) from adv7180_set_pad_format()
in the TRY_FORMAT case

Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
Tested-by: William Towle <william.towle@codethink.co.uk>
---
 drivers/media/i2c/adv7180.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Guennadi Liakhovetski May 25, 2015, 3:12 p.m. UTC | #1
On Wed, 20 May 2015, William Towle wrote:

> Return a usable format (and resolution) from adv7180_set_pad_format()
> in the TRY_FORMAT case
> 
> Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
> Tested-by: William Towle <william.towle@codethink.co.uk>

Author?

> ---
>  drivers/media/i2c/adv7180.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index 09a96df..ba0b92d5 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -686,12 +686,14 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd,
>  			adv7180_set_field_mode(state);
>  			adv7180_set_power(state, true);
>  		}
> +		adv7180_mbus_fmt(sd, framefmt);
>  	} else {
>  		framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
>  		*framefmt = format->format;
> +		adv7180_mbus_fmt(sd, framefmt);
> +		format->format = *framefmt;

Wouldn't it be easier to:

+		adv7180_mbus_fmt(sd, &format->format);
 		framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
 		*framefmt = format->format;

and also make adv7180_mbus_fmt() return void?

Thanks
Guennadi

>  	}
> -
> -	return adv7180_mbus_fmt(sd, framefmt);
> +	return 0;
>  }
>  
>  static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 09a96df..ba0b92d5 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -686,12 +686,14 @@  static int adv7180_set_pad_format(struct v4l2_subdev *sd,
 			adv7180_set_field_mode(state);
 			adv7180_set_power(state, true);
 		}
+		adv7180_mbus_fmt(sd, framefmt);
 	} else {
 		framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
 		*framefmt = format->format;
+		adv7180_mbus_fmt(sd, framefmt);
+		format->format = *framefmt;
 	}
-
-	return adv7180_mbus_fmt(sd, framefmt);
+	return 0;
 }
 
 static int adv7180_g_mbus_config(struct v4l2_subdev *sd,