Messages in this thread | | | Date | Fri, 15 Dec 2023 09:51:44 -0800 | Subject | Re: [net-next PATCH v3 1/3] net: phy: refactor and better document phy_speeds function | From | Randy Dunlap <> |
| |
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@gmail.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
| |