lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZoVv9OJl0Cu67q1E@shell.armlinux.org.uk>
Date: Wed, 3 Jul 2024 16:36:20 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
	Andrew Lunn <andrew@...n.ch>, Jakub Kicinski <kuba@...nel.org>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	linux-arm-kernel@...ts.infradead.org,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	Herve Codina <herve.codina@...tlin.com>,
	Florian Fainelli <f.fainelli@...il.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Vladimir Oltean <vladimir.oltean@....com>,
	Köry Maincent <kory.maincent@...tlin.com>,
	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Marek Behún <kabel@...nel.org>,
	Piergiorgio Beruto <piergiorgio.beruto@...il.com>,
	Oleksij Rempel <o.rempel@...gutronix.de>,
	Nicolò Veronese <nicveronese@...il.com>,
	Simon Horman <horms@...nel.org>, mwojtas@...omium.org,
	Nathan Chancellor <nathan@...nel.org>,
	Antoine Tenart <atenart@...nel.org>,
	Marc Kleine-Budde <mkl@...gutronix.de>,
	Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH net-next v15 04/14] net: sfp: Add helper to return the
 SFP bus name

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 <maxime.chevallier@...tlin.com>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> ---
>  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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ