From: Randy Dunlap <rdunlap@infradead.org>
To: Christian Marangi <ansuelsmth@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH v3 2/3] net: phy: add simple helper to return count of supported speeds
Date: Fri, 15 Dec 2023 09:49:40 -0800 [thread overview]
Message-ID: <2bde540c-b637-49f6-a8fd-03b5b95f752c@infradead.org> (raw)
In-Reply-To: <20231215132921.16808-3-ansuelsmth@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2023-12-15 17:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 13:29 [net-next PATCH v3 0/3] net: add define to describe link speed modes Christian Marangi
2023-12-15 13:29 ` [net-next PATCH v3 1/3] net: phy: refactor and better document phy_speeds function Christian Marangi
2023-12-15 17:51 ` Randy Dunlap
2023-12-15 13:29 ` [net-next PATCH v3 2/3] net: phy: add simple helper to return count of supported speeds Christian Marangi
2023-12-15 17:49 ` Randy Dunlap [this message]
2023-12-15 13:29 ` [net-next PATCH v3 3/3] net: phy: led: dynamically allocate speed modes array Christian Marangi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2bde540c-b637-49f6-a8fd-03b5b95f752c@infradead.org \
--to=rdunlap@infradead.org \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).