[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6a4e3e6e-4371-f0ad-4150-4fffc0739901@phytec.de>
Date: Thu, 24 Sep 2020 09:11:14 +0200
From: Stefan Riedmüller <s.riedmueller@...tec.de>
To: Andy Duan <fugang.duan@....com>,
David Miller <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>
Cc: "kuba@...nel.org" <kuba@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"c.hemp@...tec.de" <C.Hemp@...tec.de>
Subject: Re: [EXT] Re: [PATCH] net: fec: Keep device numbering consistent with
datasheet
Hi Andy, David and Andrew,
first of all, thanks for your review. I really appreciate it!
On 24.09.20 08:36, Andy Duan wrote:
> From: David Miller <davem@...emloft.net> Sent: Thursday, September 24, 2020 4:32 AM
>> From: Stefan Riedmueller <s.riedmueller@...tec.de>
>> Date: Wed, 23 Sep 2020 16:25:28 +0200
>>
>>> From: Christian Hemp <c.hemp@...tec.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@...tec.de>
>>> Signed-off-by: Stefan Riedmueller <s.riedmueller@...tec.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.
>
> David is correct.
>
> For example, imx8DXL has ethernet0 is EQOS TSN, ethernet1 is FEC.
> EQOS TSN is andother driver and is registered early, the dev->name is eth0.
> So the patch will bring conflict in such case.
I was not aware of that conflict, but now that you mention it it makes total
sense.
I wanted to make life a little easier for myself but underestimated the
global context. I will try to find a solution with udev or something similar.
So please drop this patch and sorry for the noise.
Stefan
>
> Andy
>
Powered by blists - more mailing lists