Re: [PATCH net-next v3 1/3] net: phy: micrel: Introduce lanphy_modify_page_reg

From: Russell King (Oracle)
Date: Wed Aug 13 2025 - 03:35:04 EST


On Wed, Aug 13, 2025 at 08:30:42AM +0200, Horatiu Vultur wrote:
> +static int lanphy_modify_page_reg(struct phy_device *phydev, int page, u16 addr,
> + u16 mask, u16 set)
> +{
> + int ret;
> +
> + phy_lock_mdio_bus(phydev);
> + __phy_write(phydev, LAN_EXT_PAGE_ACCESS_CONTROL, page);
> + __phy_write(phydev, LAN_EXT_PAGE_ACCESS_ADDRESS_DATA, addr);
> + __phy_write(phydev, LAN_EXT_PAGE_ACCESS_CONTROL,
> + (page | LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC));
> + ret = __phy_modify_changed(phydev, LAN_EXT_PAGE_ACCESS_ADDRESS_DATA,
> + mask, set);
> + if (ret < 0)
> + phydev_err(phydev, "Error: __phy_modify_changed has returned error %d\n",
> + ret);

Error: is not necessary, we have log levels.

What would be useful is to print the readable version of the error, and
it probably makes sense to do it outside of the bus lock.

> +
> + phy_unlock_mdio_bus(phydev);

if (ret < 0)
phydev_err(phydev, "__phy_modify_changed() failed: %pe\n",
ERR_PTR(ret));

Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!