Message ID | 20240304151011.1610175-5-maxime.chevallier@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-90783-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1484359dyc; Mon, 4 Mar 2024 07:13:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV6bcO7NRacEUgpUZ+DhgYC403ecfpsuZLTBYXV0eGw/zie3GrL6bfBZ6PgeDveF3uGJS2LPluQz3ijhD8wEqCjCtuGMQ== X-Google-Smtp-Source: AGHT+IGBK5F5vBiO1G5B8iTtj+yY05yviG9sYQ8fvLMtOcbEVPA8+DzRvRAoUrPRCNtQdKUsYCEl X-Received: by 2002:a17:906:b08:b0:a45:248e:b253 with SMTP id u8-20020a1709060b0800b00a45248eb253mr2700599ejg.76.1709565190487; Mon, 04 Mar 2024 07:13:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709565190; cv=pass; d=google.com; s=arc-20160816; b=TKMf+y7wXoqFQLzkjebPVh91BgNTqIClawhks2gWFWxV4jtET/ivz2CkC9BO+r3Yh1 t2YsAZVQLAE4IkJG3aLahvssXgWSZ4NEpdRpFTgin9MTh5V4sh0dvzd8E7VZqT8SxUfn rRA7kFjKtbm2EwgAmGlZShrhCN4I4VO4SaFXQfeY4/P0fUfTUkb04l2+ChaDhSoKfqR0 ScAMHzJwv+kB1HOBxkiLkXlSkvpAL2eH1RVBlYk4K0gCComg2LbVoYD5k10Myh53MYAB TCHenj2hnnIb7QJJQ9LLRwsyn8uet5vKaL1Sqg+GCPi9Pd6GTqa//GhXANXNzwhArWr7 b0YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MFQPtl2S0krjE67qH+tSTLUZ7cgX9mfnySWLJzrZtAE=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=EtB9Enr6MtD7we6cQofEtph1Ymc0Ipwc10RRCHugYD449xGXg4JR8ZFGYKVCca5Md2 o0b92tW2pD/Ltui42IGkHVk80G79kIRedBo4ttH0+GWvQohP/9u1CmlqZ4Smtk+0phw+ Y0oqwn7zMhcKdUpt8rW8V+snGzh2esGFLku736qfbHBD7bvgc9dury4Eq5ieOML4aZQU Ux+7OqQ8MMioF9MWEwrJHTANceBGuu3RKQNASFs+BIi4GSp56wpNEjBc6/+9iyw8EPVC exwqYCvnPQ/4dBSw+gBr/LbqUC1WABBV1m2I65QTMBEGDhrvyfPnl1qTs4+xgAFnCs0h L+CA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VAI5zptD; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-90783-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90783-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v13-20020a17090606cd00b00a4410bcb974si4005177ejb.78.2024.03.04.07.13.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 07:13:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90783-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VAI5zptD; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-90783-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90783-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1FAAD1F23014 for <ouuuleilei@gmail.com>; Mon, 4 Mar 2024 15:13:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8ED935380C; Mon, 4 Mar 2024 15:10:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VAI5zptD" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B93EE4AEF6; Mon, 4 Mar 2024 15:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709565023; cv=none; b=KqcDYSCpWvXam3o0rCDTs90WgenbBTkmKYf4z0vFhWcvXcDFFKZ2Wcoyjdvzn8f0zpOOx+UginNzBgoxz9+hfeJfPT7mOgUp5EgNHTIktXKPWIUj8FYRsiW/CUAnkPgCbHRY6AIAGT3cVx7cdbYKhi9lQ/M+CRSuhnsTpBjbtpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709565023; c=relaxed/simple; bh=SmGGZwV9wmLzWbOiPnV9VQFg8jo0MlN1d/1KVpk3OoU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fc6jTvTEd9DYjuZHuoNCCUVVU6lhmfNAklRvTURy0POacrqtp6wsMFo66jznyFHuNlgtqnnrqc9Lin2twHsNWBS3v/nP9qBQ0Jefmwl6OfmoPPsQYbEgzYK9KxMdmBLqPXF206yS8o7bMKFk0vxL3P28NJOee2yEpt42meIt+zw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VAI5zptD; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id DA5AE1BF211; Mon, 4 Mar 2024 15:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709565020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MFQPtl2S0krjE67qH+tSTLUZ7cgX9mfnySWLJzrZtAE=; b=VAI5zptDU5hq39a6KOnw5Uv9UIdpVxkowi54/k4oCUk+oYQU1iMul8DzYlnrfhr78o43UJ s91Yw9jBBa0xI/raCPZjbsrF2m9uCSNhncrk0ap0QaEl7AwDtSUIpFDjJR0xfaO6N++vIz PegQSgkmKJ/i+3HQdEpLDydg9ZuDzk4K5FK9uQTvc9lQgyaZ5cDlpVs3eHSXfbA2z33Hci H7X1e7ykM25UPav1lJFKjSFwIpXssQLSNIUxkCztWGXqpX/MaVh7xUE9pT6MVdP8kUO/bG Tmjd1omycZjMtq7s1uLLnH8vOAxZqaq8b0kMrOgJTck5oDHIZS0KuKLtAygE/Q== From: Maxime Chevallier <maxime.chevallier@bootlin.com> To: davem@davemloft.net Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, Russell King <linux@armlinux.org.uk>, linux-arm-kernel@lists.infradead.org, Christophe Leroy <christophe.leroy@csgroup.eu>, Herve Codina <herve.codina@bootlin.com>, Florian Fainelli <f.fainelli@gmail.com>, Heiner Kallweit <hkallweit1@gmail.com>, Vladimir Oltean <vladimir.oltean@nxp.com>, =?utf-8?q?K=C3=B6ry_Maincent?= <kory.maincent@bootlin.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Jonathan Corbet <corbet@lwn.net>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, Piergiorgio Beruto <piergiorgio.beruto@gmail.com>, Oleksij Rempel <o.rempel@pengutronix.de>, =?utf-8?q?Nicol=C3=B2_Veronese?= <nicveronese@gmail.com>, Simon Horman <horms@kernel.org>, mwojtas@chromium.org Subject: [PATCH net-next v10 04/13] net: sfp: Add helper to return the SFP bus name Date: Mon, 4 Mar 2024 16:10:00 +0100 Message-ID: <20240304151011.1610175-5-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304151011.1610175-1-maxime.chevallier@bootlin.com> References: <20240304151011.1610175-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: maxime.chevallier@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792609029143350656 X-GMAIL-MSGID: 1792609029143350656 |
Series |
Introduce PHY listing and link_topology tracking
|
|
Commit Message
Maxime Chevallier
March 4, 2024, 3:10 p.m. UTC
Knowing the bus name is helpful when we want to expose the link topology to userspace, add a helper to return the SFP bus name. Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> --- V10: - No changes V9: - No changes V8: - No changes V7: - No changes V6: - No changes V5: - Added Andrew's R-b V4: - No changes V3: - Added RTNL assert drivers/net/phy/sfp-bus.c | 11 +++++++++++ include/linux/sfp.h | 6 ++++++ 2 files changed, 17 insertions(+)
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index e05013aeecc3..413021619afe 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -859,3 +859,14 @@ void sfp_unregister_socket(struct sfp_bus *bus) sfp_bus_put(bus); } EXPORT_SYMBOL_GPL(sfp_unregister_socket); + +const char *sfp_get_name(struct sfp_bus *bus) +{ + ASSERT_RTNL(); + + if (bus->sfp_dev) + return dev_name(bus->sfp_dev); + + return NULL; +} +EXPORT_SYMBOL_GPL(sfp_get_name); diff --git a/include/linux/sfp.h b/include/linux/sfp.h index 0573e53b0c11..55c0ab17c9e2 100644 --- a/include/linux/sfp.h +++ b/include/linux/sfp.h @@ -570,6 +570,7 @@ struct sfp_bus *sfp_bus_find_fwnode(const struct fwnode_handle *fwnode); int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, const struct sfp_upstream_ops *ops); void sfp_bus_del_upstream(struct sfp_bus *bus); +const char *sfp_get_name(struct sfp_bus *bus); #else static inline int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id, @@ -648,6 +649,11 @@ static inline int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, static inline void sfp_bus_del_upstream(struct sfp_bus *bus) { } + +static inline const char *sfp_get_name(struct sfp_bus *bus) +{ + return NULL; +} #endif #endif