From patchwork Tue May 28 11:48:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13676547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 111F4C25B78 for ; Tue, 28 May 2024 11:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ksp1dEFREaDuYril5nyYL6OcSlHZKW7BeYSx1g3osRE=; b=xaD7BlUW4M32ra HlmETEMcCgNv2ddeX/MfE876AmeDq8rfJakJW/pvjhG0hfllpqkZZ3rHBhC5bKKuzjudTZmGUx85I BYV2O0K0XSt3NS1OeWXloZyFHBmKk5oRKC+xXswgp2r485axtVxn1nV9XyoZOVGYhGUFKyKQXJeze UGJiLechUAe5V+pWZ6p+KgQY77MMNqXFL+8KXe2D9xxQ+UMo22m/Olx20SGQFWO9znQM6YvM72PwS LUqnHKxF58WZe/mpubhCDGDlC7dg9JosmJeSvzWnLzFiizm8d56bymU/jf8mCvyjRpI5C1Atheqco LTxexMRZSjnXyzNI6ASw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBvKM-00000000RPD-21df; Tue, 28 May 2024 11:49:14 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBvKD-00000000RHe-3CH9 for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2024 11:49:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=R0XsItn/IrljcCL2O1058cOw8l+WFLCPtVgaCijGlw4=; b=w+IK/nosrivEQTjkyR7fiuH1d9 ZsH3Uatqn2T5MM9j3KlVcMeuSIC8mqVW9+Kb6HkSM5Kts5SqHkJW6kaCaQ4tEk4SuCJV6RbRi5DTA 3xC+mA/gSyeCqUFdsKlePZ3rEkJr+9gXwo01ypJJdlaZI2C42GMzd5PG6vK0JMbnUmsL4n862oh4m VOgyJAoSiaFqeXa1Cb1pQIVtY5tT0LraNXEicEEuWvl6Jzh8owpm8Jqq5sN8A5p7+HhVGXq7qmN86 KC/LtIm1tiKkFtof+Jly/lzU/uCZ8zgPJ1pe3mZkYDfGwqCQN+EkUUCJQ7eigIZFdbQxoiBqy99vR muiv3leg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:38030 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sBvJy-0004iW-1d; Tue, 28 May 2024 12:48:50 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sBvK1-00EHyi-4l; Tue, 28 May 2024 12:48:53 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Serge Semin Cc: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 28 May 2024 12:48:53 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240528_044905_860802_8406BC03 X-CRM114-Status: UNSURE ( 9.73 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is incorrect to call netif_carrier_off(), or in fact any driver teardown, before unregister_netdev() has been called. unregister_netdev() unpublishes the network device from userspace, and takes the interface down if it was up prior to returning. Therefore, once the call has returned, we are guaranteed that .ndo_stop() will have been called for an interface that was up. Phylink will take the carrier down via phylink_stop(), making any manipulation of the carrier in the remove path unnecessary. In the stmmac_release() path, the netif_carrier_off() call follows the call to phylink_stop(), so this call is redundant. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e01340034d50..6e427ed7af05 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4097,8 +4097,6 @@ static int stmmac_release(struct net_device *dev) if (priv->plat->serdes_powerdown) priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv); - netif_carrier_off(dev); - stmmac_release_ptp(priv); pm_runtime_put(priv->device); @@ -7821,7 +7819,6 @@ void stmmac_dvr_remove(struct device *dev) stmmac_stop_all_dma(priv); stmmac_mac_set(priv, priv->ioaddr, false); - netif_carrier_off(ndev); unregister_netdev(ndev); #ifdef CONFIG_DEBUG_FS