From patchwork Mon Apr 22 09:45:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 162597 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2399091jan; Mon, 22 Apr 2019 02:46:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyORc9vFIekTMWrnx9VCNDh45zYicbeAXRvULqjIqk3L/VgizQp5ifepaYnB70NlwyyL8ML X-Received: by 2002:a17:902:da4:: with SMTP id 33mr17425729plv.20.1555926365762; Mon, 22 Apr 2019 02:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555926365; cv=none; d=google.com; s=arc-20160816; b=M+K90o05t35L5trUCwzFN5oAGiMtJdEuqPl691DjYPi9+hXh7yRRIJMCNAbWBEBeXb uL9G7KA+Woz/Ft+2nIr91biPbaxmvD/ECZrbb25I0hHE1l+Oy9iobMwWEb6UFfILqcLJ rHR2KxDT4ET429FvWCKmuGttyvR47yHmSN8rOUySACcf+x/N3T0r3iRxZVxtNFnVHg4t 1gnSATymMM47rOGpreup9PLYeyVef4iXiOTWjtPadWU+fbq4XK1wtGYfG7XyobNYR01+ w5UQ7layylIoqWNoEupxkQyUnfTBzp/MMextCGVe/jWpNNQiBhUrdIz852eJP1gybmKc ZbWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sUzxao2mIZulRHU6ye2Y/OOLYLTJ4wef39SfKWiRMbA=; b=mPVlCzxW+UpNsfMiqzxljiLmEal01ZLRDsZD90pyNOHdk4JVwef+8OQGNgjppbuEx2 UVfIMUZ4YseMTqk4L6gojxzT7JkbLh7+JzRelIfyEfiCjv4w0m4UrgbwptxET8ax7OlP BrXgBK9NCEehcvyUPn/BD7M0WCkSHlTsx+7xOdjB9fIc5NlKC6fOtW8I1RVL+KZoGJND 115x0kDqUdn/WNhJTfKurWFGagS69ao3EfyDbgG28rKGiHi/EA0aK6SpCaeYk9GGOudu cnkEiykLmhpePE0jbbaOi6ANxdfgcj0Jg4NgQJKWq2WRKFUr3sGHzCbkXH0fas84G3WA rr8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cwitLFzZ; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x30si12430685pgl.477.2019.04.22.02.46.05; Mon, 22 Apr 2019 02:46:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cwitLFzZ; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbfDVJqE (ORCPT + 15 others); Mon, 22 Apr 2019 05:46:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:51882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbfDVJqE (ORCPT ); Mon, 22 Apr 2019 05:46:04 -0400 Received: from localhost.localdomain (unknown [171.76.113.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E1F672075A; Mon, 22 Apr 2019 09:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555926363; bh=UP4UZovyhnKFNKRYTSvNJnTwD+GTdNCJ1Gta43eYSN4=; h=From:To:Cc:Subject:Date:From; b=cwitLFzZC+65rjC7zIA93q+zj083dB/N7c3sNjSg7vxQ+qHoGbAgKTiy1OY5QprAN HhyUurB2yCDHCg+kaCggiKoEkJC6UwtR2VjapKuRfECqHJtbFJCIpitIdUxKjI4mGr XhMVVJWv/itXywIGD2uci5JDrFwtibM3FxMmOPHA= From: Vinod Koul To: "David S. Miller" Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Niklas Cassel , Andrew Lunn , Vivien Didelot , Florian Fainelli , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Xiaofei Shen , Sneh Shah Subject: [PATCH v2] net: stmmac: move stmmac_check_ether_addr() to driver probe Date: Mon, 22 Apr 2019 15:15:32 +0530 Message-Id: <20190422094532.5519-1-vkoul@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 Tested-by: Xiaofei Shen Signed-off-by: Sneh Shah Signed-off-by: Vinod Koul --- 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(-) -- 2.20.1 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);