diff options
Diffstat (limited to 'kernel/pm_qos_params.c')
-rw-r--r-- | kernel/pm_qos_params.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c index 996a4dec5f96..aeaa7f846821 100644 --- a/kernel/pm_qos_params.c +++ b/kernel/pm_qos_params.c | |||
@@ -110,6 +110,7 @@ static const struct file_operations pm_qos_power_fops = { | |||
110 | .write = pm_qos_power_write, | 110 | .write = pm_qos_power_write, |
111 | .open = pm_qos_power_open, | 111 | .open = pm_qos_power_open, |
112 | .release = pm_qos_power_release, | 112 | .release = pm_qos_power_release, |
113 | .llseek = noop_llseek, | ||
113 | }; | 114 | }; |
114 | 115 | ||
115 | /* unlocked internal variant */ | 116 | /* unlocked internal variant */ |
@@ -120,10 +121,10 @@ static inline int pm_qos_get_value(struct pm_qos_object *o) | |||
120 | 121 | ||
121 | switch (o->type) { | 122 | switch (o->type) { |
122 | case PM_QOS_MIN: | 123 | case PM_QOS_MIN: |
123 | return plist_last(&o->requests)->prio; | 124 | return plist_first(&o->requests)->prio; |
124 | 125 | ||
125 | case PM_QOS_MAX: | 126 | case PM_QOS_MAX: |
126 | return plist_first(&o->requests)->prio; | 127 | return plist_last(&o->requests)->prio; |
127 | 128 | ||
128 | default: | 129 | default: |
129 | /* runtime check for not using enum */ | 130 | /* runtime check for not using enum */ |
@@ -212,15 +213,17 @@ EXPORT_SYMBOL_GPL(pm_qos_request_active); | |||
212 | 213 | ||
213 | /** | 214 | /** |
214 | * pm_qos_add_request - inserts new qos request into the list | 215 | * pm_qos_add_request - inserts new qos request into the list |
215 | * @pm_qos_class: identifies which list of qos request to us | 216 | * @dep: pointer to a preallocated handle |
217 | * @pm_qos_class: identifies which list of qos request to use | ||
216 | * @value: defines the qos request | 218 | * @value: defines the qos request |
217 | * | 219 | * |
218 | * This function inserts a new entry in the pm_qos_class list of requested qos | 220 | * This function inserts a new entry in the pm_qos_class list of requested qos |
219 | * performance characteristics. It recomputes the aggregate QoS expectations | 221 | * performance characteristics. It recomputes the aggregate QoS expectations |
220 | * for the pm_qos_class of parameters, and returns the pm_qos_request list | 222 | * for the pm_qos_class of parameters and initializes the pm_qos_request_list |
221 | * element as a handle for use in updating and removal. Call needs to save | 223 | * handle. Caller needs to save this handle for later use in updates and |
222 | * this handle for later use. | 224 | * removal. |
223 | */ | 225 | */ |
226 | |||
224 | void pm_qos_add_request(struct pm_qos_request_list *dep, | 227 | void pm_qos_add_request(struct pm_qos_request_list *dep, |
225 | int pm_qos_class, s32 value) | 228 | int pm_qos_class, s32 value) |
226 | { | 229 | { |
@@ -348,7 +351,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp) | |||
348 | 351 | ||
349 | pm_qos_class = find_pm_qos_object_by_minor(iminor(inode)); | 352 | pm_qos_class = find_pm_qos_object_by_minor(iminor(inode)); |
350 | if (pm_qos_class >= 0) { | 353 | if (pm_qos_class >= 0) { |
351 | struct pm_qos_request_list *req = kzalloc(GFP_KERNEL, sizeof(*req)); | 354 | struct pm_qos_request_list *req = kzalloc(sizeof(*req), GFP_KERNEL); |
352 | if (!req) | 355 | if (!req) |
353 | return -ENOMEM; | 356 | return -ENOMEM; |
354 | 357 | ||
@@ -387,14 +390,16 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | |||
387 | } else if (count == 11) { /* len('0x12345678/0') */ | 390 | } else if (count == 11) { /* len('0x12345678/0') */ |
388 | if (copy_from_user(ascii_value, buf, 11)) | 391 | if (copy_from_user(ascii_value, buf, 11)) |
389 | return -EFAULT; | 392 | return -EFAULT; |
393 | if (strlen(ascii_value) != 10) | ||
394 | return -EINVAL; | ||
390 | x = sscanf(ascii_value, "%x", &value); | 395 | x = sscanf(ascii_value, "%x", &value); |
391 | if (x != 1) | 396 | if (x != 1) |
392 | return -EINVAL; | 397 | return -EINVAL; |
393 | pr_debug(KERN_ERR "%s, %d, 0x%x\n", ascii_value, x, value); | 398 | pr_debug("%s, %d, 0x%x\n", ascii_value, x, value); |
394 | } else | 399 | } else |
395 | return -EINVAL; | 400 | return -EINVAL; |
396 | 401 | ||
397 | pm_qos_req = (struct pm_qos_request_list *)filp->private_data; | 402 | pm_qos_req = filp->private_data; |
398 | pm_qos_update_request(pm_qos_req, value); | 403 | pm_qos_update_request(pm_qos_req, value); |
399 | 404 | ||
400 | return count; | 405 | return count; |