diff mbox series

[2/5] drm/exynos: mixer: Use platform_get_irq() to get the interrupt

Message ID 20211222190134.24866-3-prabhakar.mahadev-lad.rj@bp.renesas.com
State New
Headers show
Series drm/exynos: Use platform_get_irq*() variants to fetch IRQ's | expand

Commit Message

Prabhakar Mahadev Lad Dec. 22, 2021, 7:01 p.m. UTC
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypassed the hierarchical setup and messed up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
Hi,

Ideally I would expect the mixer_resources_init() to be called from probe
instead from the bind callback. If platform_get_irq() returns -EPROBE_DEFER
the bind callback will fail :(

Cheers,
Prabhakar
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Comments

대인기/Tizen Platform Lab(SR)/삼성전자 Jan. 14, 2022, 11:20 a.m. UTC | #1
Hi Lad Prabhakar,

21. 12. 23. 오전 4:01에 Lad Prabhakar 이(가) 쓴 글:
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypassed the hierarchical setup and messed up the
> irq chaining.
> 
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> Hi,
> 
> Ideally I would expect the mixer_resources_init() to be called from probe
> instead from the bind callback. If platform_get_irq() returns -EPROBE_DEFER
> the bind callback will fail :(

If the bind callback failed then probe function of exynos drm driver will call -EPROBE_DEFER like below so it must be no problem :),
--------------------------------------------
in exynos_drm_platform_probe function
    component_master_add_with_match()

in component_master_add_with_match function
    try_to_bring_up_master()

Thanks,
Inki Dae

> 
> Cheers,
> Prabhakar
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 41c54f1f60bc..e5204be86093 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -809,19 +809,17 @@ static int mixer_resources_init(struct mixer_context *mixer_ctx)
>  		return -ENXIO;
>  	}
>  
> -	res = platform_get_resource(mixer_ctx->pdev, IORESOURCE_IRQ, 0);
> -	if (res == NULL) {
> -		dev_err(dev, "get interrupt resource failed.\n");
> -		return -ENXIO;
> -	}
> +	ret = platform_get_irq(mixer_ctx->pdev, 0);
> +	if (ret < 0)
> +		return ret;
> +	mixer_ctx->irq = ret;
>  
> -	ret = devm_request_irq(dev, res->start, mixer_irq_handler,
> -						0, "drm_mixer", mixer_ctx);
> +	ret = devm_request_irq(dev, mixer_ctx->irq, mixer_irq_handler,
> +			       0, "drm_mixer", mixer_ctx);
>  	if (ret) {
>  		dev_err(dev, "request interrupt failed.\n");
>  		return ret;
>  	}
> -	mixer_ctx->irq = res->start;
>  
>  	return 0;
>  }
>
Lad, Prabhakar Jan. 15, 2022, 1:40 a.m. UTC | #2
Hi Inki,

On Fri, Jan 14, 2022 at 11:08 AM Inki Dae <inki.dae@samsung.com> wrote:
>
> Hi Lad Prabhakar,
>
> 21. 12. 23. 오전 4:01에 Lad Prabhakar 이(가) 쓴 글:
> > platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> > allocation of IRQ resources in DT core code, this causes an issue
> > when using hierarchical interrupt domains using "interrupts" property
> > in the node as this bypassed the hierarchical setup and messed up the
> > irq chaining.
> >
> > In preparation for removal of static setup of IRQ resource from DT core
> > code use platform_get_irq().
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > Hi,
> >
> > Ideally I would expect the mixer_resources_init() to be called from probe
> > instead from the bind callback. If platform_get_irq() returns -EPROBE_DEFER
> > the bind callback will fail :(
>
> If the bind callback failed then probe function of exynos drm driver will call -EPROBE_DEFER like below so it must be no problem :),
> --------------------------------------------
> in exynos_drm_platform_probe function
>     component_master_add_with_match()
>
> in component_master_add_with_match function
>     try_to_bring_up_master()
>
Thank you for the clarification.

Cheers,
Prabhakar
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 41c54f1f60bc..e5204be86093 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -809,19 +809,17 @@  static int mixer_resources_init(struct mixer_context *mixer_ctx)
 		return -ENXIO;
 	}
 
-	res = platform_get_resource(mixer_ctx->pdev, IORESOURCE_IRQ, 0);
-	if (res == NULL) {
-		dev_err(dev, "get interrupt resource failed.\n");
-		return -ENXIO;
-	}
+	ret = platform_get_irq(mixer_ctx->pdev, 0);
+	if (ret < 0)
+		return ret;
+	mixer_ctx->irq = ret;
 
-	ret = devm_request_irq(dev, res->start, mixer_irq_handler,
-						0, "drm_mixer", mixer_ctx);
+	ret = devm_request_irq(dev, mixer_ctx->irq, mixer_irq_handler,
+			       0, "drm_mixer", mixer_ctx);
 	if (ret) {
 		dev_err(dev, "request interrupt failed.\n");
 		return ret;
 	}
-	mixer_ctx->irq = res->start;
 
 	return 0;
 }