All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* stmmac: add a warning when aliases are not present in device tree
@ 2015-11-23 15:46 Pavel Machek
  2015-11-23 23:35 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2015-11-23 15:46 UTC (permalink / raw
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: trivial



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.

Signed-off-by: Pavel Machek <pavel@denx.de>

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index f9b42f1..ee8aa26 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -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;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: stmmac: add a warning when aliases are not present in device tree
  2015-11-23 15:46 stmmac: add a warning when aliases are not present in device tree Pavel Machek
@ 2015-11-23 23:35 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2015-11-23 23:35 UTC (permalink / raw
  To: Pavel Machek
  Cc: peppe.cavallaro, netdev, linux-kernel@vger.kernel.org,
	Jiri Kosina

On Mon, Nov 23, 2015 at 5:46 PM, Pavel Machek <pavel@ucw.cz> wrote:
>
>
> 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.
>
> Signed-off-by: Pavel Machek <pavel@denx.de>
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index f9b42f1..ee8aa26 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -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".


>                 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-23 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-23 15:46 stmmac: add a warning when aliases are not present in device tree Pavel Machek
2015-11-23 23:35 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.