mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: phy: mscc: Simplify LED mode update using phy_modify()
The vsc85xx_led_cntl_set() function currently performs a manual read-modify-write sequence protected by the PHY lock to update the LED mode register (MSCC_PHY_LED_MODE_SEL). Replace this sequence with a call to phy_modify(), which already handles read-modify-write operations with proper locking inside the PHY core. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/20251112135715.1017117-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
de9c41624c
commit
c31783c2b5
@@ -177,17 +177,10 @@ static int vsc85xx_led_cntl_set(struct phy_device *phydev,
|
||||
u8 led_num,
|
||||
u8 mode)
|
||||
{
|
||||
int rc;
|
||||
u16 reg_val;
|
||||
u16 mask = LED_MODE_SEL_MASK(led_num);
|
||||
u16 val = LED_MODE_SEL(led_num, mode);
|
||||
|
||||
mutex_lock(&phydev->lock);
|
||||
reg_val = phy_read(phydev, MSCC_PHY_LED_MODE_SEL);
|
||||
reg_val &= ~LED_MODE_SEL_MASK(led_num);
|
||||
reg_val |= LED_MODE_SEL(led_num, (u16)mode);
|
||||
rc = phy_write(phydev, MSCC_PHY_LED_MODE_SEL, reg_val);
|
||||
mutex_unlock(&phydev->lock);
|
||||
|
||||
return rc;
|
||||
return phy_modify(phydev, MSCC_PHY_LED_MODE_SEL, mask, val);
|
||||
}
|
||||
|
||||
static int vsc85xx_mdix_get(struct phy_device *phydev, u8 *mdix)
|
||||
|
||||
Reference in New Issue
Block a user