summaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /kernel/power
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/Kconfig16
-rw-r--r--kernel/power/qos.c26
-rw-r--r--kernel/power/snapshot.c9
-rw-r--r--kernel/power/user.c21
4 files changed, 34 insertions, 38 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 2fac9cc..d444c4e 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -178,22 +178,6 @@ config PM_SLEEP_DEBUG
def_bool y
depends on PM_DEBUG && PM_SLEEP
-config DPM_WATCHDOG
- bool "Device suspend/resume watchdog"
- depends on PM_DEBUG && PSTORE
- ---help---
- Sets up a watchdog timer to capture drivers that are
- locked up attempting to suspend/resume a device.
- A detected lockup causes system panic with message
- captured in pstore device for inspection in subsequent
- boot session.
-
-config DPM_WATCHDOG_TIMEOUT
- int "Watchdog timeout in seconds"
- range 1 120
- default 12
- depends on DPM_WATCHDOG
-
config PM_TRACE
bool
help
diff --git a/kernel/power/qos.c b/kernel/power/qos.c
index 8dff9b4..a394297 100644
--- a/kernel/power/qos.c
+++ b/kernel/power/qos.c
@@ -558,12 +558,30 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
if (count == sizeof(s32)) {
if (copy_from_user(&value, buf, sizeof(s32)))
return -EFAULT;
- } else {
+ } else if (count <= 11) { /* ASCII perhaps? */
+ char ascii_value[11];
+ unsigned long int ulval;
int ret;
- ret = kstrtos32_from_user(buf, count, 16, &value);
- if (ret)
- return ret;
+ if (copy_from_user(ascii_value, buf, count))
+ return -EFAULT;
+
+ if (count > 10) {
+ if (ascii_value[10] == '\n')
+ ascii_value[10] = '\0';
+ else
+ return -EINVAL;
+ } else {
+ ascii_value[count] = '\0';
+ }
+ ret = kstrtoul(ascii_value, 16, &ulval);
+ if (ret) {
+ pr_debug("%s, 0x%lx, 0x%x\n", ascii_value, ulval, ret);
+ return -EINVAL;
+ }
+ value = (s32)lower_32_bits(ulval);
+ } else {
+ return -EINVAL;
}
req = filp->private_data;
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index b38109e..98c3b34 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -792,8 +792,7 @@ void free_basic_memory_bitmaps(void)
{
struct memory_bitmap *bm1, *bm2;
- if (WARN_ON(!(forbidden_pages_map && free_pages_map)))
- return;
+ BUG_ON(!(forbidden_pages_map && free_pages_map));
bm1 = forbidden_pages_map;
bm2 = free_pages_map;
@@ -1403,11 +1402,7 @@ int hibernate_preallocate_memory(void)
* highmem and non-highmem zones separately.
*/
pages_highmem = preallocate_image_highmem(highmem / 2);
- alloc = count - max_size;
- if (alloc > pages_highmem)
- alloc -= pages_highmem;
- else
- alloc = 0;
+ alloc = (count - max_size) - pages_highmem;
pages = preallocate_image_memory(alloc, avail_normal);
if (pages < alloc) {
/* We have exhausted non-highmem pages, try highmem. */
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 98d3575..957f061 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -36,9 +36,9 @@ static struct snapshot_data {
struct snapshot_handle handle;
int swap;
int mode;
- bool frozen;
- bool ready;
- bool platform_support;
+ char frozen;
+ char ready;
+ char platform_support;
bool free_bitmaps;
} snapshot_state;
@@ -70,7 +70,6 @@ static int snapshot_open(struct inode *inode, struct file *filp)
data->swap = swsusp_resume_device ?
swap_type_of(swsusp_resume_device, 0, NULL) : -1;
data->mode = O_RDONLY;
- data->free_bitmaps = false;
error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
if (error)
pm_notifier_call_chain(PM_POST_HIBERNATION);
@@ -94,9 +93,9 @@ static int snapshot_open(struct inode *inode, struct file *filp)
if (error)
atomic_inc(&snapshot_device_available);
- data->frozen = false;
- data->ready = false;
- data->platform_support = false;
+ data->frozen = 0;
+ data->ready = 0;
+ data->platform_support = 0;
Unlock:
unlock_system_sleep();
@@ -230,7 +229,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
if (error)
thaw_processes();
else
- data->frozen = true;
+ data->frozen = 1;
break;
@@ -241,7 +240,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
free_basic_memory_bitmaps();
data->free_bitmaps = false;
thaw_processes();
- data->frozen = false;
+ data->frozen = 0;
break;
case SNAPSHOT_CREATE_IMAGE:
@@ -271,7 +270,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
case SNAPSHOT_FREE:
swsusp_free();
memset(&data->handle, 0, sizeof(struct snapshot_handle));
- data->ready = false;
+ data->ready = 0;
/*
* It is necessary to thaw kernel threads here, because
* SNAPSHOT_CREATE_IMAGE may be invoked directly after
@@ -335,7 +334,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
* PM_HIBERNATION_PREPARE
*/
error = suspend_devices_and_enter(PM_SUSPEND_MEM);
- data->ready = false;
+ data->ready = 0;
break;
case SNAPSHOT_PLATFORM_SUPPORT: