Skip to contentSkip to conversation

stmmac: add a warning when aliases are not present in device tree

PATCH Pavel Machek 2 participants 2 messages Nov 23, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

If aliases are not present in device tree, stmmac_platform.c will happily assign bus_id of 0 to all the ethernet interfaces, resulting in hard to debug problems.

At least warn the user about the problem.

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -1
index f9b42f1..ee8aa26 100644
@@ -161,8 +161,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 		plat->max_speed = -1;
 
 	plat->bus_id = of_alias_get_id(np, "ethernet");
-	if (plat->bus_id < 0)
+	if (plat->bus_id < 0) {
+		dev_warn(&pdev->dev, "no aliases for ethernet; multiple ethernets will break\n");
 		plat->bus_id = 0;
+	}
 
 	/* Default to phy auto-detection */
 	plat->phy_addr = -1;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 15 lines · Pavel Machek

If aliases are not present in device tree, stmmac_platform.c will happily assign bus_id of 0 to all the ethernet interfaces, resulting in hard to debug problems.

At least warn the user about the problem.

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 -0
index f9b42f1..ee8aa26 100644

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_probe_config_dt(struct platform_device *pdev, · line 165

Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -1
@@ -161,8 +161,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
                plat->max_speed = -1;
 
        plat->bus_id = of_alias_get_id(np, "ethernet");
-       if (plat->bus_id < 0)
+       if (plat->bus_id < 0) {
+               dev_warn(&pdev->dev, "no aliases for ethernet; multiple ethernets will break\n");

Spelling: will break what?

Perhaps "multiple ethernet support will be broken".

Quoted 14 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -1
                plat->bus_id = 0;
+       }
 
        /* Default to phy auto-detection */
        plat->phy_addr = -1;
 
--

(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
With Best Regards,
Andy Shevchenko