diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-20 00:58:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-20 00:58:57 -0400 |
commit | 3c8fb50445833b93f69b6b703a29aae3523cad0c (patch) | |
tree | b865e35364eb5dd68ca29bcab1775fb6c01a3263 /kernel | |
parent | 4ef61076f849ce13af88670f7362a5c9477c2747 (diff) | |
parent | 2ba87ea132a7364dbeb71126f3d7b8ec8e59d0e9 (diff) |
Merge tag 'pm+acpi-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management fixes from Rafael Wysocki:
"These are fixes mostly (ia64 regression related to the ACPI
enumeration of devices, cpufreq regressions, fix for I2C controllers
included in Intel SoCs, mvebu cpuidle driver fix related to sysfs)
plus additional kernel command line arguments from Kees to make it
possible to build kernel images with hibernation and the kernel
address space randomization included simultaneously, a new ACPI
battery driver quirk for a system with a broken BIOS and a couple of
ACPI core cleanups.
Specifics:
- Fix for an ia64 regression introduced during the 3.11 cycle by a
commit that modified the hardware initialization ordering and made
device discovery fail on some systems.
- Fix for a build problem on systems where the cpufreq-cpu0 driver is
built-in and the cpu-thermal driver is modular from Arnd Bergmann.
- Fix for a recently introduced computational mistake in the
intel_pstate driver that leads to excessive rounding errors from
Doug Smythies.
- Fix for a failure code path in cpufreq_update_policy() that fails
to unlock the locks acquired previously from Aaron Plattner.
- Fix for the cpuidle mvebu driver to use shorter state names which
will prevent the sysfs interface from returning mangled strings.
From Gregory Clement.
- ACPI LPSS driver fix to make sure that the I2C controllers included
in BayTrail SoCs are not held in the reset state while they are
being probed from Mika Westerberg.
- New kernel command line arguments making it possible to build
kernel images with hibernation and kASLR included at the same time
and to select which of them will be used via the command line (they
are still functionally mutually exclusive, though). From Kees
Cook.
- ACPI battery driver quirk for Acer Aspire V5-573G that fails to
send battery status change notifications timely from Alexander
Mezin.
- Two ACPI core cleanups from Christoph Jaeger and Fabian Frederick"
* tag 'pm+acpi-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpuidle: mvebu: Fix the name of the states
cpufreq: unlock when failing cpufreq_update_policy()
intel_pstate: Correct rounding in busy calculation
ACPI: use kstrto*() instead of simple_strto*()
ACPI / processor replace __attribute__((packed)) by __packed
ACPI / battery: add quirk for Acer Aspire V5-573G
ACPI / battery: use callback for setting up quirks
ACPI / LPSS: Take I2C host controllers out of reset
x86, kaslr: boot-time selectable with hibernation
PM / hibernate: introduce "nohibernate" boot parameter
cpufreq: cpufreq-cpu0: fix CPU_THERMAL dependency
ACPI / ia64 / sba_iommu: Restore the working initialization ordering
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/hibernate.c | 37 | ||||
-rw-r--r-- | kernel/power/main.c | 6 | ||||
-rw-r--r-- | kernel/power/user.c | 3 |
3 files changed, 41 insertions, 5 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 49e0a20fd010..fcc2611d3f14 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | static int nocompress; | 36 | static int nocompress; |
37 | static int noresume; | 37 | static int noresume; |
38 | static int nohibernate; | ||
38 | static int resume_wait; | 39 | static int resume_wait; |
39 | static unsigned int resume_delay; | 40 | static unsigned int resume_delay; |
40 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; | 41 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; |
@@ -62,6 +63,11 @@ bool freezer_test_done; | |||
62 | 63 | ||
63 | static const struct platform_hibernation_ops *hibernation_ops; | 64 | static const struct platform_hibernation_ops *hibernation_ops; |
64 | 65 | ||
66 | bool hibernation_available(void) | ||
67 | { | ||
68 | return (nohibernate == 0); | ||
69 | } | ||
70 | |||
65 | /** | 71 | /** |
66 | * hibernation_set_ops - Set the global hibernate operations. | 72 | * hibernation_set_ops - Set the global hibernate operations. |
67 | * @ops: Hibernation operations to use in subsequent hibernation transitions. | 73 | * @ops: Hibernation operations to use in subsequent hibernation transitions. |
@@ -642,6 +648,11 @@ int hibernate(void) | |||
642 | { | 648 | { |
643 | int error; | 649 | int error; |
644 | 650 | ||
651 | if (!hibernation_available()) { | ||
652 | pr_debug("PM: Hibernation not available.\n"); | ||
653 | return -EPERM; | ||
654 | } | ||
655 | |||
645 | lock_system_sleep(); | 656 | lock_system_sleep(); |
646 | /* The snapshot device should not be opened while we're running */ | 657 | /* The snapshot device should not be opened while we're running */ |
647 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { | 658 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { |
@@ -734,7 +745,7 @@ static int software_resume(void) | |||
734 | /* | 745 | /* |
735 | * If the user said "noresume".. bail out early. | 746 | * If the user said "noresume".. bail out early. |
736 | */ | 747 | */ |
737 | if (noresume) | 748 | if (noresume || !hibernation_available()) |
738 | return 0; | 749 | return 0; |
739 | 750 | ||
740 | /* | 751 | /* |
@@ -900,6 +911,9 @@ static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
900 | int i; | 911 | int i; |
901 | char *start = buf; | 912 | char *start = buf; |
902 | 913 | ||
914 | if (!hibernation_available()) | ||
915 | return sprintf(buf, "[disabled]\n"); | ||
916 | |||
903 | for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) { | 917 | for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) { |
904 | if (!hibernation_modes[i]) | 918 | if (!hibernation_modes[i]) |
905 | continue; | 919 | continue; |
@@ -934,6 +948,9 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
934 | char *p; | 948 | char *p; |
935 | int mode = HIBERNATION_INVALID; | 949 | int mode = HIBERNATION_INVALID; |
936 | 950 | ||
951 | if (!hibernation_available()) | ||
952 | return -EPERM; | ||
953 | |||
937 | p = memchr(buf, '\n', n); | 954 | p = memchr(buf, '\n', n); |
938 | len = p ? p - buf : n; | 955 | len = p ? p - buf : n; |
939 | 956 | ||
@@ -1101,6 +1118,10 @@ static int __init hibernate_setup(char *str) | |||
1101 | noresume = 1; | 1118 | noresume = 1; |
1102 | else if (!strncmp(str, "nocompress", 10)) | 1119 | else if (!strncmp(str, "nocompress", 10)) |
1103 | nocompress = 1; | 1120 | nocompress = 1; |
1121 | else if (!strncmp(str, "no", 2)) { | ||
1122 | noresume = 1; | ||
1123 | nohibernate = 1; | ||
1124 | } | ||
1104 | return 1; | 1125 | return 1; |
1105 | } | 1126 | } |
1106 | 1127 | ||
@@ -1125,9 +1146,23 @@ static int __init resumedelay_setup(char *str) | |||
1125 | return 1; | 1146 | return 1; |
1126 | } | 1147 | } |
1127 | 1148 | ||
1149 | static int __init nohibernate_setup(char *str) | ||
1150 | { | ||
1151 | noresume = 1; | ||
1152 | nohibernate = 1; | ||
1153 | return 1; | ||
1154 | } | ||
1155 | |||
1156 | static int __init kaslr_nohibernate_setup(char *str) | ||
1157 | { | ||
1158 | return nohibernate_setup(str); | ||
1159 | } | ||
1160 | |||
1128 | __setup("noresume", noresume_setup); | 1161 | __setup("noresume", noresume_setup); |
1129 | __setup("resume_offset=", resume_offset_setup); | 1162 | __setup("resume_offset=", resume_offset_setup); |
1130 | __setup("resume=", resume_setup); | 1163 | __setup("resume=", resume_setup); |
1131 | __setup("hibernate=", hibernate_setup); | 1164 | __setup("hibernate=", hibernate_setup); |
1132 | __setup("resumewait", resumewait_setup); | 1165 | __setup("resumewait", resumewait_setup); |
1133 | __setup("resumedelay=", resumedelay_setup); | 1166 | __setup("resumedelay=", resumedelay_setup); |
1167 | __setup("nohibernate", nohibernate_setup); | ||
1168 | __setup("kaslr", kaslr_nohibernate_setup); | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index 573410d6647e..8e90f330f139 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -300,13 +300,11 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
300 | s += sprintf(s,"%s ", pm_states[i].label); | 300 | s += sprintf(s,"%s ", pm_states[i].label); |
301 | 301 | ||
302 | #endif | 302 | #endif |
303 | #ifdef CONFIG_HIBERNATION | 303 | if (hibernation_available()) |
304 | s += sprintf(s, "%s\n", "disk"); | 304 | s += sprintf(s, "disk "); |
305 | #else | ||
306 | if (s != buf) | 305 | if (s != buf) |
307 | /* convert the last space to a newline */ | 306 | /* convert the last space to a newline */ |
308 | *(s-1) = '\n'; | 307 | *(s-1) = '\n'; |
309 | #endif | ||
310 | return (s - buf); | 308 | return (s - buf); |
311 | } | 309 | } |
312 | 310 | ||
diff --git a/kernel/power/user.c b/kernel/power/user.c index 98d357584cd6..526e8911460a 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -49,6 +49,9 @@ static int snapshot_open(struct inode *inode, struct file *filp) | |||
49 | struct snapshot_data *data; | 49 | struct snapshot_data *data; |
50 | int error; | 50 | int error; |
51 | 51 | ||
52 | if (!hibernation_available()) | ||
53 | return -EPERM; | ||
54 | |||
52 | lock_system_sleep(); | 55 | lock_system_sleep(); |
53 | 56 | ||
54 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { | 57 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { |