All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
@ 2022-06-17 20:39 ` Nícolas F. R. A. Prado
  0 siblings, 0 replies; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2022-06-17 20:39 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
	Andrew-CT Chen, Lad Prabhakar, Marc Zyngier, Matthias Brugger,
	Mauro Carvalho Chehab, Rob Herring, Tiffany Lin,
	linux-arm-kernel, linux-kernel, linux-media, linux-mediatek

Commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
from DT core") removed support for calling platform_get_resource(...,
IORESOURCE_IRQ, ...) on DT-based drivers, but the probe() function of
mtk-vcodec's encoder was still making use of it. This caused the encoder
driver to fail probe.

Since the platform_get_resource() call was only being used to check for
the presence of the interrupt (its returned resource wasn't even used)
and platform_get_irq() was already being used to get the IRQ, simply
drop the use of platform_get_resource(IORESOURCE_IRQ) and handle the
failure of platform_get_irq(), to get the driver probing again.

Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---
Tested on mt8192-asurada-spherion.

 .../media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
index 95e8c29ccc65..b91c27e79796 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
@@ -272,14 +272,12 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		goto err_res;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res == NULL) {
-		dev_err(&pdev->dev, "failed to get irq resource");
-		ret = -ENOENT;
+	dev->enc_irq = platform_get_irq(pdev, 0);
+	if (dev->enc_irq < 0) {
+		ret = dev->enc_irq;
 		goto err_res;
 	}
 
-	dev->enc_irq = platform_get_irq(pdev, 0);
 	irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
 	ret = devm_request_irq(&pdev->dev, dev->enc_irq,
 			       mtk_vcodec_enc_irq_handler,
-- 
2.36.1


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

* [PATCH] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
@ 2022-06-17 20:39 ` Nícolas F. R. A. Prado
  0 siblings, 0 replies; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2022-06-17 20:39 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
	Andrew-CT Chen, Lad Prabhakar, Marc Zyngier, Matthias Brugger,
	Mauro Carvalho Chehab, Rob Herring, Tiffany Lin,
	linux-arm-kernel, linux-kernel, linux-media, linux-mediatek

Commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
from DT core") removed support for calling platform_get_resource(...,
IORESOURCE_IRQ, ...) on DT-based drivers, but the probe() function of
mtk-vcodec's encoder was still making use of it. This caused the encoder
driver to fail probe.

Since the platform_get_resource() call was only being used to check for
the presence of the interrupt (its returned resource wasn't even used)
and platform_get_irq() was already being used to get the IRQ, simply
drop the use of platform_get_resource(IORESOURCE_IRQ) and handle the
failure of platform_get_irq(), to get the driver probing again.

Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---
Tested on mt8192-asurada-spherion.

 .../media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
index 95e8c29ccc65..b91c27e79796 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
@@ -272,14 +272,12 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		goto err_res;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res == NULL) {
-		dev_err(&pdev->dev, "failed to get irq resource");
-		ret = -ENOENT;
+	dev->enc_irq = platform_get_irq(pdev, 0);
+	if (dev->enc_irq < 0) {
+		ret = dev->enc_irq;
 		goto err_res;
 	}
 
-	dev->enc_irq = platform_get_irq(pdev, 0);
 	irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
 	ret = devm_request_irq(&pdev->dev, dev->enc_irq,
 			       mtk_vcodec_enc_irq_handler,
-- 
2.36.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] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
  2022-06-17 20:39 ` Nícolas F. R. A. Prado
@ 2022-06-20  7:58   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-06-20  7:58 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Hans Verkuil
  Cc: kernel, Andrew-CT Chen, Lad Prabhakar, Marc Zyngier,
	Matthias Brugger, Mauro Carvalho Chehab, Rob Herring,
	Tiffany Lin, linux-arm-kernel, linux-kernel, linux-media,
	linux-mediatek

Il 17/06/22 22:39, Nícolas F. R. A. Prado ha scritto:
> Commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
> from DT core") removed support for calling platform_get_resource(...,
> IORESOURCE_IRQ, ...) on DT-based drivers, but the probe() function of
> mtk-vcodec's encoder was still making use of it. This caused the encoder
> driver to fail probe.
> 
> Since the platform_get_resource() call was only being used to check for
> the presence of the interrupt (its returned resource wasn't even used)
> and platform_get_irq() was already being used to get the IRQ, simply
> drop the use of platform_get_resource(IORESOURCE_IRQ) and handle the
> failure of platform_get_irq(), to get the driver probing again.
> 
> Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> 
> ---
> Tested on mt8192-asurada-spherion.

Yep, that's totally necessary... Except the Fixes tag should be wrong here,
as you're not fixing that commit, but the mtk-vcodec driver in relation to
what's happening due to said commit.

I get that you're trying to tell everyone "this is an urgent fix", though,
and I agree that this *has to* get in v5.19 to avoid breaking this driver.

Finally, for the code:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

...but I think that you have to send a v2 that drops that Fixes tag.

Cheers,
Angelo

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

* Re: [PATCH] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
@ 2022-06-20  7:58   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-06-20  7:58 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Hans Verkuil
  Cc: kernel, Andrew-CT Chen, Lad Prabhakar, Marc Zyngier,
	Matthias Brugger, Mauro Carvalho Chehab, Rob Herring,
	Tiffany Lin, linux-arm-kernel, linux-kernel, linux-media,
	linux-mediatek

Il 17/06/22 22:39, Nícolas F. R. A. Prado ha scritto:
> Commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
> from DT core") removed support for calling platform_get_resource(...,
> IORESOURCE_IRQ, ...) on DT-based drivers, but the probe() function of
> mtk-vcodec's encoder was still making use of it. This caused the encoder
> driver to fail probe.
> 
> Since the platform_get_resource() call was only being used to check for
> the presence of the interrupt (its returned resource wasn't even used)
> and platform_get_irq() was already being used to get the IRQ, simply
> drop the use of platform_get_resource(IORESOURCE_IRQ) and handle the
> failure of platform_get_irq(), to get the driver probing again.
> 
> Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> 
> ---
> Tested on mt8192-asurada-spherion.

Yep, that's totally necessary... Except the Fixes tag should be wrong here,
as you're not fixing that commit, but the mtk-vcodec driver in relation to
what's happening due to said commit.

I get that you're trying to tell everyone "this is an urgent fix", though,
and I agree that this *has to* get in v5.19 to avoid breaking this driver.

Finally, for the code:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

...but I think that you have to send a v2 that drops that Fixes tag.

Cheers,
Angelo

_______________________________________________
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

* Re: [PATCH] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
  2022-06-20  7:58   ` AngeloGioacchino Del Regno
@ 2022-06-20 14:52     ` Nícolas F. R. A. Prado
  -1 siblings, 0 replies; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2022-06-20 14:52 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Hans Verkuil, kernel, Andrew-CT Chen, Lad Prabhakar,
	Marc Zyngier, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring, Tiffany Lin, linux-arm-kernel, linux-kernel,
	linux-media, linux-mediatek

On Mon, Jun 20, 2022 at 09:58:01AM +0200, AngeloGioacchino Del Regno wrote:
> Il 17/06/22 22:39, Nícolas F. R. A. Prado ha scritto:
> > Commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
> > from DT core") removed support for calling platform_get_resource(...,
> > IORESOURCE_IRQ, ...) on DT-based drivers, but the probe() function of
> > mtk-vcodec's encoder was still making use of it. This caused the encoder
> > driver to fail probe.
> > 
> > Since the platform_get_resource() call was only being used to check for
> > the presence of the interrupt (its returned resource wasn't even used)
> > and platform_get_irq() was already being used to get the IRQ, simply
> > drop the use of platform_get_resource(IORESOURCE_IRQ) and handle the
> > failure of platform_get_irq(), to get the driver probing again.
> > 
> > Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
> > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> > 
> > ---
> > Tested on mt8192-asurada-spherion.
> 
> Yep, that's totally necessary... Except the Fixes tag should be wrong here,
> as you're not fixing that commit, but the mtk-vcodec driver in relation to
> what's happening due to said commit.
> 
> I get that you're trying to tell everyone "this is an urgent fix", though,
> and I agree that this *has to* get in v5.19 to avoid breaking this driver.

The commit I'm pointing to in the Fixes tag [1] says "Now that all the DT
drivers have switched to platform_get_irq() we can now safely drop the static
setup of IRQ resource from DT core code.", and while there were patches by the
author [2] to do the required changes on some drivers beforehand, some were
missed, including the mtk-vcodec-enc driver which I fix here. I see at least one
other driver that was missed [3], and it also used the same Fixes tag.

I know that my change isn't meant to be part of the commit in the Fixes, but I
still think it makes the most sense to keep this tag, since its meaning is that
that commit broke the support for this driver and this commit fixes it. Wherever
that commit is applied, this one should too to make sure the mtk-vcodec driver
keeps working.

Thanks,
Nícolas

[1] https://lore.kernel.org/all/20220316200633.28974-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
[2] https://lore.kernel.org/all/20211220011524.17206-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
[3] https://lore.kernel.org/all/20220609161457.69614-1-jean-philippe@linaro.org/

> 
> Finally, for the code:
> 
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> 
> ...but I think that you have to send a v2 that drops that Fixes tag.
> 
> Cheers,
> Angelo

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

* Re: [PATCH] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
@ 2022-06-20 14:52     ` Nícolas F. R. A. Prado
  0 siblings, 0 replies; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2022-06-20 14:52 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Hans Verkuil, kernel, Andrew-CT Chen, Lad Prabhakar,
	Marc Zyngier, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring, Tiffany Lin, linux-arm-kernel, linux-kernel,
	linux-media, linux-mediatek

On Mon, Jun 20, 2022 at 09:58:01AM +0200, AngeloGioacchino Del Regno wrote:
> Il 17/06/22 22:39, Nícolas F. R. A. Prado ha scritto:
> > Commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
> > from DT core") removed support for calling platform_get_resource(...,
> > IORESOURCE_IRQ, ...) on DT-based drivers, but the probe() function of
> > mtk-vcodec's encoder was still making use of it. This caused the encoder
> > driver to fail probe.
> > 
> > Since the platform_get_resource() call was only being used to check for
> > the presence of the interrupt (its returned resource wasn't even used)
> > and platform_get_irq() was already being used to get the IRQ, simply
> > drop the use of platform_get_resource(IORESOURCE_IRQ) and handle the
> > failure of platform_get_irq(), to get the driver probing again.
> > 
> > Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
> > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> > 
> > ---
> > Tested on mt8192-asurada-spherion.
> 
> Yep, that's totally necessary... Except the Fixes tag should be wrong here,
> as you're not fixing that commit, but the mtk-vcodec driver in relation to
> what's happening due to said commit.
> 
> I get that you're trying to tell everyone "this is an urgent fix", though,
> and I agree that this *has to* get in v5.19 to avoid breaking this driver.

The commit I'm pointing to in the Fixes tag [1] says "Now that all the DT
drivers have switched to platform_get_irq() we can now safely drop the static
setup of IRQ resource from DT core code.", and while there were patches by the
author [2] to do the required changes on some drivers beforehand, some were
missed, including the mtk-vcodec-enc driver which I fix here. I see at least one
other driver that was missed [3], and it also used the same Fixes tag.

I know that my change isn't meant to be part of the commit in the Fixes, but I
still think it makes the most sense to keep this tag, since its meaning is that
that commit broke the support for this driver and this commit fixes it. Wherever
that commit is applied, this one should too to make sure the mtk-vcodec driver
keeps working.

Thanks,
Nícolas

[1] https://lore.kernel.org/all/20220316200633.28974-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
[2] https://lore.kernel.org/all/20211220011524.17206-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
[3] https://lore.kernel.org/all/20220609161457.69614-1-jean-philippe@linaro.org/

> 
> Finally, for the code:
> 
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> 
> ...but I think that you have to send a v2 that drops that Fixes tag.
> 
> Cheers,
> Angelo

_______________________________________________
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-06-20 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 20:39 [PATCH] media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ) Nícolas F. R. A. Prado
2022-06-17 20:39 ` Nícolas F. R. A. Prado
2022-06-20  7:58 ` AngeloGioacchino Del Regno
2022-06-20  7:58   ` AngeloGioacchino Del Regno
2022-06-20 14:52   ` Nícolas F. R. A. Prado
2022-06-20 14:52     ` Nícolas F. R. A. Prado

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.