Skip to content

Commit f23a5e1

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: PM: Fix PM QOS's user mode interface to work with ASCII input PM / Hibernate: Update kerneldoc comments in hibernate.c PM / Hibernate: Remove arch_prepare_suspend() PM / Hibernate: Update some comments in core hibernate code
2 parents d24c2af + 0775a60 commit f23a5e1

11 files changed

Lines changed: 134 additions & 167 deletions

File tree

‎arch/frv/include/asm/suspend.h‎

Lines changed: 0 additions & 20 deletions
This file was deleted.

‎arch/mips/include/asm/suspend.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef __ASM_SUSPEND_H
22
#define __ASM_SUSPEND_H
33

4-
static inline int arch_prepare_suspend(void) { return 0; }
5-
64
/* References to section boundaries */
75
extern const void __nosave_begin, __nosave_end;
86

‎arch/powerpc/include/asm/suspend.h‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎arch/powerpc/kernel/swsusp.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111

1212
#include <linux/sched.h>
13-
#include <asm/suspend.h>
1413
#include <asm/system.h>
1514
#include <asm/current.h>
1615
#include <asm/mmu_context.h>

‎arch/s390/include/asm/suspend.h‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎arch/sh/include/asm/suspend.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#ifndef __ASSEMBLY__
55
#include <linux/notifier.h>
6-
static inline int arch_prepare_suspend(void) { return 0; }
76

87
#include <asm/ptrace.h>
98

‎arch/unicore32/include/asm/suspend.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define __UNICORE_SUSPEND_H__
1515

1616
#ifndef __ASSEMBLY__
17-
static inline int arch_prepare_suspend(void) { return 0; }
1817

1918
#include <asm/ptrace.h>
2019

‎arch/x86/include/asm/suspend_32.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <asm/desc.h>
1010
#include <asm/i387.h>
1111

12-
static inline int arch_prepare_suspend(void) { return 0; }
13-
1412
/* image of the saved processor state */
1513
struct saved_context {
1614
u16 es, fs, gs, ss;

‎arch/x86/include/asm/suspend_64.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
#include <asm/desc.h>
1010
#include <asm/i387.h>
1111

12-
static inline int arch_prepare_suspend(void)
13-
{
14-
return 0;
15-
}
16-
1712
/*
1813
* Image of the saved processor state, used by the low level ACPI suspend to
1914
* RAM code and by the low level hibernation code.

‎kernel/pm_qos_params.c‎

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <linux/string.h>
4141
#include <linux/platform_device.h>
4242
#include <linux/init.h>
43+
#include <linux/kernel.h>
4344

4445
#include <linux/uaccess.h>
4546

@@ -404,24 +405,36 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
404405
size_t count, loff_t *f_pos)
405406
{
406407
s32 value;
407-
int x;
408-
char ascii_value[11];
409408
struct pm_qos_request_list *pm_qos_req;
410409

411410
if (count == sizeof(s32)) {
412411
if (copy_from_user(&value, buf, sizeof(s32)))
413412
return -EFAULT;
414-
} else if (count == 11) { /* len('0x12345678/0') */
415-
if (copy_from_user(ascii_value, buf, 11))
413+
} else if (count <= 11) { /* ASCII perhaps? */
414+
char ascii_value[11];
415+
unsigned long int ulval;
416+
int ret;
417+
418+
if (copy_from_user(ascii_value, buf, count))
416419
return -EFAULT;
417-
if (strlen(ascii_value) != 10)
418-
return -EINVAL;
419-
x = sscanf(ascii_value, "%x", &value);
420-
if (x != 1)
420+
421+
if (count > 10) {
422+
if (ascii_value[10] == '\n')
423+
ascii_value[10] = '\0';
424+
else
425+
return -EINVAL;
426+
} else {
427+
ascii_value[count] = '\0';
428+
}
429+
ret = strict_strtoul(ascii_value, 16, &ulval);
430+
if (ret) {
431+
pr_debug("%s, 0x%lx, 0x%x\n", ascii_value, ulval, ret);
421432
return -EINVAL;
422-
pr_debug("%s, %d, 0x%x\n", ascii_value, x, value);
423-
} else
433+
}
434+
value = (s32)lower_32_bits(ulval);
435+
} else {
424436
return -EINVAL;
437+
}
425438

426439
pm_qos_req = filp->private_data;
427440
pm_qos_update_request(pm_qos_req, value);

0 commit comments

Comments
 (0)