lkml.org 
[lkml]   [2020]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] net: stmmac: platform: Fix misleading interrupt error msg
Date
Not every stmmac based platform makes use of the eth_wake_irq or eth_lpi
interrupts. Use the platform_get_irq_byname_optional variant for these
interrupts, so no error message is displayed, if they can't be found.
Rather print an information to hint something might be wrong to assist
debugging on platforms which use these interrupts.

Signed-off-by: Markus Fuchs <mklntf@gmail.com>
---
On my cyclone V socfpga platform I get error messages after updating to
Linux Kernel 5.4.24

Starting kernel ...

Deasserting all peripheral resets
[ 1.206363] socfpga-dwmac ff700000.ethernet: IRQ eth_wake_irq not found
[ 1.213023] socfpga-dwmac ff700000.ethernet: IRQ eth_lpi not found

These interrupts don't matter for my platform and many other stmmac based
ones, as we can see by grepping for 'macirq'.

socfpga.dtsi: interrupt-names = "macirq";
socfpga.dtsi: interrupt-names = "macirq";
sun7i-a20.dtsi: interrupt-names = "macirq";
spear600.dtsi: interrupt-names = "macirq", "eth_wake_irq";
artpec6.dtsi: interrupt-names = "macirq", "eth_lpi";
rk322x.dtsi: interrupt-names = "macirq";
sun9i-a80.dtsi: interrupt-names = "macirq";
spear1310.dtsi: interrupt-names = "macirq";
spear1310.dtsi: interrupt-names = "macirq";
spear1310.dtsi: interrupt-names = "macirq";
spear1310.dtsi: interrupt-names = "macirq";
stih407-family.dtsi: interrupt-names = "macirq", "eth_wake_irq";
stm32f429.dtsi: interrupt-names = "macirq";
sun6i-a31.dtsi: interrupt-names = "macirq";
meson.dtsi: interrupt-names = "macirq";
rk3288.dtsi: interrupt-names = "macirq", "eth_wake_irq";
sun8i-r40.dtsi: interrupt-names = "macirq";
sunxi-h3-h5.dtsi: interrupt-names = "macirq";
spear3xx.dtsi: interrupt-names = "macirq", "eth_wake_irq";
lpc18xx.dtsi: interrupt-names = "macirq";
stm32h743.dtsi: interrupt-names = "macirq";
socfpga_arria10.dtsi: interrupt-names = "macirq";
socfpga_arria10.dtsi: interrupt-names = "macirq";
socfpga_arria10.dtsi: interrupt-names = "macirq";
rv1108.dtsi: interrupt-names = "macirq", "eth_wake_irq";
spear13xx.dtsi: interrupt-names = "macirq", "eth_wake_irq";
stm32mp151.dtsi: interrupt-names = "macirq";
ox820.dtsi: interrupt-names = "macirq", "eth_wake_irq";
sun8i-a83t.dtsi: interrupt-names = "macirq";

So, in my opinion, the error messages are missleading. I believe
the right way to handle this would require more changes though. Some
kind of configuration information, telling which interrupts are required
by the platform and than conditionally call platform_get_irq_byname().
This would print an error message, if something is wrong, on the right
platforms and nothing at all on the others.

.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index d10ac54bf385..13fafd905db8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -663,16 +663,22 @@ int stmmac_get_platform_resources(struct platform_device *pdev,
* In case the wake up interrupt is not passed from the platform
* so the driver will continue to use the mac irq (ndev->irq)
*/
- stmmac_res->wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq");
+ stmmac_res->wol_irq =
+ platform_get_irq_byname_optional(pdev, "eth_wake_irq");
if (stmmac_res->wol_irq < 0) {
if (stmmac_res->wol_irq == -EPROBE_DEFER)
return -EPROBE_DEFER;
+ dev_info(&pdev->dev, "IRQ eth_wake_irq not found\n");
stmmac_res->wol_irq = stmmac_res->irq;
}

- stmmac_res->lpi_irq = platform_get_irq_byname(pdev, "eth_lpi");
- if (stmmac_res->lpi_irq == -EPROBE_DEFER)
- return -EPROBE_DEFER;
+ stmmac_res->lpi_irq =
+ platform_get_irq_byname_optional(pdev, "eth_lpi");
+ if (stmmac_res->lpi_irq < 0) {
+ if (stmmac_res->lpi_irq == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ dev_info(&pdev->dev, "IRQ eth_lpi not found\n");
+ }

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
stmmac_res->addr = devm_ioremap_resource(&pdev->dev, res);
--
2.25.1
\
 
 \ /
  Last update: 2020-03-06 17:41    [W:0.087 / U:8.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site