lkml.org 
[lkml]   [2020]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] net: fec: Keep device numbering consistent with datasheet
From
From: Stefan Riedmueller <s.riedmueller@phytec.de>
Date: Wed, 23 Sep 2020 16:25:28 +0200

> From: Christian Hemp <c.hemp@phytec.de>
>
> Make use of device tree alias for device enumeration to keep the device
> order consistent with the naming in the datasheet.
>
> Otherwise for the i.MX 6UL/ULL the ENET1 interface is enumerated as eth1
> and ENET2 as eth0.
>
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>

Device naming and ordering for networking devices was never, ever,
guaranteed.

Use udev or similar.

> @@ -3691,6 +3692,10 @@ fec_probe(struct platform_device *pdev)
>
> ndev->max_mtu = PKT_MAXBUF_SIZE - ETH_HLEN - ETH_FCS_LEN;
>
> + eth_id = of_alias_get_id(pdev->dev.of_node, "ethernet");
> + if (eth_id >= 0)
> + sprintf(ndev->name, "eth%d", eth_id);

You can't ever just write into ndev->name, what if another networking
device is already using that name?

This change is incorrect on many levels.

\
 
 \ /
  Last update: 2020-09-23 22:32    [W:0.098 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site