From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFD5315A5 for ; Wed, 10 Aug 2022 02:25:12 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D68E25C0321; Tue, 9 Aug 2022 22:25:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 09 Aug 2022 22:25:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1660098311; x=1660184711; bh=eOEB8KEcVP8KbPwNtMpMNwtoH M+vQrkL73Fv/ugZsT0=; b=b4i14hKPWuSNux4iohJEIVMr72x5LmoHOeLb7bpDZ unEk58FeopzLT2YFT3MkoLlGhN0V94cq2lU1Y0KwuRIMkbK+rg7s/9/qIRm9OJ00 7Ntt7A1RONg0P0n8y3itv2uBYJnbOkYxRqe290LmEZYYAepmtG0pp+cK2AR+SwdG XNUtsgPOmQJOJtBoIN1KRwmHpT1mwg0jyfkYoMxnxpi2npqpCWa9zFg0+XaGf2C+ y4j1Eeul0fggyd7PdLnFh7ab2NbuKVN/teskPeGAiT84KfNGJkxnXllvG/59ZCtk t/awNZX75XG2lmrnMuC4w87rOk/t66r9OBy4yt9CGrieg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1660098311; x=1660184711; bh=eOEB8KEcVP8KbPwNtMpMNwtoHM+vQrkL73F v/ugZsT0=; b=wd85Pl4Udx9qklObvZH/PvknPWmuTjQXUfyUKMZ4xbjoVXL3vyM wY2BGAg1b0tmrf5HDDbFzPS3eORBJYKXpNPid5aob4vNejERsV6jeXbHZJ6836tA k2cgsuwklDeSrkn1SiBdGsDA1aMZAzvdy2OQ4pwPIUDESuvpUn9EqfrkWG7IjgNu xAYz04HakXgjtPqczanZSKxVfUoBUrkrtqqiOuAHXxSoggJSLVQd2rmA/QuB0HX9 6ATWS8+ke5zZsnizVloOxB70SZ3CBz7B8apt74//xRbMVgsLE6ruH1HfNUANfvyC fUAMVLwalkdJkblCPWFK7J/33aroQ5pyVxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeguddgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepkeevlefhjeeuleeltedvjedvfeefteegleehueejffehgffffeekhefh hfekkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 9 Aug 2022 22:25:10 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Ulf Hansson , Wolfram Sang Cc: Samuel Holland , Andre Przywara , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH] mmc: sunxi-mmc: Fix clock refcount imbalance during unbind Date: Tue, 9 Aug 2022 21:25:09 -0500 Message-Id: <20220810022509.43743-1-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If the controller is suspended by runtime PM, the clock is already disabled, so do not try to disable it again during removal. Use pm_runtime_disable() to flush any pending runtime PM transitions. Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support") Signed-off-by: Samuel Holland --- drivers/mmc/host/sunxi-mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index b16e12e62e72..3db9f32d6a7b 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1492,9 +1492,11 @@ static int sunxi_mmc_remove(struct platform_device *pdev) struct sunxi_mmc_host *host = mmc_priv(mmc); mmc_remove_host(mmc); - pm_runtime_force_suspend(&pdev->dev); - disable_irq(host->irq); - sunxi_mmc_disable(host); + pm_runtime_disable(&pdev->dev); + if (!pm_runtime_status_suspended(&pdev->dev)) { + disable_irq(host->irq); + sunxi_mmc_disable(host); + } dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); mmc_free_host(mmc); -- 2.35.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 8FF49C19F2D for ; Wed, 10 Aug 2022 02:27: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: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=3Qpmxx6osMYedxnFKA4nzjZId7Dwvk1zOB1mxpOjSJo=; b=Lxa9zxeR09h/ua C4I51E87O1zIvdt2p8G0nKnno9pShbRH6x5ExNC0WSN8S7vJDiIL6K4ovosfvExjnBp2vd84a0zW/ vS+3ZfnwoIaJM61OmjWBH/Qe7OVBhdOXZ1aflG/kKdP9I79iXeF8TOEDweHPxY/sFNrOPL42t1ZBS F7dnaYtQM2XBJuxE8pxDIuhcMncV0jag5ZEEnEUGwwsS/CzXG6T9mK1VHZcAdiUVI5oCYLOP5ElWB +RTuhBxK0OUeSPj5MqlR2sZJVSOMr1sSenkdiyCmKYhGfKWJJg/15kUtctoUG9S+o0LnlTBgxqVaa avd9ijRqS4Vj8pk8wyAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLbPJ-008Ok1-QG; Wed, 10 Aug 2022 02:25:17 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLbPF-008Ohn-3X for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2022 02:25:16 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D68E25C0321; Tue, 9 Aug 2022 22:25:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 09 Aug 2022 22:25:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1660098311; x=1660184711; bh=eOEB8KEcVP8KbPwNtMpMNwtoH M+vQrkL73Fv/ugZsT0=; b=b4i14hKPWuSNux4iohJEIVMr72x5LmoHOeLb7bpDZ unEk58FeopzLT2YFT3MkoLlGhN0V94cq2lU1Y0KwuRIMkbK+rg7s/9/qIRm9OJ00 7Ntt7A1RONg0P0n8y3itv2uBYJnbOkYxRqe290LmEZYYAepmtG0pp+cK2AR+SwdG XNUtsgPOmQJOJtBoIN1KRwmHpT1mwg0jyfkYoMxnxpi2npqpCWa9zFg0+XaGf2C+ y4j1Eeul0fggyd7PdLnFh7ab2NbuKVN/teskPeGAiT84KfNGJkxnXllvG/59ZCtk t/awNZX75XG2lmrnMuC4w87rOk/t66r9OBy4yt9CGrieg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1660098311; x=1660184711; bh=eOEB8KEcVP8KbPwNtMpMNwtoHM+vQrkL73F v/ugZsT0=; b=wd85Pl4Udx9qklObvZH/PvknPWmuTjQXUfyUKMZ4xbjoVXL3vyM wY2BGAg1b0tmrf5HDDbFzPS3eORBJYKXpNPid5aob4vNejERsV6jeXbHZJ6836tA k2cgsuwklDeSrkn1SiBdGsDA1aMZAzvdy2OQ4pwPIUDESuvpUn9EqfrkWG7IjgNu xAYz04HakXgjtPqczanZSKxVfUoBUrkrtqqiOuAHXxSoggJSLVQd2rmA/QuB0HX9 6ATWS8+ke5zZsnizVloOxB70SZ3CBz7B8apt74//xRbMVgsLE6ruH1HfNUANfvyC fUAMVLwalkdJkblCPWFK7J/33aroQ5pyVxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeguddgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepkeevlefhjeeuleeltedvjedvfeefteegleehueejffehgffffeekhefh hfekkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 9 Aug 2022 22:25:10 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Ulf Hansson , Wolfram Sang Cc: Samuel Holland , Andre Przywara , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH] mmc: sunxi-mmc: Fix clock refcount imbalance during unbind Date: Tue, 9 Aug 2022 21:25:09 -0500 Message-Id: <20220810022509.43743-1-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220809_192513_271433_B546B716 X-CRM114-Status: GOOD ( 10.90 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If the controller is suspended by runtime PM, the clock is already disabled, so do not try to disable it again during removal. Use pm_runtime_disable() to flush any pending runtime PM transitions. Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support") Signed-off-by: Samuel Holland --- drivers/mmc/host/sunxi-mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index b16e12e62e72..3db9f32d6a7b 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1492,9 +1492,11 @@ static int sunxi_mmc_remove(struct platform_device *pdev) struct sunxi_mmc_host *host = mmc_priv(mmc); mmc_remove_host(mmc); - pm_runtime_force_suspend(&pdev->dev); - disable_irq(host->irq); - sunxi_mmc_disable(host); + pm_runtime_disable(&pdev->dev); + if (!pm_runtime_status_suspended(&pdev->dev)) { + disable_irq(host->irq); + sunxi_mmc_disable(host); + } dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); mmc_free_host(mmc); -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel