diff mbox series

[RFC,net-next,2/2] net: phy: lan87xx: use genphy_read_master_slave in read_status

Message ID 20220307101743.8567-3-arun.ramadoss@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: phy: lan87xx: use genphy_read_master_slave function | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 42 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Arun Ramadoss March 7, 2022, 10:17 a.m. UTC
To read the master slave configuration of the LAN87xx T1 phy, used the
generic phy driver genphy_read_master_slave function. Removed the local
lan87xx_read_master_slave function.

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
 drivers/net/phy/microchip_t1.c | 30 +-----------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

Comments

Andrew Lunn March 7, 2022, 1:53 p.m. UTC | #1
On Mon, Mar 07, 2022 at 03:47:43PM +0530, Arun Ramadoss wrote:
> To read the master slave configuration of the LAN87xx T1 phy, used the
> generic phy driver genphy_read_master_slave function. Removed the local
> lan87xx_read_master_slave function.
> 
> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 8292f7305805..389df3f4293c 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -674,34 +674,6 @@  static int lan87xx_cable_test_get_status(struct phy_device *phydev,
 	return 0;
 }
 
-static int lan87xx_read_master_slave(struct phy_device *phydev)
-{
-	int rc = 0;
-
-	phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN;
-	phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
-
-	rc = phy_read(phydev, MII_CTRL1000);
-	if (rc < 0)
-		return rc;
-
-	if (rc & CTL1000_AS_MASTER)
-		phydev->master_slave_get = MASTER_SLAVE_CFG_MASTER_FORCE;
-	else
-		phydev->master_slave_get = MASTER_SLAVE_CFG_SLAVE_FORCE;
-
-	rc = phy_read(phydev, MII_STAT1000);
-	if (rc < 0)
-		return rc;
-
-	if (rc & LPA_1000MSRES)
-		phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
-	else
-		phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
-
-	return rc;
-}
-
 static int lan87xx_read_status(struct phy_device *phydev)
 {
 	int rc = 0;
@@ -720,7 +692,7 @@  static int lan87xx_read_status(struct phy_device *phydev)
 	phydev->pause = 0;
 	phydev->asym_pause = 0;
 
-	rc = lan87xx_read_master_slave(phydev);
+	rc = genphy_read_master_slave(phydev);
 	if (rc < 0)
 		return rc;