diff mbox

[PATCHv3,06/10,media] rcar-vin: do not use v4l2_device_call_until_err()

Message ID 20160815150635.22637-7-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New, archived
Headers show

Commit Message

Niklas Söderlund Aug. 15, 2016, 3:06 p.m. UTC
Fix a error from the original driver where v4l2_device_call_until_err()
where used for the pad specific v4l2 operation set_fmt.  Also fix up the
error path from this fix so if there is an error it will be propagated
to the caller.

The error path label have also been renamed as a result from a
nitpicking review comment since we are fixing other issues here.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Sergei Shtylyov Sept. 3, 2016, 6:07 p.m. UTC | #1
On 08/15/2016 06:06 PM, Niklas Söderlund wrote:

> Fix a error from the original driver where v4l2_device_call_until_err()
> where used for the pad specific v4l2 operation set_fmt.  Also fix up the
> error path from this fix so if there is an error it will be propagated
> to the caller.

> The error path label have also been renamed as a result from a
> nitpicking review comment since we are fixing other issues here.

    This looks like a material for the 2 or even 3 separate patches...

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index 72fe6bc..3f80a0b 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -114,10 +114,9 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
>
>  	format.pad = vin->src_pad_idx;
>
> -	ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt,
> -					 pad_cfg, &format);
> -	if (ret < 0)
> -		goto cleanup;
> +	ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format);
> +	if (ret < 0 && ret != -ENOIOCTLCMD)
> +		goto done;
>
>  	v4l2_fill_pix_format(pix, &format.format);
>
> @@ -127,9 +126,9 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
>  	vin_dbg(vin, "Source resolution: %ux%u\n", source->width,
>  		source->height);
>
> -cleanup:
> +done:
>  	v4l2_subdev_free_pad_config(pad_cfg);
> -	return 0;
> +	return ret;
>  }
>
>  static int __rvin_try_format(struct rvin_dev *vin,

MBR, Sergei

--
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/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 72fe6bc..3f80a0b 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -114,10 +114,9 @@  static int __rvin_try_format_source(struct rvin_dev *vin,
 
 	format.pad = vin->src_pad_idx;
 
-	ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt,
-					 pad_cfg, &format);
-	if (ret < 0)
-		goto cleanup;
+	ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format);
+	if (ret < 0 && ret != -ENOIOCTLCMD)
+		goto done;
 
 	v4l2_fill_pix_format(pix, &format.format);
 
@@ -127,9 +126,9 @@  static int __rvin_try_format_source(struct rvin_dev *vin,
 	vin_dbg(vin, "Source resolution: %ux%u\n", source->width,
 		source->height);
 
-cleanup:
+done:
 	v4l2_subdev_free_pad_config(pad_cfg);
-	return 0;
+	return ret;
 }
 
 static int __rvin_try_format(struct rvin_dev *vin,