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: 10910867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EB991515 for ; Mon, 22 Apr 2019 09:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EE6E28685 for ; Mon, 22 Apr 2019 09:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6083028688; Mon, 22 Apr 2019 09:46:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EA6D28685 for ; Mon, 22 Apr 2019 09:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=gxjJNVnOggmpfnw6JEvjRJUzLn4SxK+bj1k2W2h6dO8=; b=fE835Ll8nZUfs+ m+lctgJ8qgyxxd3ayUc/hvt/hAqDrNWj+zD57xVW0v4gWOAbt4XOf2luBJWl5cEoZ/BeJH8NXlTel 8XxGeQnpYK4Xgsi8qdLjCcDyqKSHvVwITMvTnjjRLU4DAg1YUp9z417mYvkItVODfVWO8iIIBhpZ9 l3PeVJXWEYjsP5aLlEtGY/LsY/yw6vIoswMWzIDZ5h5RphWsUm3feePitIlIXIUroDTxV1eZj+9Ka Szj+Vmq50KOyjEAdGMqL5BT3d05ld1XjCXTggYXXlgZ9VC1OnD6v6M/pDSEzqQ7rv4QYi/QSqL/6X m8Bk4RAxCGNl8Mz/gRUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIVWa-0004Np-80; Mon, 22 Apr 2019 09:46:08 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIVWW-0004NM-K4 for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2019 09:46:06 +0000 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" 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190422_024604_681920_C916D045 X-CRM114-Status: GOOD ( 11.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Florian Fainelli , Alexandre Torgue , linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Xiaofei Shen , Bjorn Andersson , Vinod Koul , Jose Abreu , Sneh Shah , Maxime Coquelin , netdev@vger.kernel.org, Niklas Cassel , Giuseppe Cavallaro , Vivien Didelot , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Andrew Lunn --- 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);