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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2bde540c-b637-49f6-a8fd-03b5b95f752c@infradead.org>
Date: Fri, 15 Dec 2023 09:49:40 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Christian Marangi <ansuelsmth@...il.com>, Andrew Lunn <andrew@...n.ch>,
 Heiner Kallweit <hkallweit1@...il.com>, Russell King
 <linux@...linux.org.uk>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH v3 2/3] net: phy: add simple helper to return
 count of supported speeds



On 12/15/23 05:29, Christian Marangi wrote:
> Add simple helper to return count of supported speeds for the passed PHY
> device.
> 
> This can be useful to know the number of speed modes to dynamically
> allocate a speed array for it.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> ---
>  drivers/net/phy/phy.c | 12 ++++++++++++
>  include/linux/phy.h   |  2 ++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index a5fa077650e8..311560e72126 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -229,6 +229,18 @@ phy_find_valid(int speed, int duplex, unsigned long *supported)
>  	return phy_lookup_setting(speed, duplex, supported, false);
>  }
>  
> +/**
> + * phy_supported_speeds_num - return the number of all speeds currently
> + *			      supported by a phy device
> + * @phy: The phy device to return supported speeds of.
> + *
> + * Description: Returns the number of supported speeds.

For kernel-doc, better to have that line as:

 * Returns: the number of supported speeds.



> + */
> +unsigned int phy_supported_speeds_num(struct phy_device *phy)
> +{
> +	return phy_speeds(NULL, 0, phy->supported);
> +}
> +
>  /**
>   * phy_supported_speeds - return all speeds currently supported by a phy device
>   * @phy: The phy device to return supported speeds of.
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 3cc52826f18e..52aa415fab0f 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -202,6 +202,8 @@ static inline void phy_interface_set_rgmii(unsigned long *intf)
>  	__set_bit(PHY_INTERFACE_MODE_RGMII_TXID, intf);
>  }
>  
> +unsigned int phy_supported_speeds_num(struct phy_device *phy);
> +
>  /*
>   * phy_supported_speeds - return all speeds currently supported by a PHY device
>   */

-- 
#Randy
https://people.kernel.org/tglx/notes-about-netiquette
https://subspace.kernel.org/etiquette.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ