net: phy: export genphy_config_init()
Subsystems (3)
PATCH 1/2 net: phy: export genphy_config_init()
This enables other drivers to call this generic implementation, and then only do specific details on top of it.
Signed-off-by Daniel Mack <[email protected]>
--- drivers/net/phy/phy_device.c | 3 ++- include/linux/phy.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/phy_device.c +2 -1
@@ -1029,7 +1029,7 @@ static int gen10g_read_status(struct phy_device *phydev)return 0 ; } -static int genphy_config_init (struct phy_device *phydev) +int genphy_config_init (struct phy_device *phydev) {int val;u32 features;
@@ -1074,6 +1074,7 @@ static int genphy_config_init(struct phy_device *phydev)return 0 ; } +EXPORT_SYMBOL (genphy_config_init);static int gen10g_config_init (struct phy_device *phydev) {
include/linux/phy.h +1 -0
@@ -609,6 +609,7 @@ static inline int phy_read_status(struct phy_device *phydev)return phydev->drv->read_status (phydev); } +int genphy_config_init (struct phy_device *phydev);int genphy_setup_forced (struct phy_device *phydev);int genphy_restart_aneg (struct phy_device *phydev);int genphy_config_aneg (struct phy_device *phydev);
Signature · 1 line
1.9.0
PATCH 2/2 net: phy: at803x: use genphy_config_init()
Use the generic bits from genphy_config_init() instead of implementing the same functionality again.
Signed-off-by Daniel Mack <[email protected]>
--- drivers/net/phy/at803x.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-)
drivers/net/phy/at803x.c +3 -33
@@ -141,41 +141,11 @@ static int at803x_resume(struct phy_device *phydev)static int at803x_config_init (struct phy_device *phydev) { -int val;int ret; -u32 features; - - features =SUPPORTED_TP |SUPPORTED_MII |SUPPORTED_AUI | -SUPPORTED_FIBRE |SUPPORTED_BNC ; - - val =phy_read (phydev,MII_BMSR ); -if (val <0 ) -return val; - -if (val &BMSR_ANEGCAPABLE ) - features |= SUPPORTED_Autoneg; -if (val &BMSR_100FULL ) - features |= SUPPORTED_100baseT_Full; -if (val &BMSR_100HALF ) - features |= SUPPORTED_100baseT_Half; -if (val &BMSR_10FULL ) - features |= SUPPORTED_10baseT_Full; -if (val &BMSR_10HALF ) - features |= SUPPORTED_10baseT_Half; - -if (val &BMSR_ESTATEN ) { - val =phy_read (phydev,MII_ESTATUS ); -if (val <0 ) -return val; - -if (val &ESTATUS_1000_TFULL ) - features |= SUPPORTED_1000baseT_Full; -if (val &ESTATUS_1000_THALF ) - features |= SUPPORTED_1000baseT_Half; - } - phydev->supported = features; - phydev->advertising = features; + ret =genphy_config_init (phydev); +if (ret <0 ) +return ret;if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_TXID ) { ret = phy_write(phydev, AT803X_DEBUG_ADDR,
Signature · 1 line
1.9.0
David Miller
maintainerThese cleanups are only appropriate for net-next, which is not open at this time.
Please resubmit this series when the net-next tree has openned back up for submissions.
Thank you.