diff options
author | Michael Walle <michael@walle.cc> | 2020-01-30 18:44:51 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-01-31 07:46:11 -0800 |
commit | 2e1bf3a76576eebc787d8882c3f91fa4ec743efc (patch) | |
tree | 25853cebe19b720cfca998dcf2cd5d5a09270e16 /drivers/of | |
parent | 0e0daf6ac3be70608569262246f6dc33cb3f45fe (diff) | |
download | linux-2e1bf3a76576eebc787d8882c3f91fa4ec743efc.tar.gz linux-2e1bf3a76576eebc787d8882c3f91fa4ec743efc.tar.bz2 linux-2e1bf3a76576eebc787d8882c3f91fa4ec743efc.zip |
net: mii_timestamper: fix static allocation by PHY driver
If phydev->mii_ts is set by the PHY driver, it will always be
overwritten in of_mdiobus_register_phy(). Fix it. Also make sure, that
the unregister() doesn't do anything if the mii_timestamper was provided by
the PHY driver.
Fixes: 1dca22b18421 ("net: mdio: of: Register discovered MII time stampers.")
Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/of_mdio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index db0ed5879803..8270bbf505fb 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -124,7 +124,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, of_node_put(child); return rc; } - phy->mii_ts = mii_ts; + + /* phy->mii_ts may already be defined by the PHY driver. A + * mii_timestamper probed via the device tree will still have + * precedence. + */ + if (mii_ts) + phy->mii_ts = mii_ts; dev_dbg(&mdio->dev, "registered phy %pOFn at address %i\n", child, addr); |