From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30D99C2BD09 for ; Wed, 3 Jul 2024 15:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zH2SD8rUaX7tL9j2puH1Vo4TaLc9D24I4uSOaHfGKUU=; b=OMo3Au3bosmblNur0GEotJwN8W nTBt/Ljx2sgSfGbwGrqjFe0Ni/Ze6+gSvX3AEzg3cSi50UmnxMDc6cVI477I+XQsplH4XsYW/n81+ ync6jg2/cYqRopiztVX4TpcFkB+mJAu/3t5Y4KkomMjDnomQ7NyprkozaKlbMpTDijtbu4l1lhKNn ZF49VacAFX7KI58ZXapQobNwyfDjTt5Al0qTHcLyKfKwzgVvS2yvYMZ9C+XVwumony2xrqoQ0qK/h 8olBWPkPlgYOpjpL6605f7cKB0PwwNYyYotZ7o4Ck0tRbxj0y3f5WXmVSis9Y5ItJea5VcLFMuz7T +5hdeeww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP22K-0000000AhWB-0ubp; Wed, 03 Jul 2024 15:36:48 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP227-0000000AhRe-427L for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 15:36:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zH2SD8rUaX7tL9j2puH1Vo4TaLc9D24I4uSOaHfGKUU=; b=OBMttbIFFxa0CY+KssUWOtm0A1 MuzR5/Om6OAM9o8YYKpZcd+S4mTrbqKuaFYLLJR9sslmq+iXG8HcvbGIff7sd4FtT20tOCq609qxz wfpx6UGzsmNfx8uSE8XqMzqCOFG+p8KY2aw6tQf4Up6+3iBqjQD0IvG7RIPDBy9kHRVUttM4d+H1G QzjD4PlsuQHxPEl4vBNVxLb4qy1ed9/BWbJ22drVQjQSf7SgTndX0dm4tzXsRo4D2JZVZaBhxjshD KdMZpHb03O6Px8NlpjJHf2m65cnkmJYW26UqlQFIldn5pVg7WWSrjgu8WTDXgGZwOGC25Z4F5uQgR 6Lf/xFRQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51192) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sP21s-0005mW-1U; Wed, 03 Jul 2024 16:36:20 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sP21s-00031Y-W0; Wed, 03 Jul 2024 16:36:21 +0100 Date: Wed, 3 Jul 2024 16:36:20 +0100 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?iso-8859-1?Q?K=F6ry?= Maincent , Jesse Brandeburg , Marek =?iso-8859-1?Q?Beh=FAn?= , Piergiorgio Beruto , Oleksij Rempel , =?iso-8859-1?Q?Nicol=F2?= Veronese , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart , Marc Kleine-Budde , Dan Carpenter Subject: Re: [PATCH net-next v15 04/14] net: sfp: Add helper to return the SFP bus name Message-ID: References: <20240703140806.271938-1-maxime.chevallier@bootlin.com> <20240703140806.271938-5-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240703140806.271938-5-maxime.chevallier@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_083636_042683_E24006B1 X-CRM114-Status: GOOD ( 18.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 03, 2024 at 04:07:54PM +0200, Maxime Chevallier wrote: > 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. I think it's worth mentioning about the use case in this patch as well, something like: "This call will always be made while holding the RTNL which ensures that the SFP driver won't unbind from the device. The returned pointer to the bus name will only be used while RTNL is held." > > Signed-off-by: Maxime Chevallier > Reviewed-by: Andrew Lunn > --- > 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 56953e66bb7b..37c85f1e6534 100644 > --- a/drivers/net/phy/sfp-bus.c > +++ b/drivers/net/phy/sfp-bus.c > @@ -860,3 +860,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); Please move this to just below sfp_bus_del_upstream() since the functions in this file are organised as: - internal functions - upstream callable functions - downstream (sfp driver) callable functions. Note also that the upstream callable functions are all documented with kerneldoc, and sfp_get_name() is clearly a function called from the upstream side. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!