diff options
Diffstat (limited to 'drivers/acpi/processor_thermal.c')
-rw-r--r-- | drivers/acpi/processor_thermal.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 0f86d0253c60..ef5e0f6efdba 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -54,13 +54,12 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) | |||
54 | u16 px = 0; | 54 | u16 px = 0; |
55 | u16 tx = 0; | 55 | u16 tx = 0; |
56 | 56 | ||
57 | ACPI_FUNCTION_TRACE("acpi_processor_apply_limit"); | ||
58 | 57 | ||
59 | if (!pr) | 58 | if (!pr) |
60 | return_VALUE(-EINVAL); | 59 | return -EINVAL; |
61 | 60 | ||
62 | if (!pr->flags.limit) | 61 | if (!pr->flags.limit) |
63 | return_VALUE(-ENODEV); | 62 | return -ENODEV; |
64 | 63 | ||
65 | if (pr->flags.throttling) { | 64 | if (pr->flags.throttling) { |
66 | if (pr->limit.user.tx > tx) | 65 | if (pr->limit.user.tx > tx) |
@@ -84,7 +83,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) | |||
84 | if (result) | 83 | if (result) |
85 | printk(KERN_ERR PREFIX "Unable to set limit\n"); | 84 | printk(KERN_ERR PREFIX "Unable to set limit\n"); |
86 | 85 | ||
87 | return_VALUE(result); | 86 | return result; |
88 | } | 87 | } |
89 | 88 | ||
90 | #ifdef CONFIG_CPU_FREQ | 89 | #ifdef CONFIG_CPU_FREQ |
@@ -200,19 +199,18 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) | |||
200 | struct acpi_device *device = NULL; | 199 | struct acpi_device *device = NULL; |
201 | int tx = 0, max_tx_px = 0; | 200 | int tx = 0, max_tx_px = 0; |
202 | 201 | ||
203 | ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit"); | ||
204 | 202 | ||
205 | if ((type < ACPI_PROCESSOR_LIMIT_NONE) | 203 | if ((type < ACPI_PROCESSOR_LIMIT_NONE) |
206 | || (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) | 204 | || (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) |
207 | return_VALUE(-EINVAL); | 205 | return -EINVAL; |
208 | 206 | ||
209 | result = acpi_bus_get_device(handle, &device); | 207 | result = acpi_bus_get_device(handle, &device); |
210 | if (result) | 208 | if (result) |
211 | return_VALUE(result); | 209 | return result; |
212 | 210 | ||
213 | pr = (struct acpi_processor *)acpi_driver_data(device); | 211 | pr = (struct acpi_processor *)acpi_driver_data(device); |
214 | if (!pr) | 212 | if (!pr) |
215 | return_VALUE(-ENODEV); | 213 | return -ENODEV; |
216 | 214 | ||
217 | /* Thermal limits are always relative to the current Px/Tx state. */ | 215 | /* Thermal limits are always relative to the current Px/Tx state. */ |
218 | if (pr->flags.throttling) | 216 | if (pr->flags.throttling) |
@@ -296,22 +294,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) | |||
296 | } else | 294 | } else |
297 | result = 0; | 295 | result = 0; |
298 | if (max_tx_px) | 296 | if (max_tx_px) |
299 | return_VALUE(1); | 297 | return 1; |
300 | else | 298 | else |
301 | return_VALUE(result); | 299 | return result; |
302 | } | 300 | } |
303 | 301 | ||
304 | int acpi_processor_get_limit_info(struct acpi_processor *pr) | 302 | int acpi_processor_get_limit_info(struct acpi_processor *pr) |
305 | { | 303 | { |
306 | ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info"); | ||
307 | 304 | ||
308 | if (!pr) | 305 | if (!pr) |
309 | return_VALUE(-EINVAL); | 306 | return -EINVAL; |
310 | 307 | ||
311 | if (pr->flags.throttling) | 308 | if (pr->flags.throttling) |
312 | pr->flags.limit = 1; | 309 | pr->flags.limit = 1; |
313 | 310 | ||
314 | return_VALUE(0); | 311 | return 0; |
315 | } | 312 | } |
316 | 313 | ||
317 | /* /proc interface */ | 314 | /* /proc interface */ |
@@ -320,7 +317,6 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) | |||
320 | { | 317 | { |
321 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 318 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; |
322 | 319 | ||
323 | ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show"); | ||
324 | 320 | ||
325 | if (!pr) | 321 | if (!pr) |
326 | goto end; | 322 | goto end; |
@@ -338,7 +334,7 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) | |||
338 | pr->limit.thermal.px, pr->limit.thermal.tx); | 334 | pr->limit.thermal.px, pr->limit.thermal.tx); |
339 | 335 | ||
340 | end: | 336 | end: |
341 | return_VALUE(0); | 337 | return 0; |
342 | } | 338 | } |
343 | 339 | ||
344 | static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) | 340 | static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) |
@@ -358,34 +354,33 @@ static ssize_t acpi_processor_write_limit(struct file * file, | |||
358 | int px = 0; | 354 | int px = 0; |
359 | int tx = 0; | 355 | int tx = 0; |
360 | 356 | ||
361 | ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); | ||
362 | 357 | ||
363 | if (!pr || (count > sizeof(limit_string) - 1)) { | 358 | if (!pr || (count > sizeof(limit_string) - 1)) { |
364 | return_VALUE(-EINVAL); | 359 | return -EINVAL; |
365 | } | 360 | } |
366 | 361 | ||
367 | if (copy_from_user(limit_string, buffer, count)) { | 362 | if (copy_from_user(limit_string, buffer, count)) { |
368 | return_VALUE(-EFAULT); | 363 | return -EFAULT; |
369 | } | 364 | } |
370 | 365 | ||
371 | limit_string[count] = '\0'; | 366 | limit_string[count] = '\0'; |
372 | 367 | ||
373 | if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { | 368 | if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { |
374 | printk(KERN_ERR PREFIX "Invalid data format\n"); | 369 | printk(KERN_ERR PREFIX "Invalid data format\n"); |
375 | return_VALUE(-EINVAL); | 370 | return -EINVAL; |
376 | } | 371 | } |
377 | 372 | ||
378 | if (pr->flags.throttling) { | 373 | if (pr->flags.throttling) { |
379 | if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { | 374 | if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { |
380 | printk(KERN_ERR PREFIX "Invalid tx\n"); | 375 | printk(KERN_ERR PREFIX "Invalid tx\n"); |
381 | return_VALUE(-EINVAL); | 376 | return -EINVAL; |
382 | } | 377 | } |
383 | pr->limit.user.tx = tx; | 378 | pr->limit.user.tx = tx; |
384 | } | 379 | } |
385 | 380 | ||
386 | result = acpi_processor_apply_limit(pr); | 381 | result = acpi_processor_apply_limit(pr); |
387 | 382 | ||
388 | return_VALUE(count); | 383 | return count; |
389 | } | 384 | } |
390 | 385 | ||
391 | struct file_operations acpi_processor_limit_fops = { | 386 | struct file_operations acpi_processor_limit_fops = { |