From 04b73469750050290cb0a773e7ecf2358d65f6d5 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 27 Feb 2014 17:13:53 +0530 Subject: PM / sleep: Move prototype declaration to header file kernel/power/power.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move prototype declaration of function to header file kernel/power/power.h because it is used by more than one file. This eliminates the following warning in kernel/power/snapshot.c: kernel/power/snapshot.c:1588:16: warning: no previous prototype for ‘swsusp_save’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Acked-by: Pavel Machek Signed-off-by: Rafael J. Wysocki --- kernel/power/power.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'kernel/power') diff --git a/kernel/power/power.h b/kernel/power/power.h index 7d4b7ffb3c1..1ca75310655 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) */ #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) +asmlinkage int swsusp_save(void); + /* kernel/power/hibernate.c */ extern bool freezer_test_done; -- cgit v1.2.3-70-g09d2 From 6c5be2916565e8c710e9f0f7b43cf65a3ba39dd9 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 27 Feb 2014 17:15:54 +0530 Subject: PM / wakeup: Include appropriate header file in kernel/power/wakelock.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include appropriate header file kernel/power/power.h in kernel/power/wakelock.c because it has prototype declaration of function defined in kernel/power/wakelock.c. This eliminates the following warning in kernel/power/wakelock.c: kernel/power/wakelock.c:34:9: warning: no previous prototype for ‘pm_show_wakelocks’ [-Wmissing-prototypes] kernel/power/wakelock.c:184:5: warning: no previous prototype for ‘pm_wake_lock’ [-Wmissing-prototypes] kernel/power/wakelock.c:232:5: warning: no previous prototype for ‘pm_wake_unlock’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Rafael J. Wysocki --- kernel/power/wakelock.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'kernel/power') diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index 8f50de394d2..019069c84ff 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -18,6 +18,8 @@ #include #include +#include "power.h" + static DEFINE_MUTEX(wakelocks_lock); struct wakelock { -- cgit v1.2.3-70-g09d2 From 421a5fa1a6cfc037a21220b638d4def6da7cbabe Mon Sep 17 00:00:00 2001 From: Sebastian Capella Date: Fri, 14 Feb 2014 14:52:56 -0800 Subject: PM / hibernate: use name_to_dev_t to parse resume Use the name_to_dev_t call to parse the device name echo'd to to /sys/power/resume. This imitates the method used in hibernate.c in software_resume, and allows the resume partition to be specified using other equivalent device formats as well. By allowing /sys/debug/resume to accept the same syntax as the resume=device parameter, we can parse the resume=device in the init script and use the resume device directly from the kernel command line. Signed-off-by: Sebastian Capella Acked-by: Pavel Machek Signed-off-by: Rafael J. Wysocki --- kernel/power/hibernate.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'kernel/power') diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 37170d4dd9a..f4f2073711d 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, static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { - unsigned int maj, min; dev_t res; - int ret = -EINVAL; + int len = n; + char *name; - if (sscanf(buf, "%u:%u", &maj, &min) != 2) - goto out; + if (len && buf[len-1] == '\n') + len--; + name = kstrndup(buf, len, GFP_KERNEL); + if (!name) + return -ENOMEM; - res = MKDEV(maj,min); - if (maj != MAJOR(res) || min != MINOR(res)) - goto out; + res = name_to_dev_t(name); + kfree(name); + if (!res) + return -EINVAL; lock_system_sleep(); swsusp_resume_device = res; @@ -990,9 +994,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, printk(KERN_INFO "PM: Starting manual resume from disk\n"); noresume = 0; software_resume(); - ret = n; - out: - return ret; + return n; } power_attr(resume); -- cgit v1.2.3-70-g09d2 From 7500d9363f7e356a5a3f10f1778f2e4f8a7eba94 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 10 Mar 2014 19:31:51 +0530 Subject: PM / suspend: Remove unnecessary !! Double ! or !! are normally required to get 0 or 1 out of a expression. A comparision always returns 0 or 1 and hence there is no need to apply double ! over it again. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- kernel/power/suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/power') diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 62ee437b5c7..90b3d9366d1 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -39,7 +39,7 @@ static const struct platform_suspend_ops *suspend_ops; static bool need_suspend_ops(suspend_state_t state) { - return !!(state > PM_SUSPEND_FREEZE); + return state > PM_SUSPEND_FREEZE; } static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head); -- cgit v1.2.3-70-g09d2 From 4d4348202b34c130a899b597fec14bbb5d83108d Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 11 Mar 2014 11:23:41 +0100 Subject: PM / Hibernate: Spelling s/anonymouns/anonymous/ Spelling fix. Signed-off-by: Geert Uytterhoeven Acked-by: Pavel Machek Signed-off-by: Rafael J. Wysocki --- kernel/power/snapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/power') diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index d9f61a14580..149e745eaa5 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1268,7 +1268,7 @@ static void free_unnecessary_pages(void) * [number of saveable pages] - [number of pages that can be freed in theory] * * where the second term is the sum of (1) reclaimable slab pages, (2) active - * and (3) inactive anonymouns pages, (4) active and (5) inactive file pages, + * and (3) inactive anonymous pages, (4) active and (5) inactive file pages, * minus mapped file pages. */ static unsigned long minimum_image_size(unsigned long saveable) -- cgit v1.2.3-70-g09d2 From af02b5fdb1fb3c5d5f8d71f7f84e4fb243e1ae31 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 11 Mar 2014 12:08:11 +0100 Subject: PM: Add missing "freeze" state Fix descriptions of /sys/power/state in the documentation and in a code comment. Signed-off-by: Geert Uytterhoeven Reviewed-by: Srivatsa S. Bhat Acked-by: Pavel Machek [rjw: Changelog] Signed-off-by: Rafael J. Wysocki --- Documentation/ABI/testing/sysfs-power | 5 +++-- kernel/power/main.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'kernel/power') diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power index 205a7387844..64c9276e942 100644 --- a/Documentation/ABI/testing/sysfs-power +++ b/Documentation/ABI/testing/sysfs-power @@ -12,8 +12,9 @@ Contact: Rafael J. Wysocki Description: The /sys/power/state file controls the system power state. Reading from this file returns what states are supported, - which is hard-coded to 'standby' (Power-On Suspend), 'mem' - (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). + which is hard-coded to 'freeze' (Low-Power Idle), 'standby' + (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk' + (Suspend-to-Disk). Writing to this file one of these strings causes the system to transition into that state. Please see the file diff --git a/kernel/power/main.c b/kernel/power/main.c index 1d1bf630e6e..6271bc4073e 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -282,8 +282,8 @@ struct kobject *power_kobj; * state - control system power state. * * show() returns what states are supported, which is hard-coded to - * 'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and - * 'disk' (Suspend-to-Disk). + * 'freeze' (Low-Power Idle), 'standby' (Power-On Suspend), + * 'mem' (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). * * store() accepts one of those strings, translates it into the * proper enumerated value, and initiates a suspend transition. -- cgit v1.2.3-70-g09d2