aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/processor_thermal.c')
-rw-r--r--drivers/acpi/processor_thermal.c83
1 files changed, 0 insertions, 83 deletions
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index 6deafb4aa0da..953b25fb9869 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -30,8 +30,6 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/cpufreq.h> 32#include <linux/cpufreq.h>
33#include <linux/proc_fs.h>
34#include <linux/seq_file.h>
35#include <linux/sysdev.h> 33#include <linux/sysdev.h>
36 34
37#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -438,84 +436,3 @@ struct thermal_cooling_device_ops processor_cooling_ops = {
438 .get_cur_state = processor_get_cur_state, 436 .get_cur_state = processor_get_cur_state,
439 .set_cur_state = processor_set_cur_state, 437 .set_cur_state = processor_set_cur_state,
440}; 438};
441
442/* /proc interface */
443#ifdef CONFIG_ACPI_PROCFS
444static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
445{
446 struct acpi_processor *pr = seq->private;
447
448 if (!pr)
449 goto end;
450
451 if (!pr->flags.limit) {
452 seq_puts(seq, "<not supported>\n");
453 goto end;
454 }
455
456 seq_printf(seq, "active limit: P%d:T%d\n"
457 "user limit: P%d:T%d\n"
458 "thermal limit: P%d:T%d\n",
459 pr->limit.state.px, pr->limit.state.tx,
460 pr->limit.user.px, pr->limit.user.tx,
461 pr->limit.thermal.px, pr->limit.thermal.tx);
462
463 end:
464 return 0;
465}
466
467static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file)
468{
469 return single_open(file, acpi_processor_limit_seq_show,
470 PDE(inode)->data);
471}
472
473static ssize_t acpi_processor_write_limit(struct file * file,
474 const char __user * buffer,
475 size_t count, loff_t * data)
476{
477 int result = 0;
478 struct seq_file *m = file->private_data;
479 struct acpi_processor *pr = m->private;
480 char limit_string[25] = { '\0' };
481 int px = 0;
482 int tx = 0;
483
484
485 if (!pr || (count > sizeof(limit_string) - 1)) {
486 return -EINVAL;
487 }
488
489 if (copy_from_user(limit_string, buffer, count)) {
490 return -EFAULT;
491 }
492
493 limit_string[count] = '\0';
494
495 if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) {
496 printk(KERN_ERR PREFIX "Invalid data format\n");
497 return -EINVAL;
498 }
499
500 if (pr->flags.throttling) {
501 if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) {
502 printk(KERN_ERR PREFIX "Invalid tx\n");
503 return -EINVAL;
504 }
505 pr->limit.user.tx = tx;
506 }
507
508 result = acpi_processor_apply_limit(pr);
509
510 return count;
511}
512
513const struct file_operations acpi_processor_limit_fops = {
514 .owner = THIS_MODULE,
515 .open = acpi_processor_limit_open_fs,
516 .read = seq_read,
517 .write = acpi_processor_write_limit,
518 .llseek = seq_lseek,
519 .release = single_release,
520};
521#endif