Skip to content

Commit e0da743

Browse files
committed
Merge branch 'PHY-subsystem-kernel-doc'
Andrew Lunn says: ==================== 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 ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 3fc826f + 4069a57 commit e0da743

File tree

5 files changed

+404
-135
lines changed

5 files changed

+404
-135
lines changed

Documentation/networking/kapi.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ PHY Support
134134
.. kernel-doc:: drivers/net/phy/phy.c
135135
:internal:
136136

137+
.. kernel-doc:: drivers/net/phy/phy-core.c
138+
:export:
139+
140+
.. kernel-doc:: drivers/net/phy/phy-c45.c
141+
:export:
142+
143+
.. kernel-doc:: include/linux/phy.h
144+
:internal:
145+
137146
.. kernel-doc:: drivers/net/phy/phy_device.c
138147
:export:
139148

drivers/net/phy/phy-core.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include <linux/phy.h>
77
#include <linux/of.h>
88

9+
/**
10+
* phy_speed_to_str - Return a string representing the PHY link speed
11+
*
12+
* @speed: Speed of the link
13+
*/
914
const char *phy_speed_to_str(int speed)
1015
{
1116
BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 92,
@@ -52,6 +57,11 @@ const char *phy_speed_to_str(int speed)
5257
}
5358
EXPORT_SYMBOL_GPL(phy_speed_to_str);
5459

60+
/**
61+
* phy_duplex_to_str - Return string describing the duplex
62+
*
63+
* @duplex: Duplex setting to describe
64+
*/
5565
const char *phy_duplex_to_str(unsigned int duplex)
5666
{
5767
if (duplex == DUPLEX_HALF)
@@ -252,6 +262,16 @@ static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
252262
return __set_linkmode_max_speed(max_speed, phydev->supported);
253263
}
254264

265+
/**
266+
* phy_set_max_speed - Set the maximum speed the PHY should support
267+
*
268+
* @phydev: The phy_device struct
269+
* @max_speed: Maximum speed
270+
*
271+
* The PHY might be more capable than the MAC. For example a Fast Ethernet
272+
* is connected to a 1G PHY. This function allows the MAC to indicate its
273+
* maximum speed, and so limit what the PHY will advertise.
274+
*/
255275
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed)
256276
{
257277
int err;
@@ -308,6 +328,16 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
308328
phydev->eee_broken_modes = broken;
309329
}
310330

331+
/**
332+
* phy_resolve_aneg_pause - Determine pause autoneg results
333+
*
334+
* @phydev: The phy_device struct
335+
*
336+
* Once autoneg has completed the local pause settings can be
337+
* resolved. Determine if pause and asymmetric pause should be used
338+
* by the MAC.
339+
*/
340+
311341
void phy_resolve_aneg_pause(struct phy_device *phydev)
312342
{
313343
if (phydev->duplex == DUPLEX_FULL) {
@@ -321,7 +351,7 @@ void phy_resolve_aneg_pause(struct phy_device *phydev)
321351
EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause);
322352

323353
/**
324-
* phy_resolve_aneg_linkmode - resolve the advertisements into phy settings
354+
* phy_resolve_aneg_linkmode - resolve the advertisements into PHY settings
325355
* @phydev: The phy_device struct
326356
*
327357
* Resolve our and the link partner advertisements into their corresponding

drivers/net/phy/phy.c

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,16 @@ int phy_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
456456
}
457457
EXPORT_SYMBOL(phy_do_ioctl);
458458

459-
/* same as phy_do_ioctl, but ensures that net_device is running */
459+
/**
460+
* phy_do_ioctl_running - generic ndo_do_ioctl implementation but test first
461+
*
462+
* @dev: the net_device struct
463+
* @ifr: &struct ifreq for socket ioctl's
464+
* @cmd: ioctl cmd to execute
465+
*
466+
* Same as phy_do_ioctl, but ensures that net_device is running before
467+
* handling the ioctl.
468+
*/
460469
int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd)
461470
{
462471
if (!netif_running(dev))
@@ -466,13 +475,24 @@ int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd)
466475
}
467476
EXPORT_SYMBOL(phy_do_ioctl_running);
468477

478+
/**
479+
* phy_queue_state_machine - Trigger the state machine to run soon
480+
*
481+
* @phydev: the phy_device struct
482+
* @jiffies: Run the state machine after these jiffies
483+
*/
469484
void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies)
470485
{
471486
mod_delayed_work(system_power_efficient_wq, &phydev->state_queue,
472487
jiffies);
473488
}
474489
EXPORT_SYMBOL(phy_queue_state_machine);
475490

491+
/**
492+
* phy_queue_state_machine - Trigger the state machine to run now
493+
*
494+
* @phydev: the phy_device struct
495+
*/
476496
static void phy_trigger_machine(struct phy_device *phydev)
477497
{
478498
phy_queue_state_machine(phydev, 0);
@@ -489,6 +509,12 @@ static void phy_abort_cable_test(struct phy_device *phydev)
489509
phydev_err(phydev, "Error while aborting cable test");
490510
}
491511

512+
/**
513+
* phy_ethtool_get_strings - Get the statistic counter names
514+
*
515+
* @phydev: the phy_device struct
516+
* @data: Where to put the strings
517+
*/
492518
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
493519
{
494520
if (!phydev->drv)
@@ -502,6 +528,11 @@ int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
502528
}
503529
EXPORT_SYMBOL(phy_ethtool_get_strings);
504530

531+
/**
532+
* phy_ethtool_get_sset_count - Get the number of statistic counters
533+
*
534+
* @phydev: the phy_device struct
535+
*/
505536
int phy_ethtool_get_sset_count(struct phy_device *phydev)
506537
{
507538
int ret;
@@ -523,6 +554,13 @@ int phy_ethtool_get_sset_count(struct phy_device *phydev)
523554
}
524555
EXPORT_SYMBOL(phy_ethtool_get_sset_count);
525556

557+
/**
558+
* phy_ethtool_get_stats - Get the statistic counters
559+
*
560+
* @phydev: the phy_device struct
561+
* @stats: What counters to get
562+
* @data: Where to store the counters
563+
*/
526564
int phy_ethtool_get_stats(struct phy_device *phydev,
527565
struct ethtool_stats *stats, u64 *data)
528566
{
@@ -537,6 +575,12 @@ int phy_ethtool_get_stats(struct phy_device *phydev,
537575
}
538576
EXPORT_SYMBOL(phy_ethtool_get_stats);
539577

578+
/**
579+
* phy_start_cable_test - Start a cable test
580+
*
581+
* @phydev: the phy_device struct
582+
* @extack: extack for reporting useful error messages
583+
*/
540584
int phy_start_cable_test(struct phy_device *phydev,
541585
struct netlink_ext_ack *extack)
542586
{
@@ -600,6 +644,13 @@ int phy_start_cable_test(struct phy_device *phydev,
600644
}
601645
EXPORT_SYMBOL(phy_start_cable_test);
602646

647+
/**
648+
* phy_start_cable_test_tdr - Start a raw TDR cable test
649+
*
650+
* @phydev: the phy_device struct
651+
* @extack: extack for reporting useful error messages
652+
* @config: Configuration of the test to run
653+
*/
603654
int phy_start_cable_test_tdr(struct phy_device *phydev,
604655
struct netlink_ext_ack *extack,
605656
const struct phy_tdr_config *config)
@@ -1363,6 +1414,12 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
13631414
}
13641415
EXPORT_SYMBOL(phy_ethtool_set_eee);
13651416

1417+
/**
1418+
* phy_ethtool_set_wol - Configure Wake On LAN
1419+
*
1420+
* @phydev: target phy_device struct
1421+
* @wol: Configuration requested
1422+
*/
13661423
int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
13671424
{
13681425
if (phydev->drv && phydev->drv->set_wol)
@@ -1372,6 +1429,12 @@ int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
13721429
}
13731430
EXPORT_SYMBOL(phy_ethtool_set_wol);
13741431

1432+
/**
1433+
* phy_ethtool_get_wol - Get the current Wake On LAN configuration
1434+
*
1435+
* @phydev: target phy_device struct
1436+
* @wol: Store the current configuration here
1437+
*/
13751438
void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
13761439
{
13771440
if (phydev->drv && phydev->drv->get_wol)
@@ -1405,6 +1468,10 @@ int phy_ethtool_set_link_ksettings(struct net_device *ndev,
14051468
}
14061469
EXPORT_SYMBOL(phy_ethtool_set_link_ksettings);
14071470

1471+
/**
1472+
* phy_ethtool_nway_reset - Restart auto negotiation
1473+
* @ndev: Network device to restart autoneg for
1474+
*/
14081475
int phy_ethtool_nway_reset(struct net_device *ndev)
14091476
{
14101477
struct phy_device *phydev = ndev->phydev;

include/linux/mdio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static inline u32 linkmode_adv_to_mii_10gbt_adv_t(unsigned long *advertising)
306306
/**
307307
* mii_10gbt_stat_mod_linkmode_lpa_t
308308
* @advertising: target the linkmode advertisement settings
309-
* @adv: value of the C45 10GBASE-T AN STATUS register
309+
* @lpa: value of the C45 10GBASE-T AN STATUS register
310310
*
311311
* A small helper function that translates C45 10GBASE-T AN STATUS register bits
312312
* 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);
371371

372372
/**
373373
* mdio_module_driver() - Helper macro for registering mdio drivers
374+
* @_mdio_driver: driver to register
374375
*
375376
* Helper macro for MDIO drivers which do not do anything special in module
376377
* init/exit. Each module may only use this macro once, and calling it

0 commit comments

Comments
 (0)