aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/hibernate.c22
-rw-r--r--kernel/power/main.c4
-rw-r--r--kernel/power/power.h2
-rw-r--r--kernel/power/qos.c18
-rw-r--r--kernel/power/snapshot.c2
-rw-r--r--kernel/power/suspend.c2
-rw-r--r--kernel/power/wakelock.c2
7 files changed, 32 insertions, 20 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 37170d4dd9a6..f4f2073711d3 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -973,16 +973,20 @@ static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr,
973static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, 973static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
974 const char *buf, size_t n) 974 const char *buf, size_t n)
975{ 975{
976 unsigned int maj, min;
977 dev_t res; 976 dev_t res;
978 int ret = -EINVAL; 977 int len = n;
978 char *name;
979 979
980 if (sscanf(buf, "%u:%u", &maj, &min) != 2) 980 if (len && buf[len-1] == '\n')
981 goto out; 981 len--;
982 name = kstrndup(buf, len, GFP_KERNEL);
983 if (!name)
984 return -ENOMEM;
982 985
983 res = MKDEV(maj,min); 986 res = name_to_dev_t(name);
984 if (maj != MAJOR(res) || min != MINOR(res)) 987 kfree(name);
985 goto out; 988 if (!res)
989 return -EINVAL;
986 990
987 lock_system_sleep(); 991 lock_system_sleep();
988 swsusp_resume_device = res; 992 swsusp_resume_device = res;
@@ -990,9 +994,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
990 printk(KERN_INFO "PM: Starting manual resume from disk\n"); 994 printk(KERN_INFO "PM: Starting manual resume from disk\n");
991 noresume = 0; 995 noresume = 0;
992 software_resume(); 996 software_resume();
993 ret = n; 997 return n;
994 out:
995 return ret;
996} 998}
997 999
998power_attr(resume); 1000power_attr(resume);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 1d1bf630e6e9..6271bc4073ef 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -282,8 +282,8 @@ struct kobject *power_kobj;
282 * state - control system power state. 282 * state - control system power state.
283 * 283 *
284 * show() returns what states are supported, which is hard-coded to 284 * show() returns what states are supported, which is hard-coded to
285 * 'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and 285 * 'freeze' (Low-Power Idle), 'standby' (Power-On Suspend),
286 * 'disk' (Suspend-to-Disk). 286 * 'mem' (Suspend-to-RAM), and 'disk' (Suspend-to-Disk).
287 * 287 *
288 * store() accepts one of those strings, translates it into the 288 * store() accepts one of those strings, translates it into the
289 * proper enumerated value, and initiates a suspend transition. 289 * proper enumerated value, and initiates a suspend transition.
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 7d4b7ffb3c1d..1ca753106557 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -49,6 +49,8 @@ static inline char *check_image_kernel(struct swsusp_info *info)
49 */ 49 */
50#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) 50#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
51 51
52asmlinkage int swsusp_save(void);
53
52/* kernel/power/hibernate.c */ 54/* kernel/power/hibernate.c */
53extern bool freezer_test_done; 55extern bool freezer_test_done;
54 56
diff --git a/kernel/power/qos.c b/kernel/power/qos.c
index 8dff9b48075a..884b77058864 100644
--- a/kernel/power/qos.c
+++ b/kernel/power/qos.c
@@ -66,6 +66,7 @@ static struct pm_qos_constraints cpu_dma_constraints = {
66 .list = PLIST_HEAD_INIT(cpu_dma_constraints.list), 66 .list = PLIST_HEAD_INIT(cpu_dma_constraints.list),
67 .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, 67 .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE,
68 .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, 68 .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE,
69 .no_constraint_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE,
69 .type = PM_QOS_MIN, 70 .type = PM_QOS_MIN,
70 .notifiers = &cpu_dma_lat_notifier, 71 .notifiers = &cpu_dma_lat_notifier,
71}; 72};
@@ -79,6 +80,7 @@ static struct pm_qos_constraints network_lat_constraints = {
79 .list = PLIST_HEAD_INIT(network_lat_constraints.list), 80 .list = PLIST_HEAD_INIT(network_lat_constraints.list),
80 .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, 81 .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE,
81 .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, 82 .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE,
83 .no_constraint_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE,
82 .type = PM_QOS_MIN, 84 .type = PM_QOS_MIN,
83 .notifiers = &network_lat_notifier, 85 .notifiers = &network_lat_notifier,
84}; 86};
@@ -93,6 +95,7 @@ static struct pm_qos_constraints network_tput_constraints = {
93 .list = PLIST_HEAD_INIT(network_tput_constraints.list), 95 .list = PLIST_HEAD_INIT(network_tput_constraints.list),
94 .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, 96 .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE,
95 .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, 97 .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE,
98 .no_constraint_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE,
96 .type = PM_QOS_MAX, 99 .type = PM_QOS_MAX,
97 .notifiers = &network_throughput_notifier, 100 .notifiers = &network_throughput_notifier,
98}; 101};
@@ -128,7 +131,7 @@ static const struct file_operations pm_qos_power_fops = {
128static inline int pm_qos_get_value(struct pm_qos_constraints *c) 131static inline int pm_qos_get_value(struct pm_qos_constraints *c)
129{ 132{
130 if (plist_head_empty(&c->list)) 133 if (plist_head_empty(&c->list))
131 return c->default_value; 134 return c->no_constraint_value;
132 135
133 switch (c->type) { 136 switch (c->type) {
134 case PM_QOS_MIN: 137 case PM_QOS_MIN:
@@ -170,6 +173,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
170{ 173{
171 unsigned long flags; 174 unsigned long flags;
172 int prev_value, curr_value, new_value; 175 int prev_value, curr_value, new_value;
176 int ret;
173 177
174 spin_lock_irqsave(&pm_qos_lock, flags); 178 spin_lock_irqsave(&pm_qos_lock, flags);
175 prev_value = pm_qos_get_value(c); 179 prev_value = pm_qos_get_value(c);
@@ -205,13 +209,15 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
205 209
206 trace_pm_qos_update_target(action, prev_value, curr_value); 210 trace_pm_qos_update_target(action, prev_value, curr_value);
207 if (prev_value != curr_value) { 211 if (prev_value != curr_value) {
208 blocking_notifier_call_chain(c->notifiers, 212 ret = 1;
209 (unsigned long)curr_value, 213 if (c->notifiers)
210 NULL); 214 blocking_notifier_call_chain(c->notifiers,
211 return 1; 215 (unsigned long)curr_value,
216 NULL);
212 } else { 217 } else {
213 return 0; 218 ret = 0;
214 } 219 }
220 return ret;
215} 221}
216 222
217/** 223/**
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index d9f61a145802..149e745eaa52 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1268,7 +1268,7 @@ static void free_unnecessary_pages(void)
1268 * [number of saveable pages] - [number of pages that can be freed in theory] 1268 * [number of saveable pages] - [number of pages that can be freed in theory]
1269 * 1269 *
1270 * where the second term is the sum of (1) reclaimable slab pages, (2) active 1270 * where the second term is the sum of (1) reclaimable slab pages, (2) active
1271 * and (3) inactive anonymouns pages, (4) active and (5) inactive file pages, 1271 * and (3) inactive anonymous pages, (4) active and (5) inactive file pages,
1272 * minus mapped file pages. 1272 * minus mapped file pages.
1273 */ 1273 */
1274static unsigned long minimum_image_size(unsigned long saveable) 1274static unsigned long minimum_image_size(unsigned long saveable)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 62ee437b5c7e..90b3d9366d1a 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -39,7 +39,7 @@ static const struct platform_suspend_ops *suspend_ops;
39 39
40static bool need_suspend_ops(suspend_state_t state) 40static bool need_suspend_ops(suspend_state_t state)
41{ 41{
42 return !!(state > PM_SUSPEND_FREEZE); 42 return state > PM_SUSPEND_FREEZE;
43} 43}
44 44
45static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head); 45static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head);
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index 8f50de394d22..019069c84ff6 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -18,6 +18,8 @@
18#include <linux/rbtree.h> 18#include <linux/rbtree.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20 20
21#include "power.h"
22
21static DEFINE_MUTEX(wakelocks_lock); 23static DEFINE_MUTEX(wakelocks_lock);
22 24
23struct wakelock { 25struct wakelock {