linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe
@ 2019-04-22  9:45 Vinod Koul
  2019-04-22 13:30 ` Andrew Lunn
  2019-04-23  4:53 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Vinod Koul @ 2019-04-22  9:45 UTC (permalink / raw)
  To: David S. Miller
  Cc: Andrew Lunn, Florian Fainelli, Alexandre Torgue, linux-arm-msm,
	linux-stm32, Xiaofei Shen, Bjorn Andersson, Vinod Koul,
	Jose Abreu, Sneh Shah, Maxime Coquelin, netdev, Niklas Cassel,
	Giuseppe Cavallaro, Vivien Didelot, linux-arm-kernel

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.

Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org>
Tested-by: Xiaofei Shen <xiaofeis@codeaurora.org>
Signed-off-by: Sneh Shah <snehshah@codeaurora.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---

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/20190222125654.12478-1-vkoul@kernel.org/

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7a895a2889e3..5ab2733e15e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe
  2019-04-22  9:45 [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe Vinod Koul
@ 2019-04-22 13:30 ` Andrew Lunn
  2019-04-23  4:53 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-04-22 13:30 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Florian Fainelli, Alexandre Torgue, linux-arm-msm, linux-stm32,
	Xiaofei Shen, Vivien Didelot, Bjorn Andersson, Jose Abreu,
	Sneh Shah, Maxime Coquelin, netdev, Niklas Cassel,
	Giuseppe Cavallaro, David S. Miller, linux-arm-kernel

On Mon, Apr 22, 2019 at 03:15:32PM +0530, Vinod Koul wrote:
> 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.
> 
> Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org>
> Tested-by: Xiaofei Shen <xiaofeis@codeaurora.org>
> Signed-off-by: Sneh Shah <snehshah@codeaurora.org>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>

Thanks for doing it this way.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe
  2019-04-22  9:45 [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe Vinod Koul
  2019-04-22 13:30 ` Andrew Lunn
@ 2019-04-23  4:53 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-23  4:53 UTC (permalink / raw)
  To: vkoul
  Cc: andrew, f.fainelli, alexandre.torgue, linux-arm-msm, linux-stm32,
	xiaofeis, bjorn.andersson, joabreu, snehshah, mcoquelin.stm32,
	netdev, niklas.cassel, peppe.cavallaro, vivien.didelot,
	linux-arm-kernel

From: Vinod Koul <vkoul@kernel.org>
Date: Mon, 22 Apr 2019 15:15:32 +0530

> 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.
> 
> Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org>
> Tested-by: Xiaofei Shen <xiaofeis@codeaurora.org>
> Signed-off-by: Sneh Shah <snehshah@codeaurora.org>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
> 
> 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/20190222125654.12478-1-vkoul@kernel.org/

Applied and queued up for -stable.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-23  4:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22  9:45 [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe Vinod Koul
2019-04-22 13:30 ` Andrew Lunn
2019-04-23  4:53 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).