* [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
@ 2019-10-01 18:07 Geert Uytterhoeven
2019-10-02 4:49 ` Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-10-01 18:07 UTC (permalink / raw)
To: Ulf Hansson, Wolfram Sang
Cc: Stephen Boyd, Greg Kroah-Hartman, 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>
---
This is a fix for v5.4-rc1.
---
drivers/mmc/host/renesas_sdhi_core.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index d4ada5cca2d14f6a..122f429602d825bd 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,26 @@ int renesas_sdhi_probe(struct platform_device *pdev,
host->hs400_complete = renesas_sdhi_hs400_complete;
}
- i = 0;
- while (1) {
+ /* There must be at least one IRQ source */
+ num_irqs = platform_irq_count(pdev);
+ if (num_irqs < 1) {
+ ret = num_irqs;
+ 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] 5+ messages in thread
* RE: [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
2019-10-01 18:07 [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Geert Uytterhoeven
@ 2019-10-02 4:49 ` Yoshihiro Shimoda
2019-10-02 8:02 ` Wolfram Sang
2019-10-02 9:11 ` Sergei Shtylyov
2 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-02 4:49 UTC (permalink / raw)
To: Geert Uytterhoeven, Ulf Hansson, Wolfram Sang
Cc: Stephen Boyd, Greg Kroah-Hartman, linux-renesas-soc, linux-mmc,
linux-kernel
Hi Geert-san,
> From: Geert Uytterhoeven, Sent: Wednesday, October 2, 2019 3:07 AM
>
> 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>
> ---
> This is a fix for v5.4-rc1.
> ---
Thank you for the patch!
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
And, I tested this patch on R-Car H3. So,
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Best regards,
Yoshihiro Shimoda
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
2019-10-01 18:07 [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Geert Uytterhoeven
2019-10-02 4:49 ` Yoshihiro Shimoda
@ 2019-10-02 8:02 ` Wolfram Sang
2019-10-02 9:11 ` Sergei Shtylyov
2 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2019-10-02 8:02 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Ulf Hansson, Wolfram Sang, Stephen Boyd, Greg Kroah-Hartman,
linux-renesas-soc, linux-mmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 844 bytes --]
On Tue, Oct 01, 2019 at 08:07:03PM +0200, Geert Uytterhoeven 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*()")
We will see this fixes line a lot :/
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Have to admit, though, the new code looks much better. Tested on a
Renesas R-Car M3-N:
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
2019-10-01 18:07 [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Geert Uytterhoeven
2019-10-02 4:49 ` Yoshihiro Shimoda
2019-10-02 8:02 ` Wolfram Sang
@ 2019-10-02 9:11 ` Sergei Shtylyov
2019-10-02 9:20 ` Geert Uytterhoeven
2 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2019-10-02 9:11 UTC (permalink / raw)
To: Geert Uytterhoeven, Ulf Hansson, Wolfram Sang
Cc: Stephen Boyd, Greg Kroah-Hartman, linux-renesas-soc, linux-mmc,
linux-kernel
On 01.10.2019 21:07, Geert Uytterhoeven wrote:
> As platform_get_irq() now prints an error when the interrupt does not
> exist, counting interrupts by looping until failure causes the printing
s/the//?
> 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>
> ---
> This is a fix for v5.4-rc1.
> ---
> drivers/mmc/host/renesas_sdhi_core.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index d4ada5cca2d14f6a..122f429602d825bd 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
[...]
> @@ -825,24 +825,26 @@ int renesas_sdhi_probe(struct platform_device *pdev,
> host->hs400_complete = renesas_sdhi_hs400_complete;
> }
>
> - i = 0;
> - while (1) {
> + /* There must be at least one IRQ source */
> + num_irqs = platform_irq_count(pdev);
> + if (num_irqs < 1) {
> + ret = num_irqs;
> + goto eirq;
This will return 0 with failed probe if 'num_irqs' is 0, I don't think you
want this...
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
2019-10-02 9:11 ` Sergei Shtylyov
@ 2019-10-02 9:20 ` Geert Uytterhoeven
0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-10-02 9:20 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Geert Uytterhoeven, Ulf Hansson, Wolfram Sang, Stephen Boyd,
Greg Kroah-Hartman, Linux-Renesas, Linux MMC List,
Linux Kernel Mailing List
Hi Sergei,
On Wed, Oct 2, 2019 at 11:11 AM Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 01.10.2019 21:07, Geert Uytterhoeven wrote:
> > As platform_get_irq() now prints an error when the interrupt does not
> > exist, counting interrupts by looping until failure causes the printing
>
> s/the//?
I believe "the printing" is correct.
Any native English speakers to comment?
> > 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>
> > --- a/drivers/mmc/host/renesas_sdhi_core.c
> > +++ b/drivers/mmc/host/renesas_sdhi_core.c
> [...]
> > @@ -825,24 +825,26 @@ int renesas_sdhi_probe(struct platform_device *pdev,
> > host->hs400_complete = renesas_sdhi_hs400_complete;
> > }
> >
> > - i = 0;
> > - while (1) {
> > + /* There must be at least one IRQ source */
> > + num_irqs = platform_irq_count(pdev);
> > + if (num_irqs < 1) {
> > + ret = num_irqs;
> > + goto eirq;
>
> This will return 0 with failed probe if 'num_irqs' is 0, I don't think you
> want this...
Thanks, will fix.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-02 9:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 18:07 [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Geert Uytterhoeven
2019-10-02 4:49 ` Yoshihiro Shimoda
2019-10-02 8:02 ` Wolfram Sang
2019-10-02 9:11 ` Sergei Shtylyov
2019-10-02 9:20 ` Geert Uytterhoeven
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).