All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
@ 2022-03-09  5:34 ` cgel.zte
  0 siblings, 0 replies; 6+ messages in thread
From: cgel.zte @ 2022-03-09  5:34 UTC (permalink / raw)
  To: sean.wang
  Cc: vkoul, matthias.bgg, dmaengine, linux-arm-kernel, linux-mediatek,
	linux-kernel, Minghao Chi

From: Minghao Chi <chi.minghao@zte.com.cn>

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.

Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/dma/mediatek/mtk-hsdma.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c
index 6ad8afbb95f2..d04d09016e83 100644
--- a/drivers/dma/mediatek/mtk-hsdma.c
+++ b/drivers/dma/mediatek/mtk-hsdma.c
@@ -897,7 +897,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
 	struct mtk_hsdma_vchan *vc;
 	struct dma_device *dd;
 	struct resource *res;
-	int i, err;
+	int i, err, irq;
 
 	hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
 	if (!hsdma)
@@ -923,13 +923,11 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
 		return PTR_ERR(hsdma->clk);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "No irq resource for %s\n",
-			dev_name(&pdev->dev));
-		return -EINVAL;
-	}
-	hsdma->irq = res->start;
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
+	hsdma->irq = irq;
 
 	refcount_set(&hsdma->pc_refcnt, 0);
 	spin_lock_init(&hsdma->lock);
-- 
2.25.1


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

* [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
@ 2022-03-09  5:34 ` cgel.zte
  0 siblings, 0 replies; 6+ messages in thread
From: cgel.zte @ 2022-03-09  5:34 UTC (permalink / raw)
  To: sean.wang
  Cc: vkoul, matthias.bgg, dmaengine, linux-arm-kernel, linux-mediatek,
	linux-kernel, Minghao Chi

From: Minghao Chi <chi.minghao@zte.com.cn>

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.

Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/dma/mediatek/mtk-hsdma.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c
index 6ad8afbb95f2..d04d09016e83 100644
--- a/drivers/dma/mediatek/mtk-hsdma.c
+++ b/drivers/dma/mediatek/mtk-hsdma.c
@@ -897,7 +897,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
 	struct mtk_hsdma_vchan *vc;
 	struct dma_device *dd;
 	struct resource *res;
-	int i, err;
+	int i, err, irq;
 
 	hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
 	if (!hsdma)
@@ -923,13 +923,11 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
 		return PTR_ERR(hsdma->clk);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "No irq resource for %s\n",
-			dev_name(&pdev->dev));
-		return -EINVAL;
-	}
-	hsdma->irq = res->start;
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
+	hsdma->irq = irq;
 
 	refcount_set(&hsdma->pc_refcnt, 0);
 	spin_lock_init(&hsdma->lock);
-- 
2.25.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
@ 2022-03-09  5:34 ` cgel.zte
  0 siblings, 0 replies; 6+ messages in thread
From: cgel.zte @ 2022-03-09  5:34 UTC (permalink / raw)
  To: sean.wang
  Cc: vkoul, matthias.bgg, dmaengine, linux-arm-kernel, linux-mediatek,
	linux-kernel, Minghao Chi

From: Minghao Chi <chi.minghao@zte.com.cn>

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.

Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/dma/mediatek/mtk-hsdma.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c
index 6ad8afbb95f2..d04d09016e83 100644
--- a/drivers/dma/mediatek/mtk-hsdma.c
+++ b/drivers/dma/mediatek/mtk-hsdma.c
@@ -897,7 +897,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
 	struct mtk_hsdma_vchan *vc;
 	struct dma_device *dd;
 	struct resource *res;
-	int i, err;
+	int i, err, irq;
 
 	hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
 	if (!hsdma)
@@ -923,13 +923,11 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
 		return PTR_ERR(hsdma->clk);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "No irq resource for %s\n",
-			dev_name(&pdev->dev));
-		return -EINVAL;
-	}
-	hsdma->irq = res->start;
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
+	hsdma->irq = irq;
 
 	refcount_set(&hsdma->pc_refcnt, 0);
 	spin_lock_init(&hsdma->lock);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
  2022-03-09  5:34 ` cgel.zte
  (?)
@ 2022-04-11 14:19   ` Vinod Koul
  -1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2022-04-11 14:19 UTC (permalink / raw)
  To: cgel.zte
  Cc: sean.wang, matthias.bgg, dmaengine, linux-arm-kernel,
	linux-mediatek, linux-kernel, Minghao Chi

On 09-03-22, 05:34, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> 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.

Applied, thanks

-- 
~Vinod

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
@ 2022-04-11 14:19   ` Vinod Koul
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2022-04-11 14:19 UTC (permalink / raw)
  To: cgel.zte
  Cc: sean.wang, matthias.bgg, dmaengine, linux-arm-kernel,
	linux-mediatek, linux-kernel, Minghao Chi

On 09-03-22, 05:34, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> 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.

Applied, thanks

-- 
~Vinod

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

* Re: [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
@ 2022-04-11 14:19   ` Vinod Koul
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2022-04-11 14:19 UTC (permalink / raw)
  To: cgel.zte
  Cc: sean.wang, matthias.bgg, dmaengine, linux-arm-kernel,
	linux-mediatek, linux-kernel, Minghao Chi

On 09-03-22, 05:34, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> 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.

Applied, thanks

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-04-11 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  5:34 [PATCH] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt cgel.zte
2022-03-09  5:34 ` cgel.zte
2022-03-09  5:34 ` cgel.zte
2022-04-11 14:19 ` Vinod Koul
2022-04-11 14:19   ` Vinod Koul
2022-04-11 14:19   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.