[net-next v6 4/4] net: ethernet: mtk_eth_soc: only use legacy mode on missing IRQ name

Frank Wunderlich linux at fw-web.de
Thu Jun 19 06:21:24 PDT 2025


From: Frank Wunderlich <frank-w at public-files.de>

If platform_get_irq_byname returns -ENXIO fall back to legacy (index
based) mode, but on other errors function should return this error.

Suggested-by: Daniel Golle <daniel at makrotopia.org>
Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 67ba8927be46..f8a907747db4 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3346,6 +3346,13 @@ static int mtk_get_irqs(struct platform_device *pdev, struct mtk_eth *eth)
 	if (eth->irq[MTK_FE_IRQ_TX] >= 0 && eth->irq[MTK_FE_IRQ_RX] >= 0)
 		return 0;
 
+	/* only use legacy mode if platform_get_irq_byname returned -ENXIO */
+	if (eth->irq[MTK_FE_IRQ_TX] != -ENXIO)
+		return eth->irq[MTK_FE_IRQ_TX];
+
+	if (eth->irq[MTK_FE_IRQ_RX] != -ENXIO)
+		return eth->irq[MTK_FE_IRQ_RX];
+
 	/* legacy way:
 	 * On MTK_SHARED_INT SoCs (MT7621 + MT7628) the first IRQ is taken
 	 * from devicetree and used for both RX and TX - it is shared.
-- 
2.43.0




More information about the linux-arm-kernel mailing list