Merge branch 'pm-qos'
* pm-qos: PM / QoS: simplify pm_qos_power_write()
This commit is contained in:
commit
400fc45273
|
@ -558,30 +558,12 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
|
||||||
if (count == sizeof(s32)) {
|
if (count == sizeof(s32)) {
|
||||||
if (copy_from_user(&value, buf, sizeof(s32)))
|
if (copy_from_user(&value, buf, sizeof(s32)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
} else if (count <= 11) { /* ASCII perhaps? */
|
} else {
|
||||||
char ascii_value[11];
|
|
||||||
unsigned long int ulval;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (copy_from_user(ascii_value, buf, count))
|
ret = kstrtos32_from_user(buf, count, 16, &value);
|
||||||
return -EFAULT;
|
if (ret)
|
||||||
|
return ret;
|
||||||
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;
|
req = filp->private_data;
|
||||||
|
|
Loading…
Reference in New Issue