2022-03-09 03:57:06

by CGEL

[permalink] [raw]
Subject: [PATCH] media:davinci:vpbe_display: Use platform_get_irq() to get the interrupt

From: Minghao Chi (CGEL ZTE) <[email protected]>

It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
for requesting IRQ's resources any more, as they can be not ready yet in
case of DT-booting.

platform_get_irq() instead is a recommended way for getting IRQ even if
it was not retrieved earlier.

It also makes code simpler because we're getting "int" value right away
and no conversion from resource to int is required.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi (CGEL ZTE) <[email protected]>
---
drivers/media/platform/davinci/vpbe_display.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index bf3c3e76b921..e0aabcb333ac 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1363,7 +1363,6 @@ static int vpbe_display_probe(struct platform_device *pdev)
{
struct vpbe_display *disp_dev;
struct v4l2_device *v4l2_dev;
- struct resource *res = NULL;
struct vb2_queue *q;
int k;
int i;
@@ -1405,14 +1404,13 @@ static int vpbe_display_probe(struct platform_device *pdev)
}
}

- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!res) {
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
v4l2_err(v4l2_dev, "Unable to get VENC interrupt resource\n");
err = -ENODEV;
goto probe_out;
}

- irq = res->start;
err = devm_request_irq(&pdev->dev, irq, venc_isr, 0,
VPBE_DISPLAY_DRIVER, disp_dev);
if (err) {
--
2.25.1


2022-03-09 13:39:59

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH] media:davinci:vpbe_display: Use platform_get_irq() to get the interrupt

Hi Minghao,

Thank you for the patch.

On Wed, Mar 9, 2022 at 3:56 AM <[email protected]> wrote:
>
> From: Minghao Chi (CGEL ZTE) <[email protected]>
>
> It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
> for requesting IRQ's resources any more, as they can be not ready yet in
> case of DT-booting.
>
> platform_get_irq() instead is a recommended way for getting IRQ even if
> it was not retrieved earlier.
>
> It also makes code simpler because we're getting "int" value right away
> and no conversion from resource to int is required.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Minghao Chi (CGEL ZTE) <[email protected]>
> ---
> drivers/media/platform/davinci/vpbe_display.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
NAK, vpbe_display driver doesn't use DT.

Cheers,
Prabhakar

> diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
> index bf3c3e76b921..e0aabcb333ac 100644
> --- a/drivers/media/platform/davinci/vpbe_display.c
> +++ b/drivers/media/platform/davinci/vpbe_display.c
> @@ -1363,7 +1363,6 @@ static int vpbe_display_probe(struct platform_device *pdev)
> {
> struct vpbe_display *disp_dev;
> struct v4l2_device *v4l2_dev;
> - struct resource *res = NULL;
> struct vb2_queue *q;
> int k;
> int i;
> @@ -1405,14 +1404,13 @@ static int vpbe_display_probe(struct platform_device *pdev)
> }
> }
>
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> - if (!res) {
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0) {
> v4l2_err(v4l2_dev, "Unable to get VENC interrupt resource\n");
> err = -ENODEV;
> goto probe_out;
> }
>
> - irq = res->start;
> err = devm_request_irq(&pdev->dev, irq, venc_isr, 0,
> VPBE_DISPLAY_DRIVER, disp_dev);
> if (err) {
> --
> 2.25.1
>