提交 34786005 编写于 作者: C Camelia Groza 提交者: David S. Miller

net: phy: prevent PHYs w/o Clause 22 regs from calling genphy_config_aneg

genphy_config_aneg() should be called only by PHYs that implement
the Clause 22 register set. Prevent Clause 45 PHYs that don't implement
the register set from calling the genphy function.
Signed-off-by: NCamelia Groza <camelia.groza@nxp.com>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7e50b2a5
...@@ -471,7 +471,13 @@ static int phy_config_aneg(struct phy_device *phydev) ...@@ -471,7 +471,13 @@ static int phy_config_aneg(struct phy_device *phydev)
{ {
if (phydev->drv->config_aneg) if (phydev->drv->config_aneg)
return phydev->drv->config_aneg(phydev); return phydev->drv->config_aneg(phydev);
else
/* Clause 45 PHYs that don't implement Clause 22 registers are not
* allowed to call genphy_config_aneg()
*/
if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
return -EOPNOTSUPP;
return genphy_config_aneg(phydev); return genphy_config_aneg(phydev);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册