Re: [PATCH] media: platform: rzg2l-cru: rzg2l-video: Move request_irq() to rzg2l_cru_video_register()

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

 



Hi Biju,

On Mon, Feb 19, 2024 at 7:05 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> Move request_irq() to rzg2l_cru_video_register(), in order to avoid
> requesting IRQ during device start which happens frequently.
>
> Suggested-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c

> @@ -1011,6 +1000,7 @@ void rzg2l_cru_video_unregister(struct rzg2l_cru_dev *cru)
>  {
>         media_device_unregister(&cru->mdev);
>         video_unregister_device(&cru->vdev);
> +       free_irq(cru->image_conv_irq, cru);
>  }
>
>  int rzg2l_cru_video_register(struct rzg2l_cru_dev *cru)
> @@ -1018,6 +1008,13 @@ int rzg2l_cru_video_register(struct rzg2l_cru_dev *cru)
>         struct video_device *vdev = &cru->vdev;
>         int ret;
>
> +       ret = request_irq(cru->image_conv_irq, rzg2l_cru_irq,
> +                         IRQF_SHARED, KBUILD_MODNAME, cru);
> +       if (ret) {
> +               dev_err(cru->dev, "failed to request irq\n");
> +               return ret;
> +       }
> +
>         if (video_is_registered(&cru->vdev)) {

How can this happen? Perhaps rzg2l_cru_video_register() can be called
multiple times through the rzg2l_cru_group_notify_complete() notifier?

If that is true, the request_irq() should be moved after this block,
just before the call to video_register_device() below.

>                 struct media_entity *entity;
>
> @@ -1032,14 +1029,18 @@ int rzg2l_cru_video_register(struct rzg2l_cru_dev *cru)
>         ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
>         if (ret) {
>                 dev_err(cru->dev, "Failed to register video device\n");
> -               return ret;
> +               goto err_request_irq;
>         }
>
>         ret = media_device_register(&cru->mdev);
> -       if (ret) {
> -               video_unregister_device(&cru->vdev);
> -               return ret;
> -       }
> +       if (ret)
> +               goto err_video_unregister;
>
>         return 0;
> +
> +err_video_unregister:
> +       video_unregister_device(&cru->vdev);
> +err_request_irq:
> +       free_irq(cru->image_conv_irq, cru);
> +       return ret;
>  }

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds





[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