Skip to contentSkip to conversation

net: stmmac: move stmmac_check_ether_addr() to driver probe

PATCH In review Vinod Koul 3 participants 3 messages Apr 22, 2019 – Apr 23, 2019

Subsystems (5)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH v2 1/1 net: stmmac: move stmmac_check_ether_addr() to driver probe

stmmac_check_ether_addr() checks the MAC address and assigns one in driver open(). In many cases when we create slave netdevice, the dev addr is inherited from master but the master dev addr maybe NULL at that time, so move this call to driver probe so that address is always valid.

---

Changes in v2:
As discussed in [1] we move the stmmac driver inherting the mac address
from probe to open
[1]: https://lore.kernel.org/netdev/[email protected]/

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
index 7a895a2889e3..5ab2733e15e2 100644
@@ -2616,8 +2616,6 @@ static int stmmac_open(struct net_device *dev)
 	u32 chan;
 	int ret;
 
-	stmmac_check_ether_addr(priv);
-
 	if (priv->hw->pcs != STMMAC_PCS_RGMII &&
 	    priv->hw->pcs != STMMAC_PCS_TBI &&
 	    priv->hw->pcs != STMMAC_PCS_RTBI) {
@@ -4303,6 +4301,8 @@ int stmmac_dvr_probe(struct device *device,
 	if (ret)
 		goto error_hw_init;
 
+	stmmac_check_ether_addr(priv);
+
 	/* Configure real RX and TX queues */
 	netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use);
 	netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use);
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Vinod Koul

stmmac_check_ether_addr() checks the MAC address and assigns one in driver open(). In many cases when we create slave netdevice, the dev addr is inherited from master but the master dev addr maybe NULL at that time, so move this call to driver probe so that address is always valid.

Thanks for doing it this way.

Andrew

maintainer
#2 lore raw
In reply to Vinod Koul

From: Vinod Koul <[email protected]>
Date: Mon, 22 Apr 2019 15:15:32 +0530

Quoted 10 lines

stmmac_check_ether_addr() checks the MAC address and assigns one in driver open(). In many cases when we create slave netdevice, the dev addr is inherited from master but the master dev addr maybe NULL at that time, so move this call to driver probe so that address is always valid.

Quoted 6 lines

---

Changes in v2:
As discussed in [1] we move the stmmac driver inherting the mac address
from probe to open
[1]: https://lore.kernel.org/netdev/[email protected]/

Applied and queued up for -stable.