linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt
@ 2021-12-21 20:39 Lad Prabhakar
  2021-12-21 20:39 ` [PATCH 1/2] " Lad Prabhakar
  2021-12-21 20:39 ` [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource() Lad Prabhakar
  0 siblings, 2 replies; 7+ messages in thread
From: Lad Prabhakar @ 2021-12-21 20:39 UTC (permalink / raw)
  To: Roger Quadros, Tony Lindgren, Krzysztof Kozlowski, linux-omap
  Cc: Rob Herring, linux-kernel, Prabhakar, Lad Prabhakar

Hi All,

This patch series aims to drop using platform_get_resource() for IRQ types
in preparation for removal of static setup of IRQ resource from DT core
code.

Dropping usage of platform_get_resource() was agreed based on
the discussion [0].

[0] https://patchwork.kernel.org/project/linux-renesas-soc/
patch/20211209001056.29774-1-prabhakar.mahadev-lad.rj@bp.renesas.com/

While doing the above just noticed the code can be simplified
so introduced patch 2/2 to use devm_platform_ioremap_resource().

Cheers,
Prabhakar

Lad Prabhakar (2):
  memory: omap-gpmc: Use platform_get_irq() to get the interrupt
  memory: omap-gpmc: Make use of the devm_platform_ioremap_resource()

 drivers/memory/omap-gpmc.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt
  2021-12-21 20:39 [PATCH 0/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt Lad Prabhakar
@ 2021-12-21 20:39 ` Lad Prabhakar
  2021-12-22 10:28   ` Roger Quadros
  2021-12-22 11:19   ` (subset) " Krzysztof Kozlowski
  2021-12-21 20:39 ` [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource() Lad Prabhakar
  1 sibling, 2 replies; 7+ messages in thread
From: Lad Prabhakar @ 2021-12-21 20:39 UTC (permalink / raw)
  To: Roger Quadros, Tony Lindgren, Krzysztof Kozlowski, linux-omap
  Cc: Rob Herring, linux-kernel, Prabhakar, 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 bypasses the hierarchical setup and messes 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>
---
 drivers/memory/omap-gpmc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index be0858bff4d3..56f401ba53a5 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2510,13 +2510,9 @@ static int gpmc_probe(struct platform_device *pdev)
 	if (IS_ERR(gpmc_base))
 		return PTR_ERR(gpmc_base);
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "Failed to get resource: irq\n");
-		return -ENOENT;
-	}
-
-	gpmc->irq = res->start;
+	gpmc->irq = platform_get_irq(pdev, 0);
+	if (gpmc->irq < 0)
+		return gpmc->irq;
 
 	gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck");
 	if (IS_ERR(gpmc_l3_clk)) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource()
  2021-12-21 20:39 [PATCH 0/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt Lad Prabhakar
  2021-12-21 20:39 ` [PATCH 1/2] " Lad Prabhakar
@ 2021-12-21 20:39 ` Lad Prabhakar
  2021-12-22 10:30   ` Roger Quadros
  1 sibling, 1 reply; 7+ messages in thread
From: Lad Prabhakar @ 2021-12-21 20:39 UTC (permalink / raw)
  To: Roger Quadros, Tony Lindgren, Krzysztof Kozlowski, linux-omap
  Cc: Rob Herring, linux-kernel, Prabhakar, Lad Prabhakar

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/omap-gpmc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 56f401ba53a5..582fe102f923 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2492,7 +2492,6 @@ static int gpmc_probe(struct platform_device *pdev)
 {
 	int rc;
 	u32 l;
-	struct resource *res;
 	struct gpmc_device *gpmc;
 
 	gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
@@ -2502,11 +2501,7 @@ static int gpmc_probe(struct platform_device *pdev)
 	gpmc->dev = &pdev->dev;
 	platform_set_drvdata(pdev, gpmc);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENOENT;
-
-	gpmc_base = devm_ioremap_resource(&pdev->dev, res);
+	gpmc_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpmc_base))
 		return PTR_ERR(gpmc_base);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt
  2021-12-21 20:39 ` [PATCH 1/2] " Lad Prabhakar
@ 2021-12-22 10:28   ` Roger Quadros
  2021-12-22 11:19   ` (subset) " Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2021-12-22 10:28 UTC (permalink / raw)
  To: Lad Prabhakar, Tony Lindgren, Krzysztof Kozlowski, linux-omap
  Cc: Rob Herring, linux-kernel, Prabhakar



On 21/12/2021 22:39, Lad Prabhakar wrote:
> 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 bypasses the hierarchical setup and messes 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>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource()
  2021-12-21 20:39 ` [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource() Lad Prabhakar
@ 2021-12-22 10:30   ` Roger Quadros
  2021-12-22 10:43     ` Lad, Prabhakar
  0 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2021-12-22 10:30 UTC (permalink / raw)
  To: Lad Prabhakar, Tony Lindgren, Krzysztof Kozlowski, linux-omap
  Cc: Rob Herring, linux-kernel, Prabhakar

Hi Lad,

On 21/12/2021 22:39, Lad Prabhakar wrote:
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/memory/omap-gpmc.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index 56f401ba53a5..582fe102f923 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2492,7 +2492,6 @@ static int gpmc_probe(struct platform_device *pdev)
>  {
>  	int rc;
>  	u32 l;
> -	struct resource *res;
>  	struct gpmc_device *gpmc;
>  
>  	gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
> @@ -2502,11 +2501,7 @@ static int gpmc_probe(struct platform_device *pdev)
>  	gpmc->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, gpmc);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -ENOENT;
> -
> -	gpmc_base = devm_ioremap_resource(&pdev->dev, res);
> +	gpmc_base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(gpmc_base))
>  		return PTR_ERR(gpmc_base);
>  
> 

Thanks for the patch but this is already being taken care of by this patch
https://lore.kernel.org/lkml/20211221131757.2030-4-rogerq@kernel.org/T/#m9516df757d98049d769601ee4601005f74f3cec7

--
cheers,
-roger

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource()
  2021-12-22 10:30   ` Roger Quadros
@ 2021-12-22 10:43     ` Lad, Prabhakar
  0 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2021-12-22 10:43 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Lad Prabhakar, Tony Lindgren, Krzysztof Kozlowski,
	Linux OMAP Mailing List, Rob Herring, LKML

Hi Roger,

On Wed, Dec 22, 2021 at 10:30 AM Roger Quadros <rogerq@kernel.org> wrote:
>
> Hi Lad,
>
> On 21/12/2021 22:39, Lad Prabhakar wrote:
> > Use the devm_platform_ioremap_resource() helper instead of
> > calling platform_get_resource() and devm_ioremap_resource()
> > separately.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> >  drivers/memory/omap-gpmc.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> > index 56f401ba53a5..582fe102f923 100644
> > --- a/drivers/memory/omap-gpmc.c
> > +++ b/drivers/memory/omap-gpmc.c
> > @@ -2492,7 +2492,6 @@ static int gpmc_probe(struct platform_device *pdev)
> >  {
> >       int rc;
> >       u32 l;
> > -     struct resource *res;
> >       struct gpmc_device *gpmc;
> >
> >       gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
> > @@ -2502,11 +2501,7 @@ static int gpmc_probe(struct platform_device *pdev)
> >       gpmc->dev = &pdev->dev;
> >       platform_set_drvdata(pdev, gpmc);
> >
> > -     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -     if (!res)
> > -             return -ENOENT;
> > -
> > -     gpmc_base = devm_ioremap_resource(&pdev->dev, res);
> > +     gpmc_base = devm_platform_ioremap_resource(pdev, 0);
> >       if (IS_ERR(gpmc_base))
> >               return PTR_ERR(gpmc_base);
> >
> >
>
> Thanks for the patch but this is already being taken care of by this patch
> https://lore.kernel.org/lkml/20211221131757.2030-4-rogerq@kernel.org/T/#m9516df757d98049d769601ee4601005f74f3cec7
>
Thanks for the pointer, this patch can be dropped.

Cheers,
Prabhakar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH 1/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt
  2021-12-21 20:39 ` [PATCH 1/2] " Lad Prabhakar
  2021-12-22 10:28   ` Roger Quadros
@ 2021-12-22 11:19   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-12-22 11:19 UTC (permalink / raw)
  To: linux-omap, Lad Prabhakar, Roger Quadros, Tony Lindgren
  Cc: Krzysztof Kozlowski, Rob Herring, linux-kernel, Prabhakar

On Tue, 21 Dec 2021 20:39:15 +0000, Lad Prabhakar wrote:
> 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 bypasses the hierarchical setup and messes up the
> irq chaining.
> 
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
> 
> [...]

Applied, thanks!

[1/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt
      commit: b1ae2e3748142e7324911029703173f464a83522

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-22 11:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 20:39 [PATCH 0/2] memory: omap-gpmc: Use platform_get_irq() to get the interrupt Lad Prabhakar
2021-12-21 20:39 ` [PATCH 1/2] " Lad Prabhakar
2021-12-22 10:28   ` Roger Quadros
2021-12-22 11:19   ` (subset) " Krzysztof Kozlowski
2021-12-21 20:39 ` [PATCH 2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource() Lad Prabhakar
2021-12-22 10:30   ` Roger Quadros
2021-12-22 10:43     ` Lad, Prabhakar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).