Skip to content

Commit fbca164

Browse files
Romain Perierdavem330
authored andcommitted
net: stmmac: Use the right logging function in stmmac_mdio_register
Currently, the function stmmac_mdio_register() is only used by stmmac_dvr_probe() from stmmac_main.c, in order to register the MDIO bus and probe information about the PHY. As this function is called before calling register_netdev(), all messages logged from stmmac_mdio_register are prefixed by "(unnamed net_device)". The goal of netdev_info or netdev_err is to dump useful infos about a net_device, when this data structure is partially initialized, there is no point for using these functions. This commit fixes the issue by replacing all netdev_*() by the corresponding dev_*() function for logging. The last netdev_info is replaced by phy_attached_info(), as a valid phydev can be used at this point. Signed-off-by: Romain Perier <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8d55373 commit fbca164

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ int stmmac_mdio_register(struct net_device *ndev)
204204
struct stmmac_priv *priv = netdev_priv(ndev);
205205
struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
206206
struct device_node *mdio_node = priv->plat->mdio_node;
207+
struct device *dev = ndev->dev.parent;
207208
int addr, found;
208209

209210
if (!mdio_bus_data)
@@ -237,7 +238,7 @@ int stmmac_mdio_register(struct net_device *ndev)
237238
else
238239
err = mdiobus_register(new_bus);
239240
if (err != 0) {
240-
netdev_err(ndev, "Cannot register the MDIO bus\n");
241+
dev_err(dev, "Cannot register the MDIO bus\n");
241242
goto bus_register_fail;
242243
}
243244

@@ -285,14 +286,12 @@ int stmmac_mdio_register(struct net_device *ndev)
285286
irq_str = irq_num;
286287
break;
287288
}
288-
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
289-
phydev->phy_id, addr, irq_str, phydev_name(phydev),
290-
act ? " active" : "");
289+
phy_attached_info(phydev);
291290
found = 1;
292291
}
293292

294293
if (!found && !mdio_node) {
295-
netdev_warn(ndev, "No PHY found\n");
294+
dev_warn(dev, "No PHY found\n");
296295
mdiobus_unregister(new_bus);
297296
mdiobus_free(new_bus);
298297
return -ENODEV;

0 commit comments

Comments
 (0)