diff mbox series

[net-next,v2,2/3] net: phy: add simple helper to return count of supported speeds

Message ID 20231214154906.29436-3-ansuelsmth@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: add define to describe link speed modes | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 1115 this patch: 1117
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang fail Errors and warnings before: 1142 this patch: 1144
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 1142 this patch: 1144
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Marangi Dec. 14, 2023, 3:49 p.m. UTC
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 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

kernel test robot Dec. 15, 2023, 12:16 p.m. UTC | #1
Hi Christian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-phy-refactor-and-better-document-phy_speeds-function/20231215-064112
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231214154906.29436-3-ansuelsmth%40gmail.com
patch subject: [net-next PATCH v2 2/3] net: phy: add simple helper to return count of supported speeds
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20231215/202312152053.bbqS93v4-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231215/202312152053.bbqS93v4-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312152053.bbqS93v4-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/phy/phy.c:239:14: warning: no previous prototype for 'phy_supported_speeds_num' [-Wmissing-prototypes]
     239 | unsigned int phy_supported_speeds_num(struct phy_device *phy)
         |              ^~~~~~~~~~~~~~~~~~~~~~~~


vim +/phy_supported_speeds_num +239 drivers/net/phy/phy.c

   231	
   232	/**
   233	 * phy_supported_speeds_num - return the number of all speeds currently
   234	 *			      supported by a phy device
   235	 * @phy: The phy device to return supported speeds of.
   236	 *
   237	 * Description: Returns the number of supported speeds.
   238	 */
 > 239	unsigned int phy_supported_speeds_num(struct phy_device *phy)
   240	{
   241		return phy_speeds(NULL, 0, phy->supported);
   242	}
   243
diff mbox series

Patch

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.
+ */
+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.