From patchwork Tue Jun 16 15:35:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 188052 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp3762512ilo; Tue, 16 Jun 2020 08:41:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdfueyO2Q7MrZItsE0D12xN2PjrWnGRyHpe4PxBCAv819OlwiyYbRRFMfvuv9ov0jzBcFi X-Received: by 2002:a50:f087:: with SMTP id v7mr3041286edl.225.1592322078117; Tue, 16 Jun 2020 08:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592322078; cv=none; d=google.com; s=arc-20160816; b=s24D3NcQWEVbON1Eh+y6NXnVbQsbn629w6TauSAKD/rSByUSByDEFos8NtJiZdvycP tOMsvFqpRtJczewQi/u9AkH1Acke4t+e4isxYgFYxgfyenZpsC0nSeEWHMYmkuxOVtzv V17p1ciLkwYMoqO5tZvgxpFBxDkenVOz4fVSehfM0WYQWroPzF8iYA4cOsw4UCrNH+tV A/6k5VfxrT+zwuE9ENeWA372vo3xwcZHlmv7LHlLo7KGGkpiL8krlnPm+B1JBpKQdIA0 jiRX++OazrITAO2AzWQc1jkAR3u8DbecHZuoOYtvXBCAdVhSoeBy0svLPfcpPsulzYvh NcxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DBvuciV3j5lAL86irMaLNIfaXPPDR0eJW4RKgcm/8js=; b=iuexNBvbvdQcY8ZNsCoNyuYyb0pTXHOMtTeBpBvVcFwdckBhLg1t9v7UFsVWibemeX QbxvWmI6OWNOLelh7qmAHEjAKoBMvVLLYBg13mnbo7YTB6v1MeylWO2cZrascxyyhkvq rBRifj12vfMWyWzpENyQP+ZlA6Kk4D3Zi0bdmK1NIb8Shwa8dOzGScCBR2dRVfMlHUCW 4pqe1iPXqh+TFe1LI8cFUZ7+3+hfs/LH2opt/M9FcEwYx+6FsEJq3+ZNLpyrkAvi3gwQ V9q0jJ9gKEjpfd51xGgFYGRf92UKFA8y7tdLqYH5bkp9zHAqwbchlGxSPXom4FgIaINY 2GkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bc0zQqCX; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si10939519ejp.577.2020.06.16.08.41.17; Tue, 16 Jun 2020 08:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bc0zQqCX; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731386AbgFPPlP (ORCPT + 15 others); Tue, 16 Jun 2020 11:41:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:56658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730243AbgFPPlP (ORCPT ); Tue, 16 Jun 2020 11:41:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D887C208E4; Tue, 16 Jun 2020 15:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322074; bh=5um46MZsFbpHaxkZUw61HJPn4afteMOpE3jDZSIxDbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bc0zQqCXadtMqxy2wfdOQTLsQToUbTZaV4PIV/5h5pB1uSjwzPxG3FR+Lhpb3C9/u ZUFzt2nmVawcyFjyqyJda7HE9ohlFxsDhfAjCA/JjqJJ4n66xh9Vgb0oeAUuIbH/gf 22ZE18dHHGN16OZYrMtBWxxDWf33tc/Uic5jqvhs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Wolfram Sang , Ulf Hansson Subject: [PATCH 5.4 126/134] mmc: tmio: Further fixup runtime PM management at remove Date: Tue, 16 Jun 2020 17:35:10 +0200 Message-Id: <20200616153106.821340873@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153100.633279950@linuxfoundation.org> References: <20200616153100.633279950@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson commit 4bd784411aca022622e484eb262f5a0540ae732c upstream. Before calling tmio_mmc_host_probe(), the caller is required to enable clocks for its device, as to make it accessible when reading/writing registers during probe. Therefore, the responsibility to disable these clocks, in the error path of ->probe() and during ->remove(), is better managed outside tmio_mmc_host_remove(). As a matter of fact, callers of tmio_mmc_host_remove() already expects this to be the behaviour. However, there's a problem with tmio_mmc_host_remove() when the Kconfig option, CONFIG_PM, is set. More precisely, tmio_mmc_host_remove() may then disable the clock via runtime PM, which leads to clock enable/disable imbalance problems, when the caller of tmio_mmc_host_remove() also tries to disable the same clocks. To solve the problem, let's make sure tmio_mmc_host_remove() leaves the device with clocks enabled, but also make sure to disable the IRQs, as we normally do at ->runtime_suspend(). Reported-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Signed-off-by: Ulf Hansson Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200519152434.6867-1-ulf.hansson@linaro.org Tested-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/tmio_mmc_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1285,12 +1285,14 @@ void tmio_mmc_host_remove(struct tmio_mm cancel_work_sync(&host->done); cancel_delayed_work_sync(&host->delayed_reset_work); tmio_mmc_release_dma(host); + tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL); - pm_runtime_dont_use_autosuspend(&pdev->dev); if (host->native_hotplug) pm_runtime_put_noidle(&pdev->dev); - pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); } EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);