[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <387c75f9-e2f3-499a-bfb3-17b18398866a@infradead.org>
Date: Fri, 15 Dec 2023 09:51:44 -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 1/3] net: phy: refactor and better document
phy_speeds function
Hi--
On 12/15/23 05:29, Christian Marangi wrote:
> Refactor the phy_speeds function to be more readable and understandable
> and add some documentation on it.
>
> While on it extend it to take NULL speeds values to make it return only
> the count of speed modes in the passed mask.
>
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> ---
> drivers/net/phy/phy-core.c | 50 ++++++++++++++++++++++++++++++++++----
> 1 file changed, 45 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
> index 966c93cbe616..9618d89458d1 100644
> --- a/drivers/net/phy/phy-core.c
> +++ b/drivers/net/phy/phy-core.c
> @@ -317,17 +317,57 @@ phy_lookup_setting(int speed, int duplex, const unsigned long *mask, bool exact)
> }
> EXPORT_SYMBOL_GPL(phy_lookup_setting);
>
> +/**
> + * phy_speeds - return all speeds in mask
> + * @speeds: pointer to array where to put the speed modes
> + * @size: size of array where to put the speed modes
> + * @mask: mask of speed modes to compare with
> + *
> + * Take mask, test bit in mask with the settings table and compose the
> + * speeds array based on that as many as size permits.
> + *
> + * With speeds NULL, only the number of detected modes is returned and
> + * no array is composed. (size value is ignored)
> + *
> + * Return the number of detected modes in mask.
* Return: the number of detected modes in mask.
> + */
--
#Randy
https://people.kernel.org/tglx/notes-about-netiquette
https://subspace.kernel.org/etiquette.html
Powered by blists - more mailing lists