From patchwork Sat Jul 30 18:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12933031 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 7491CC19F2B for ; Sat, 30 Jul 2022 18:21:35 +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:MIME-Version:Message-Id:Date:Subject:Cc :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=9xZwVDdgMxrrlByBfWYp6ou3Ho2oiZCAHLRYF1XPhRw=; b=oVLDMq1NQGGHl4 0ExaASyi98jD9HyEIkvktzcQWnLIObjhINxvBgoVjbvZ8aLfEkDd0uHxJ3cL57hZ8GO2nRo83EMn/ iPRcrV1cGJPnYc2dqhIqcZCN/YPeuIFH6dP2WyYWNLhrRWeIBJOhI6UDTQ7I99NOVFd8aO9dA51oX 8Jw/yhf0FFsGosgFcMDV3uaJjHZn4RIsi7XD1Xg7Ud8Q1hZRMxV4k9Y4+fB2VqaoPxSgScJJEMXxC Mt9zXWVjZVdon7KTMszq2FM5QkkMQCf9kncJtcxAP/lKrEiA4GlocW8c7T6eI73K/yHsowio2Kvby U6gLRdpgaYeECgchFuhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHr4K-003DIx-VY; Sat, 30 Jul 2022 18:20:09 +0000 Received: from smtp03.smtpout.orange.fr ([80.12.242.125] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHr4H-003DBp-8Z for linux-arm-kernel@lists.infradead.org; Sat, 30 Jul 2022 18:20:07 +0000 Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id Hr41oSyrhBDYDHr41oo8rt; Sat, 30 Jul 2022 20:19:53 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sat, 30 Jul 2022 20:19:53 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: andriy.shevchenko@linux.intel.com, vee.khee.wong@intel.com, weifeng.voon@intel.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joakim Zhang , Andrew Lunn Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove() Date: Sat, 30 Jul 2022 20:19:47 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220730_112005_466335_529CCAA8 X-CRM114-Status: GOOD ( 13.45 ) 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 Commit 09f012e64e4b ("stmmac: intel: Fix clock handling on error and remove paths") removed this clk_disable_unprepare() This was partly revert by commit ac322f86b56c ("net: stmmac: Fix clock handling on remove path") which removed this clk_disable_unprepare() because: " While unloading the dwmac-intel driver, clk_disable_unprepare() is being called twice in stmmac_dvr_remove() and intel_eth_pci_remove(). This causes kernel panic on the second call. " However later on, commit 5ec55823438e8 ("net: stmmac: add clocks management for gmac driver") has updated stmmac_dvr_remove() which do not call clk_disable_unprepare() anymore. So this call should now be called from intel_eth_pci_remove(). Fixes: 5ec55823438e8 ("net: stmmac: add clocks management for gmac driver") Signed-off-by: Christophe JAILLET Reviewed-by: Andy Shevchenko Reported-by: kernel test robot Reported-by: kernel test robot --- /!\ This patch is HIGHLY speculative. /!\ The corresponding clk_disable_unprepare() is still called within the pm related stmmac_bus_clks_config() function. However, with my limited understanding of the pm API, I think it that the patch is valid. (in other word, does the pm_runtime_put() and/or pm_runtime_disable() and/or stmmac_dvr_remove() can end up calling .runtime_suspend()) So please review with care, as I'm not able to test the change by myself. If I'm wrong, maybe a comment explaining why it is safe to have this call in the error handling path of the probe and not in the remove function would avoid erroneous patches generated from static code analyzer to be sent. --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 52f9ed8db9c9..9f38642f86ce 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -1134,6 +1134,7 @@ static void intel_eth_pci_remove(struct pci_dev *pdev) stmmac_dvr_remove(&pdev->dev); + clk_disable_unprepare(plat->stmmac_clk); clk_unregister_fixed_rate(priv->plat->stmmac_clk); pcim_iounmap_regions(pdev, BIT(0)); From patchwork Sat Jul 30 18:20:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12933030 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 C76EEC04A68 for ; Sat, 30 Jul 2022 18:21:33 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zxR7Ge0R6UJBfkKP9xIhLdaXopQBskzM7i+mzu30oa0=; b=yhwPYrccy5r+t1 bC/gIYC6+9IOMZp9I4/w7zYtilTTR/BB/SZwhoLF43mCdN+0WyC1zt5q36XZ7rutWZZE8CrcSch5m isXj9Yucy9CKAD8DOAEBlPtokuZ9X3iPSmMIqzOb4VPGKShWsCCOjn4fk4KCpMrSHCv0o7XAP7MxB R7+hIZPEGsEj/ixvINRgaoDPsg4tZaSG+jrj9T82oKtl4os0o9y4q4XarVkUHV3PIgKrlmhi6gNQT t+os5lQGrvkT13bwXcxua9wNTAmewYkDlKCO1whJHh+FWAgcadRG1dzVQJQ/p+PkU8mJJayFSP2Xn p4xfyaykKNOviQK+Xxig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHr4b-003DRI-Oh; Sat, 30 Jul 2022 18:20:25 +0000 Received: from smtp07.smtpout.orange.fr ([80.12.242.129] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHr4Z-003DKO-2n for linux-arm-kernel@lists.infradead.org; Sat, 30 Jul 2022 18:20:24 +0000 Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id Hr4JoicqGgtndHr4JoDTCy; Sat, 30 Jul 2022 20:20:11 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sat, 30 Jul 2022 20:20:11 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: andriy.shevchenko@linux.intel.com, vee.khee.wong@intel.com, weifeng.voon@intel.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] stmmac: intel: Simplify intel_eth_pci_remove() Date: Sat, 30 Jul 2022 20:20:02 +0200 Message-Id: <9f82d58aa4a6c34ec3c734399a4792d3aa23297f.1659204745.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220730_112023_284990_EEFF05C8 X-CRM114-Status: GOOD ( 11.32 ) 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 There is no point to call pcim_iounmap_regions() in the remove function, this frees a managed resource that would be release by the framework anyway. Signed-off-by: Christophe JAILLET Reviewed-by: Andy Shevchenko --- This patch is speculative. Sometimes the order of releasing managed resources is tricky. Just a few drivers have this pattern, while many call pcim_iomap_regions(). If I'm right and this patch is reviewed and merged, I'll look at the other files if they also can be simplified a bit. --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 9f38642f86ce..f68d23051557 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -1136,8 +1136,6 @@ static void intel_eth_pci_remove(struct pci_dev *pdev) clk_disable_unprepare(plat->stmmac_clk); clk_unregister_fixed_rate(priv->plat->stmmac_clk); - - pcim_iounmap_regions(pdev, BIT(0)); } static int __maybe_unused intel_eth_pci_suspend(struct device *dev)