Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp78834pxb; Tue, 26 Oct 2021 21:50:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNroz8nqIhXmuZEO+L+tuTSfq2Csg3tbCZ7ZA0OYcPCaic1aqrrK0bEgxax43WfVmVZaq4 X-Received: by 2002:a17:90b:1511:: with SMTP id le17mr3321975pjb.99.1635310213751; Tue, 26 Oct 2021 21:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635310213; cv=none; d=google.com; s=arc-20160816; b=IPM9iJxUny4dRbvEPm9bDh3ASNdCTmnOG0VMhPoDAf+AJ302MADgieFV/cX8t+LyU5 d8zQJyg7xTJ0wOkDUo9NMtT4Jcp+uAVHkrOiTUP9KO+xGzoYWcMuh2hX2qSs/VJ9WdCH qtCREB+9FbdUilB6m2723JtUCfGbp4VypL0fN7qhtMsdhsTZzggxfrDTdrNy7zR6A0QZ XSmW1tUAYrVk9kV42298ghTEKLaf9w7QrHdRCuS2DYRBqvXMnC5Mzd2t88OuMifu/otF bnfJoZNVavNNwhAVkTvIvycKWKY8GVQc8Qi92DDpRNk+7fPc265e53oNldjEU+bovmpM aLWg== 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 :message-id:date:subject:cc:to:from; bh=l0wh5YMqOaVmGp6OFm2bSxMR+zxoTOUCUUFTwwf+TQA=; b=NGCCqNn1Su0ao+0Yvk3GN+45J19B9RDZpeiiJXwgNfsMtnibamGSyyC9EtDx4moYCs NgWAeN2yhtBYOaB3cMCag/C3275awhAJdflND5EUHrfx5iq6BV+041cgNYwBoTJDNRrx 5hLY++b7e7WyQfTXz9ImuZhtqWC7BbFsRLAjQdmzaUGZB8PI8etNpLl/pj7g5ZG/J2nm 660I8sfujYC5ltfmK3SImG01Aq3Ve9UoQmUcdLgYOFMUGpX7VmJNY2E74SkrYR6keqMb +sCrrAFefIy5GmZnKbePB3uhHarv0EK1tuzBNQlf1CI8XnJVDtUI+/qgywElLSJjo5VD ubOQ== 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 c8si3229348pjq.55.2021.10.26.21.49.34; Tue, 26 Oct 2021 21:50:13 -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 S238054AbhJZSIm (ORCPT + 99 others); Tue, 26 Oct 2021 14:08:42 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:60045 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236768AbhJZSIl (ORCPT ); Tue, 26 Oct 2021 14:08:41 -0400 Received: from tomoyo.flets-east.jp ([114.149.34.46]) by smtp.orange.fr with ESMTPA id fQpgm4IVoBazofQpomL3LR; Tue, 26 Oct 2021 20:06:16 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: MDU0YmViZGZmMDIzYiBlMiM2NTczNTRjNWZkZTMwOGRiOGQ4ODf3NWI1ZTMyMzdiODlhOQ== X-ME-Date: Tue, 26 Oct 2021 20:06:16 +0200 X-ME-IP: 114.149.34.46 From: Vincent Mailhol To: Marc Kleine-Budde , linux-can@vger.kernel.org, Lukas Magel Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH v1] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port Date: Wed, 27 Oct 2021 03:05:53 +0900 Message-Id: <20211026180553.1953189-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The field dev_port of struct net_device indicates the port number of a network device [1]. This patch populates this field. This field can be helpful to distinguish between the two network interfaces of a dual channel device (i.e. ES581.4 or ES582.1). Indeed, at the moment, all the network interfaces of a same device share the same static udev attributes c.f. output of: | udevadm info --attribute-walk /sys/class/net/canX The dev_port attribute can then be used to write some udev rules to, for example, assign a permanent name to each network interface based on the serial/dev_port pair (which is convenient when you have a test bench with several CAN devices connected simultaneously and wish to keep consistent interface names upon reboot). [1] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net Suggested-by: Lukas Magel Signed-off-by: Vincent Mailhol --- drivers/net/can/usb/etas_es58x/es58x_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index 96a13c770e4a..403de7e9d084 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -2096,6 +2096,7 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx) netdev->netdev_ops = &es58x_netdev_ops; netdev->flags |= IFF_ECHO; /* We support local echo */ + netdev->dev_port = channel_idx; ret = register_candev(netdev); if (ret) -- 2.32.0