Skip to contentSkip to conversation

PHY subsystem kernel doc

PATCH In review Andrew Lunn 2 participants 4 messages Sep 22, 2020 – Sep 24, 2020

Subsystems (4)
lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

v2 cover PHY subsystem kernel doc

The first patches fix existing warnings in the kerneldoc for the PHY subsystem, and then the 2nd extend the kernel documentation for the major structures and functions in the PHY subsystem.

v2:
Drop the other fixes which have already been merged. s/phy/PHY/g
TBI
TypOs

Andrew Lunn (2):
net: phy: Fixup kernel doc
net: phy: Document core PHY structures

 Documentation/networking/kapi.rst |   9 +
 drivers/net/phy/phy-core.c        |  32 ++-
 drivers/net/phy/phy.c             |  69 ++++-
 include/linux/mdio.h              |   3 +-
 include/linux/phy.h               | 426 +++++++++++++++++++++---------
 5 files changed, 404 insertions(+), 135 deletions(-)
Signature · 1 line
2.28.0
author maintainer
#1 lore raw

PATCH v2 1/2 net: phy: Fixup kernel doc

Add missing parameter documentation, or fixup wrong parameter names.

---
 include/linux/mdio.h | 3 ++-
 include/linux/phy.h  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
include/linux/mdio.h +2 -1
index 3a88b699b758..dbd69b3d170b 100644
@@ -306,7 +306,7 @@ static inline u32 linkmode_adv_to_mii_10gbt_adv_t(unsigned long *advertising)
 /**
  * mii_10gbt_stat_mod_linkmode_lpa_t
  * @advertising: target the linkmode advertisement settings
- * @adv: value of the C45 10GBASE-T AN STATUS register
+ * @lpa: value of the C45 10GBASE-T AN STATUS register
  *
  * A small helper function that translates C45 10GBASE-T AN STATUS register bits
  * to linkmode advertisement settings. Other bits in advertising aren't changed.
@@ -371,6 +371,7 @@ struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr);
 
 /**
  * mdio_module_driver() - Helper macro for registering mdio drivers
+ * @_mdio_driver: driver to register
  *
  * Helper macro for MDIO drivers which do not do anything special in module
  * init/exit. Each module may only use this macro once, and calling it
include/linux/phy.h +2 -1
index 3a09d2bf69ea..4901b2637059 100644
@@ -1566,8 +1566,9 @@ static inline int mdiobus_register_board_info(const struct mdio_board_info *i,
 
 
 /**
- * module_phy_driver() - Helper macro for registering PHY drivers
+ * phy_module_driver() - Helper macro for registering PHY drivers
  * @__phy_drivers: array of PHY drivers to register
+ * @__count: Numbers of members in array
  *
  * Helper macro for PHY drivers which do not do anything special in module
  * init/exit. Each module may only use this macro once, and calling it
Signature · 1 line
2.28.0
author maintainer
#2 lore raw

PATCH v2 2/2 net: phy: Document core PHY structures

In reply to Andrew Lunn

Add kerneldoc for the core PHY data structures, a few inline functions and exported functions which are not already documented.

v2
Typos
g/phy/PHY/s

---
 Documentation/networking/kapi.rst |   9 +
 drivers/net/phy/phy-core.c        |  32 ++-
 drivers/net/phy/phy.c             |  69 ++++-
 include/linux/phy.h               | 423 +++++++++++++++++++++---------
 4 files changed, 400 insertions(+), 133 deletions(-)
Documentation/networking/kapi.rst +9 -0
index f03ae64be8bc..d198fa5eaacd 100644
@@ -134,6 +134,15 @@ PHY Support
 .. kernel-doc:: drivers/net/phy/phy.c
    :internal:
 
+.. kernel-doc:: drivers/net/phy/phy-core.c
+   :export:
+
+.. kernel-doc:: drivers/net/phy/phy-c45.c
+   :export:
+
+.. kernel-doc:: include/linux/phy.h
+   :internal:
+
 .. kernel-doc:: drivers/net/phy/phy_device.c
    :export:
 
drivers/net/phy/phy-core.c +31 -1
index de5b869139d7..8d333d3084ed 100644
@@ -6,6 +6,11 @@
 #include <linux/phy.h>
 #include <linux/of.h>
 
+/**
+ * phy_speed_to_str - Return a string representing the PHY link speed
+ *
+ * @speed: Speed of the link
+ */
 const char *phy_speed_to_str(int speed)
 {
 	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 92,
@@ -52,6 +57,11 @@ const char *phy_speed_to_str(int speed)
 }
 EXPORT_SYMBOL_GPL(phy_speed_to_str);
 
+/**
+ * phy_duplex_to_str - Return string describing the duplex
+ *
+ * @duplex: Duplex setting to describe
+ */
 const char *phy_duplex_to_str(unsigned int duplex)
 {
 	if (duplex == DUPLEX_HALF)
@@ -252,6 +262,16 @@ static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
 	return __set_linkmode_max_speed(max_speed, phydev->supported);
 }
 
+/**
+ * phy_set_max_speed - Set the maximum speed the PHY should support
+ *
+ * @phydev: The phy_device struct
+ * @max_speed: Maximum speed
+ *
+ * The PHY might be more capable than the MAC. For example a Fast Ethernet
+ * is connected to a 1G PHY. This function allows the MAC to indicate its
+ * maximum speed, and so limit what the PHY will advertise.
+ */
 int phy_set_max_speed(struct phy_device *phydev, u32 max_speed)
 {
 	int err;
@@ -308,6 +328,16 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
 	phydev->eee_broken_modes = broken;
 }
 
+/**
+ * phy_resolve_aneg_pause - Determine pause autoneg results
+ *
+ * @phydev: The phy_device struct
+ *
+ * Once autoneg has completed the local pause settings can be
+ * resolved.  Determine if pause and asymmetric pause should be used
+ * by the MAC.
+ */
+
 void phy_resolve_aneg_pause(struct phy_device *phydev)
 {
 	if (phydev->duplex == DUPLEX_FULL) {
@@ -321,7 +351,7 @@ void phy_resolve_aneg_pause(struct phy_device *phydev)
 EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause);
 
 /**
- * phy_resolve_aneg_linkmode - resolve the advertisements into phy settings
+ * phy_resolve_aneg_linkmode - resolve the advertisements into PHY settings
  * @phydev: The phy_device struct
  *
  * Resolve our and the link partner advertisements into their corresponding
drivers/net/phy/phy.c +68 -1

135 lines not on this page · raw message

include/linux/phy.h +292 -131

683 lines not on this page · raw message

Signature · 1 line
2.28.0
maintainer
#3 lore raw
In reply to Andrew Lunn

From: Andrew Lunn <[email protected]>
Date: Wed, 23 Sep 2020 00:29:01 +0200

Quoted 9 lines

The first patches fix existing warnings in the kerneldoc for the PHY subsystem, and then the 2nd extend the kernel documentation for the major structures and functions in the PHY subsystem.

v2:
Drop the other fixes which have already been merged. s/phy/PHY/g
TBI
TypOs

Series applied, thanks Andrew.