Re: [PATCH v4 32/38] media: am437x-vpfe: Register V4L2 device early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sakari,

Thank you for the patch.

On Thu, Jun 22, 2023 at 12:41 PM Sakari Ailus
<sakari.ailus@xxxxxxxxxxxxxxx> wrote:
>
> Register V4L2 device before the async notifier.This way the device can be
> made available to the V4L2 async framework from the notifier init time
> onwards. A subsequent patch will add struct v4l2_device as an argument to
> v4l2_async_nf_init().
>
> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> Tested-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> # imx6qp
> Tested_by: Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx> # rcar + adv746x
s/Tested_by/Tested-by (exists in the entire series)

> Tested-by: Aishwarya Kothari <aishwarya.kothari@xxxxxxxxxxx> # Apalis i.MX6Q with TC358743
> ---
>  .../media/platform/ti/am437x/am437x-vpfe.c    | 27 +++++++++----------
>  1 file changed, 13 insertions(+), 14 deletions(-)
>

Reviewed-by: Lad Prabhakar <prabhakar.csengg@xxxxxxxxx>

Cheers,
Prabhakar

> diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> index a1e01ef5ebddb..1457a188fea12 100644
> --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> @@ -2403,10 +2403,17 @@ static int vpfe_probe(struct platform_device *pdev)
>
>         vpfe->pdev = &pdev->dev;
>
> +       ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
> +       if (ret) {
> +               vpfe_err(vpfe, "Unable to register v4l2 device.\n");
> +               return ret;
> +       }
> +
>         vpfe_cfg = vpfe_get_pdata(vpfe);
>         if (!vpfe_cfg) {
>                 dev_err(&pdev->dev, "No platform data\n");
> -               return -EINVAL;
> +               ret = -EINVAL;
> +               goto probe_out_cleanup;
>         }
>
>         vpfe->cfg = vpfe_cfg;
> @@ -2433,13 +2440,6 @@ static int vpfe_probe(struct platform_device *pdev)
>                 goto probe_out_cleanup;
>         }
>
> -       ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
> -       if (ret) {
> -               vpfe_err(vpfe,
> -                       "Unable to register v4l2 device.\n");
> -               goto probe_out_cleanup;
> -       }
> -
>         /* set the driver data in platform device */
>         platform_set_drvdata(pdev, vpfe);
>         /* Enabling module functional clock */
> @@ -2449,7 +2449,7 @@ static int vpfe_probe(struct platform_device *pdev)
>         ret = pm_runtime_resume_and_get(&pdev->dev);
>         if (ret < 0) {
>                 vpfe_err(vpfe, "Unable to resume device.\n");
> -               goto probe_out_v4l2_unregister;
> +               goto probe_out_cleanup;
>         }
>
>         vpfe_ccdc_config_defaults(ccdc);
> @@ -2462,7 +2462,7 @@ static int vpfe_probe(struct platform_device *pdev)
>                                 GFP_KERNEL);
>         if (!vpfe->sd) {
>                 ret = -ENOMEM;
> -               goto probe_out_v4l2_unregister;
> +               goto probe_out_cleanup;
>         }
>
>         vpfe->notifier.ops = &vpfe_async_ops;
> @@ -2470,15 +2470,14 @@ static int vpfe_probe(struct platform_device *pdev)
>         if (ret) {
>                 vpfe_err(vpfe, "Error registering async notifier\n");
>                 ret = -EINVAL;
> -               goto probe_out_v4l2_unregister;
> +               goto probe_out_cleanup;
>         }
>
>         return 0;
>
> -probe_out_v4l2_unregister:
> -       v4l2_device_unregister(&vpfe->v4l2_dev);
>  probe_out_cleanup:
>         v4l2_async_nf_cleanup(&vpfe->notifier);
> +       v4l2_device_unregister(&vpfe->v4l2_dev);
>         return ret;
>  }
>
> @@ -2493,8 +2492,8 @@ static void vpfe_remove(struct platform_device *pdev)
>
>         v4l2_async_nf_unregister(&vpfe->notifier);
>         v4l2_async_nf_cleanup(&vpfe->notifier);
> -       v4l2_device_unregister(&vpfe->v4l2_dev);
>         video_unregister_device(&vpfe->video_dev);
> +       v4l2_device_unregister(&vpfe->v4l2_dev);
>  }
>
>  #ifdef CONFIG_PM_SLEEP
> --
> 2.39.2
>




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux