From: Greg Kroah-Hartman Date: Mon, 26 Mar 2012 22:01:47 +0000 (-0700) Subject: 3.3-stable patches X-Git-Tag: v3.0.27~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=843627d176d9c06e6d5ca8f9f4a9148ae2d011b4;p=thirdparty%2Fkernel%2Fstable-queue.git 3.3-stable patches added patches: pm-domains-check-domain-status-during-hibernation-restore-of-devices.patch pm-domains-fix-hibernation-restore-of-devices-v2.patch --- diff --git a/queue-3.3/pm-domains-check-domain-status-during-hibernation-restore-of-devices.patch b/queue-3.3/pm-domains-check-domain-status-during-hibernation-restore-of-devices.patch new file mode 100644 index 00000000000..8d620eb4cfe --- /dev/null +++ b/queue-3.3/pm-domains-check-domain-status-during-hibernation-restore-of-devices.patch @@ -0,0 +1,43 @@ +From rjw@sisk.pl Mon Mar 26 14:57:30 2012 +From: "Rafael J. Wysocki" +Date: Mon, 26 Mar 2012 23:24:40 +0200 +Subject: PM / Domains: Check domain status during hibernation restore of devices +To: Greg KH +Cc: horms@verge.net.au, lethal@linux-sh.org, stable@vger.kernel.org, stable-commits@vger.kernel.org +Message-ID: <201203262324.40855.rjw@sisk.pl> + + +From: Rafael J. Wysocki + +This is a backport of mainline commit +18dd2ece3cde14cfd42e95a89eb14016699a5f15. + +Power domains that were off before hibernation shouldn't be turned on +during device restore, so prevent that from happening. + +This change fixed up mainline commit +65533bbf63b4f37723fdfedc73d0653958973323 + + PM / Domains: Fix hibernation restore of devices, v2 + +that didn't include it by mistake. + +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/power/domain.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/base/power/domain.c ++++ b/drivers/base/power/domain.c +@@ -1064,6 +1064,9 @@ static int pm_genpd_restore_noirq(struct + } + } + ++ if (genpd->suspend_power_off) ++ return 0; ++ + pm_genpd_poweron(genpd); + genpd_start_dev(genpd, dev); + diff --git a/queue-3.3/pm-domains-fix-hibernation-restore-of-devices-v2.patch b/queue-3.3/pm-domains-fix-hibernation-restore-of-devices-v2.patch new file mode 100644 index 00000000000..8c606ad2656 --- /dev/null +++ b/queue-3.3/pm-domains-fix-hibernation-restore-of-devices-v2.patch @@ -0,0 +1,97 @@ +From rjw@sisk.pl Mon Mar 26 14:56:42 2012 +From: "Rafael J. Wysocki" +Date: Mon, 26 Mar 2012 23:23:59 +0200 +Subject: PM / Domains: Fix hibernation restore of devices, v2 +To: Greg KH +Cc: horms@verge.net.au, lethal@linux-sh.org, stable@vger.kernel.org, stable-commits@vger.kernel.org +Message-ID: <201203262324.00031.rjw@sisk.pl> + + +From: Rafael J. Wysocki + +This is a backport of mainline commit +65533bbf63b4f37723fdfedc73d0653958973323. + +During resume from hibernation pm_genpd_restore_noirq() should only +power off domains whose suspend_power_off flags are set once and +not every time it is called for a device in the given domain. +Moreover, it shouldn't decrement genpd->suspended_count, because +that field is not touched during device freezing and therefore it is +always equal to 0 when pm_genpd_restore_noirq() runs for the first +device in the given domain. + +This means pm_genpd_restore_noirq() may use genpd->suspended_count +to determine whether or not it it has been called for the domain in +question already in this cycle (it only needs to increment that +field every time it runs for this purpose) and whether or not it +should check if the domain needs to be powered off. For that to +work, though, pm_genpd_prepare() has to clear genpd->suspended_count +when it runs for the first device in the given domain (in which case +that flag need not be cleared during domain initialization). + +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/power/domain.c | 29 +++++++++++++++++++---------- + 1 file changed, 19 insertions(+), 10 deletions(-) + +--- a/drivers/base/power/domain.c ++++ b/drivers/base/power/domain.c +@@ -764,8 +764,10 @@ static int pm_genpd_prepare(struct devic + + genpd_acquire_lock(genpd); + +- if (genpd->prepared_count++ == 0) ++ if (genpd->prepared_count++ == 0) { ++ genpd->suspended_count = 0; + genpd->suspend_power_off = genpd->status == GPD_STATE_POWER_OFF; ++ } + + genpd_release_lock(genpd); + +@@ -1041,20 +1043,28 @@ static int pm_genpd_restore_noirq(struct + * Since all of the "noirq" callbacks are executed sequentially, it is + * guaranteed that this function will never run twice in parallel for + * the same PM domain, so it is not necessary to use locking here. ++ * ++ * At this point suspended_count == 0 means we are being run for the ++ * first time for the given domain in the present cycle. + */ +- genpd->status = GPD_STATE_POWER_OFF; +- if (genpd->suspend_power_off) { ++ if (genpd->suspended_count++ == 0) { + /* +- * The boot kernel might put the domain into the power on state, +- * so make sure it really is powered off. ++ * The boot kernel might put the domain into arbitrary state, ++ * so make it appear as powered off to pm_genpd_poweron(), so ++ * that it tries to power it on in case it was really off. + */ +- if (genpd->power_off) +- genpd->power_off(genpd); +- return 0; ++ genpd->status = GPD_STATE_POWER_OFF; ++ if (genpd->suspend_power_off) { ++ /* ++ * If the domain was off before the hibernation, make ++ * sure it will be off going forward. ++ */ ++ if (genpd->power_off) ++ genpd->power_off(genpd); ++ } + } + + pm_genpd_poweron(genpd); +- genpd->suspended_count--; + genpd_start_dev(genpd, dev); + + return genpd_resume_early(genpd, dev); +@@ -1558,7 +1568,6 @@ void pm_genpd_init(struct generic_pm_dom + genpd->poweroff_task = NULL; + genpd->resume_count = 0; + genpd->device_count = 0; +- genpd->suspended_count = 0; + genpd->max_off_time_ns = -1; + genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend; + genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume; diff --git a/queue-3.3/series b/queue-3.3/series index d18d991f504..9fa7f283469 100644 --- a/queue-3.3/series +++ b/queue-3.3/series @@ -123,3 +123,5 @@ tda10071-fix-the-delivery-system.patch au8522-bug-fix-enable-modulation-after-tune-instead-of-before-tuning.patch pvrusb2-fix-7mhz-8mhz-dvb-t-tuner-support-for-hvr1900-rev-d1f5.patch mxl111sf-fix-error-on-stream-stop-in-mxl111sf_ep6_streaming_ctrl.patch +pm-domains-fix-hibernation-restore-of-devices-v2.patch +pm-domains-check-domain-status-during-hibernation-restore-of-devices.patch