]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mmc: sdhci-pxav3: fix unbalanced clock issues during probe
authorJisheng Zhang <jszhang@marvell.com>
Sun, 4 Jan 2015 15:15:47 +0000 (23:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:52:52 +0000 (14:52 -0800)
commit4d025d8000898c8e14bbf9a793063aadae31045b
treef1ff7d12e5c549b2aeb4b49d5cabdc122a343771
parent122982283616020d723300251644ff98fad834ee
mmc: sdhci-pxav3: fix unbalanced clock issues during probe

commit 62cf983ad84275f8580c807e5e596216c46773cf upstream.

Commit 0dcaa2499b7d ("sdhci-pxav3: Fix runtime PM initialization") tries
to fix one hang issue caused by calling sdhci_add_host() on a suspended
device. The fix enables the clock twice, once by clk_prepare_enable() and
another by pm_runtime_get_sync(), meaning that the clock will never be
gated at runtime PM suspend. I observed the power consumption regression on
Marvell BG2Q SoCs.

In fact, the fix is not correct. There still be a very small window
during which a runtime suspend might somehow occur after pm_runtime_enable()
but before pm_runtime_get_sync().

This patch fixes all of the two problems by just incrementing the usage
counter before pm_runtime_enable(). It also adjust the order of disabling
runtime pm and storing the usage count in the error path to handle clock
gating properly.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/sdhci-pxav3.c