* [PATCH v2] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
@ 2019-10-02 15:29 Geert Uytterhoeven
2019-10-03 10:01 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-10-02 15:29 UTC (permalink / raw)
To: Ulf Hansson
Cc: Stephen Boyd, Greg Kroah-Hartman, Sergei Shtylyov,
linux-renesas-soc, linux-mmc, linux-kernel, Geert Uytterhoeven
As platform_get_irq() now prints an error when the interrupt does not
exist, counting interrupts by looping until failure causes the printing
of scary messages like:
renesas_sdhi_internal_dmac ee140000.sd: IRQ index 1 not found
Fix this by using the platform_irq_count() helper to avoid touching
non-existent interrupts.
Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v2:
- Add Reviewed-by, Tested-by,
- Return failure in case num_irqs is zero, as before.
This is a fix for v5.4-rc1.
---
drivers/mmc/host/renesas_sdhi_core.c | 31 +++++++++++++++++-----------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index d4ada5cca2d14f6a..234551a68739b65b 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -646,8 +646,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
struct tmio_mmc_dma *dma_priv;
struct tmio_mmc_host *host;
struct renesas_sdhi *priv;
+ int num_irqs, irq, ret, i;
struct resource *res;
- int irq, ret, i;
u16 ver;
of_data = of_device_get_match_data(&pdev->dev);
@@ -825,24 +825,31 @@ int renesas_sdhi_probe(struct platform_device *pdev,
host->hs400_complete = renesas_sdhi_hs400_complete;
}
- i = 0;
- while (1) {
+ num_irqs = platform_irq_count(pdev);
+ if (num_irqs < 0) {
+ ret = num_irqs;
+ goto eirq;
+ }
+
+ /* There must be at least one IRQ source */
+ if (!num_irqs) {
+ ret = -ENXIO;
+ goto eirq;
+ }
+
+ for (i = 0; i < num_irqs; i++) {
irq = platform_get_irq(pdev, i);
- if (irq < 0)
- break;
- i++;
+ if (irq < 0) {
+ ret = irq;
+ goto eirq;
+ }
+
ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
dev_name(&pdev->dev), host);
if (ret)
goto eirq;
}
- /* There must be at least one IRQ source */
- if (!i) {
- ret = irq;
- goto eirq;
- }
-
dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n",
mmc_hostname(host->mmc), (unsigned long)
(platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
2019-10-02 15:29 [PATCH v2] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Geert Uytterhoeven
@ 2019-10-03 10:01 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2019-10-03 10:01 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Stephen Boyd, Greg Kroah-Hartman, Sergei Shtylyov, Linux-Renesas,
linux-mmc, Linux Kernel Mailing List
On Wed, 2 Oct 2019 at 17:29, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> As platform_get_irq() now prints an error when the interrupt does not
> exist, counting interrupts by looping until failure causes the printing
> of scary messages like:
>
> renesas_sdhi_internal_dmac ee140000.sd: IRQ index 1 not found
>
> Fix this by using the platform_irq_count() helper to avoid touching
> non-existent interrupts.
>
> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Applied for fixes, thanks!
Kind regards
Uffe
> ---
> v2:
> - Add Reviewed-by, Tested-by,
> - Return failure in case num_irqs is zero, as before.
>
> This is a fix for v5.4-rc1.
> ---
> drivers/mmc/host/renesas_sdhi_core.c | 31 +++++++++++++++++-----------
> 1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index d4ada5cca2d14f6a..234551a68739b65b 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -646,8 +646,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
> struct tmio_mmc_dma *dma_priv;
> struct tmio_mmc_host *host;
> struct renesas_sdhi *priv;
> + int num_irqs, irq, ret, i;
> struct resource *res;
> - int irq, ret, i;
> u16 ver;
>
> of_data = of_device_get_match_data(&pdev->dev);
> @@ -825,24 +825,31 @@ int renesas_sdhi_probe(struct platform_device *pdev,
> host->hs400_complete = renesas_sdhi_hs400_complete;
> }
>
> - i = 0;
> - while (1) {
> + num_irqs = platform_irq_count(pdev);
> + if (num_irqs < 0) {
> + ret = num_irqs;
> + goto eirq;
> + }
> +
> + /* There must be at least one IRQ source */
> + if (!num_irqs) {
> + ret = -ENXIO;
> + goto eirq;
> + }
> +
> + for (i = 0; i < num_irqs; i++) {
> irq = platform_get_irq(pdev, i);
> - if (irq < 0)
> - break;
> - i++;
> + if (irq < 0) {
> + ret = irq;
> + goto eirq;
> + }
> +
> ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
> dev_name(&pdev->dev), host);
> if (ret)
> goto eirq;
> }
>
> - /* There must be at least one IRQ source */
> - if (!i) {
> - ret = irq;
> - goto eirq;
> - }
> -
> dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n",
> mmc_hostname(host->mmc), (unsigned long)
> (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-03 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 15:29 [PATCH v2] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Geert Uytterhoeven
2019-10-03 10:01 ` Ulf Hansson
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.