Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp693564pxk; Wed, 23 Sep 2020 13:33:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC+963iH+UWDjU62RfZhxchFUbJKLsnv82HvcOrYZ05QKyGXHCaTKNA9MR+iR6fNvZmaqh X-Received: by 2002:a50:bb65:: with SMTP id y92mr1146012ede.53.1600893192822; Wed, 23 Sep 2020 13:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600893192; cv=none; d=google.com; s=arc-20160816; b=vfv2hJRPt6lJgrdmGbO6FVybGxvpKLVi/MJucVgE14WYlxAgsmHUvWAq7utnAhcpND Rm6P4IukTplXnkVbIHKKwWRI9qnIhNEeJbBl36Ox4+W5nPWGAgks7iLR3E1K8ZRvnBnL 02c27CSD7NVnzEqhOCPBj3l0ayoelE7eYT93ihj98Ahb+4q1MpllC/w6poKZRLZ3KFIu 0tWOJIO3kTCzemPx/k4w8i7lyKmYw5vDOeqZdpZUFVUgGRUdyAHZtP1O2wUVJGMEz0ZX T4iIz4XyXiQrzIlOSl/nUOcTiGyqlcjUX/m0fan03B2SxZCxwK5kn6U/AzL5fpfAYnR8 LFPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=/Y483VyM2Wwv69jWj0AyP3jft27GY7t/Z4MLMJCDWZk=; b=IHlXT16Rat362XITpx1bjrwA2yWy6WWxRevGeqjtFoz2Z/soPQihHpkCLdsAi0lHb1 r3pOMfs9lmM3aV8uVzoVmNN3Ew0BqWIZGF5ogz1WkQXSRMgWzmpWpdzN/nLbGfc3wv1U 8OXJU09qCURRxDDp3BBK0/CfPki+qwMDQbvFUSlkvN/jVue8r7/UD/99zHuQmft03MnM bzQzZjWdLkLEVRr0ogrW/2asd7vNUTcmKFZbInld6RUa2w+9Uhh++MDXhs+cJutinwFa YQJIUiMlb61G8J9FBw7UampmPe8F8nJbu304mwOEauY/PSlB0rqfrM/IWbzjX9wpZnXm KMUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si716053edq.10.2020.09.23.13.32.49; Wed, 23 Sep 2020 13:33:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbgIWUbs (ORCPT + 99 others); Wed, 23 Sep 2020 16:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbgIWUbs (ORCPT ); Wed, 23 Sep 2020 16:31:48 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0FBCC0613CE; Wed, 23 Sep 2020 13:31:48 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id B69C711D53F8B; Wed, 23 Sep 2020 13:15:00 -0700 (PDT) Date: Wed, 23 Sep 2020 13:31:47 -0700 (PDT) Message-Id: <20200923.133147.842604978902817779.davem@davemloft.net> To: s.riedmueller@phytec.de Cc: fugang.duan@nxp.com, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, c.hemp@phytec.de Subject: Re: [PATCH] net: fec: Keep device numbering consistent with datasheet From: David Miller In-Reply-To: <20200923142528.303730-1-s.riedmueller@phytec.de> References: <20200923142528.303730-1-s.riedmueller@phytec.de> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [2620:137:e000::1:9]); Wed, 23 Sep 2020 13:15:01 -0700 (PDT) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Riedmueller Date: Wed, 23 Sep 2020 16:25:28 +0200 > From: Christian Hemp > > 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 > Signed-off-by: Stefan Riedmueller 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.