From patchwork Wed Aug 10 02:25:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12940109 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 636A6C19F2D for ; Wed, 10 Aug 2022 02:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbiHJCZP (ORCPT ); Tue, 9 Aug 2022 22:25:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiHJCZP (ORCPT ); Tue, 9 Aug 2022 22:25:15 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4D1E7C; Tue, 9 Aug 2022 19:25:14 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.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 Acked-by: Jernej Skrabec --- 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);