From patchwork Wed May 29 08:40:49 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: 13678384 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 1671EC25B7C for ; Wed, 29 May 2024 08:41:21 +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=OuJICMgJSQEKmu8gExJ9gqZa8xqWWDe+poFjBycxBqg=; b=mxRwVmT2utYe4H QU9D4D7ptMjq5PlwnOOyaW4LXAz0acUvDGFuOqxty0TWlk1uWayXomR1fAZljUfIy/oOTS+HVOai3 0MZMPInejPan/gGuhGph/7JgqZhGm5vaFANgkxmjnxRuVMnOSOxpR8XWh5YRs5N7gE6unPaunhnmB 4Xp8fj/iBNy463q7zjEELR9sZ/IomLAaKUdvKCkMoJzr84KOQwjvhtZfljMbMRgEeFtSFq1ZbEg5z RYOv6YQ32eD32poKDeEbc0huSFMPUtBFMBAr/OwdqZ81Bhfo2vU95JkJ1WTHcmc/zVXfnTy7sQhrH /DmyF697UeXCLmT8uGvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCErw-00000003Rny-1uYF; Wed, 29 May 2024 08:41:12 +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 1sCEro-00000003RkF-3qbH for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2024 08:41:06 +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=Ki22ukjJ+Q20qB+nBL6L35jMrJzZTCq6rq/hxq5NThE=; b=zBrWrDbxEm7azr+Cav55JtHI3Z h51Bnzltfu0tp6bFUxOB4RPCkQ+uEWBSCMkX4bcE4cHOtkp0ngKDXz4s8mKvssBo281KJWuOVL7Dt dDV8leedBjyE1W3IxX3cpgbisS9y/4rv5674lXsf6+dXdO2snBA/7y0UaW68FCFYNr1wzeQi6Oc/M NmA6+FaAbpSY2Wi+3JdtivpRtTYo47d6Qli/FmqPDV9dXviTqaWFc+sqa/TfIUkkkZ9UgpyMeKiY0 4R0cTJQUwLiEnAB4iMk5qe060OS1nDCgQjTCQDxqdHS1biPgPDFR5NjyvoYJ/lPeD8yaM6ik8NdGS T5JTq4cA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:57986 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 1sCErX-0005mH-0a; Wed, 29 May 2024 09:40:47 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sCErZ-00EOPx-PF; Wed, 29 May 2024 09:40:49 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Serge Semin Cc: Andrew Halaney , 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 v2 4/6] net: stmmac: remove unnecessary netif_carrier_off() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Wed, 29 May 2024 09:40:49 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240529_014104_996860_C20D8976 X-CRM114-Status: GOOD ( 10.35 ) 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. Reviewed-by: Andrew Halaney Signed-off-by: Russell King (Oracle) --- 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 3ab93f89be90..ca19b232431a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4088,8 +4088,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); @@ -7806,7 +7804,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