Skip to content

Commit e8307ec

Browse files
geertustorulf
authored andcommitted
mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
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: 7723f4c ("driver core: platform: Add an error message to platform_get_irq*()") Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Tested-by: Yoshihiro Shimoda <[email protected]> Tested-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 54ecb8f commit e8307ec

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

drivers/mmc/host/renesas_sdhi_core.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
646646
struct tmio_mmc_dma *dma_priv;
647647
struct tmio_mmc_host *host;
648648
struct renesas_sdhi *priv;
649+
int num_irqs, irq, ret, i;
649650
struct resource *res;
650-
int irq, ret, i;
651651
u16 ver;
652652

653653
of_data = of_device_get_match_data(&pdev->dev);
@@ -825,24 +825,31 @@ int renesas_sdhi_probe(struct platform_device *pdev,
825825
host->hs400_complete = renesas_sdhi_hs400_complete;
826826
}
827827

828-
i = 0;
829-
while (1) {
828+
num_irqs = platform_irq_count(pdev);
829+
if (num_irqs < 0) {
830+
ret = num_irqs;
831+
goto eirq;
832+
}
833+
834+
/* There must be at least one IRQ source */
835+
if (!num_irqs) {
836+
ret = -ENXIO;
837+
goto eirq;
838+
}
839+
840+
for (i = 0; i < num_irqs; i++) {
830841
irq = platform_get_irq(pdev, i);
831-
if (irq < 0)
832-
break;
833-
i++;
842+
if (irq < 0) {
843+
ret = irq;
844+
goto eirq;
845+
}
846+
834847
ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
835848
dev_name(&pdev->dev), host);
836849
if (ret)
837850
goto eirq;
838851
}
839852

840-
/* There must be at least one IRQ source */
841-
if (!i) {
842-
ret = irq;
843-
goto eirq;
844-
}
845-
846853
dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n",
847854
mmc_hostname(host->mmc), (unsigned long)
848855
(platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),

0 commit comments

Comments
 (0)