summaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-28 01:27:21 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-28 01:27:21 +0100
commit400fc45273d53837390bf1a24f5930c1ad9de61e (patch)
treec7f61589708cfd13dff02fdc0644e774cf1db829 /kernel/power
parent8d58199fe7f5581680fae6ca4dc341ca7cbe7cc6 (diff)
parentd4f7ecf72819932e0f0a2221328d5eb4e28cc059 (diff)
Merge branch 'pm-qos'
* pm-qos: PM / QoS: simplify pm_qos_power_write()
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/qos.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/kernel/power/qos.c b/kernel/power/qos.c
index a394297f8b2f..8dff9b48075a 100644
--- a/kernel/power/qos.c
+++ b/kernel/power/qos.c
@@ -558,30 +558,12 @@ 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 if (count <= 11) { /* ASCII perhaps? */
- char ascii_value[11];
- unsigned long int ulval;
+ } else {
int 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;
+ ret = kstrtos32_from_user(buf, count, 16, &value);
+ if (ret)
+ return ret;
}
req = filp->private_data;