Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756211AbcCBA42 (ORCPT ); Tue, 1 Mar 2016 19:56:28 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:48096 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755717AbcCAX4Z (ORCPT ); Tue, 1 Mar 2016 18:56:25 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=BR1Ed9HZD23te5vDiYI17+FVbdK6jvKFWX0/egR2xtBoau1PtFpdgNE8KyxsOPLbI3pYEOxLdq2A RNxHEzpAodR4yt5plGKIoeOeQFEhdVxDoxbPEv1m6iSRFOey4u0ggI0CPiuU8gmzBjqhsDx0vBHA px4kndJLeTBeSSPyf0M=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 137/342] mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off() X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Adrian Hunter , Ulf Hansson Message-Id: <20160301234532.403138864@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.0830de26e75341d7867a32b2f7d21084 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:54:28 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1744 Lines: 48 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter commit 5c671c410c8704800f4f1673b6f572137e7e6ddd upstream. sdhci has a legacy facility to prevent runtime suspend if the bus power is on. This is needed in cases where the power to the card is dependent on the bus power. It is controlled by a pair of functions: sdhci_runtime_pm_bus_on() and sdhci_runtime_pm_bus_off(). These functions use a boolean variable 'bus_on' to ensure changes are always paired. There is an additional check for 'runtime_suspended' which is the problem. In fact, its use is ill-conceived as the only requirement for the logic is that 'on' and 'off' are paired, which is actually broken by the check, for example if the bus power is turned on during runtime resume. So remove the check. Signed-off-by: Adrian Hunter Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2763,7 +2763,7 @@ static int sdhci_runtime_pm_put(struct s static void sdhci_runtime_pm_bus_on(struct sdhci_host *host) { - if (host->runtime_suspended || host->bus_on) + if (host->bus_on) return; host->bus_on = true; pm_runtime_get_noresume(host->mmc->parent); @@ -2771,7 +2771,7 @@ static void sdhci_runtime_pm_bus_on(stru static void sdhci_runtime_pm_bus_off(struct sdhci_host *host) { - if (host->runtime_suspended || !host->bus_on) + if (!host->bus_on) return; host->bus_on = false; pm_runtime_put_noidle(host->mmc->parent);