diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/processor_perflib.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 2f2e7964226d..c4efc0c17f8f 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -433,49 +433,6 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) | |||
433 | PDE(inode)->data); | 433 | PDE(inode)->data); |
434 | } | 434 | } |
435 | 435 | ||
436 | static ssize_t | ||
437 | acpi_processor_write_performance(struct file *file, | ||
438 | const char __user * buffer, | ||
439 | size_t count, loff_t * data) | ||
440 | { | ||
441 | int result = 0; | ||
442 | struct seq_file *m = file->private_data; | ||
443 | struct acpi_processor *pr = m->private; | ||
444 | struct acpi_processor_performance *perf; | ||
445 | char state_string[12] = { '\0' }; | ||
446 | unsigned int new_state = 0; | ||
447 | struct cpufreq_policy policy; | ||
448 | |||
449 | |||
450 | if (!pr || (count > sizeof(state_string) - 1)) | ||
451 | return -EINVAL; | ||
452 | |||
453 | perf = pr->performance; | ||
454 | if (!perf) | ||
455 | return -EINVAL; | ||
456 | |||
457 | if (copy_from_user(state_string, buffer, count)) | ||
458 | return -EFAULT; | ||
459 | |||
460 | state_string[count] = '\0'; | ||
461 | new_state = simple_strtoul(state_string, NULL, 0); | ||
462 | |||
463 | if (new_state >= perf->state_count) | ||
464 | return -EINVAL; | ||
465 | |||
466 | cpufreq_get_policy(&policy, pr->id); | ||
467 | |||
468 | policy.cpu = pr->id; | ||
469 | policy.min = perf->states[new_state].core_frequency * 1000; | ||
470 | policy.max = perf->states[new_state].core_frequency * 1000; | ||
471 | |||
472 | result = cpufreq_set_policy(&policy); | ||
473 | if (result) | ||
474 | return result; | ||
475 | |||
476 | return count; | ||
477 | } | ||
478 | |||
479 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) | 436 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) |
480 | { | 437 | { |
481 | struct proc_dir_entry *entry = NULL; | 438 | struct proc_dir_entry *entry = NULL; |
@@ -487,10 +444,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) | |||
487 | 444 | ||
488 | /* add file 'performance' [R/W] */ | 445 | /* add file 'performance' [R/W] */ |
489 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, | 446 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, |
490 | S_IFREG | S_IRUGO | S_IWUSR, | 447 | S_IFREG | S_IRUGO, |
491 | acpi_device_dir(device)); | 448 | acpi_device_dir(device)); |
492 | if (entry){ | 449 | if (entry){ |
493 | acpi_processor_perf_fops.write = acpi_processor_write_performance; | ||
494 | entry->proc_fops = &acpi_processor_perf_fops; | 450 | entry->proc_fops = &acpi_processor_perf_fops; |
495 | entry->data = acpi_driver_data(device); | 451 | entry->data = acpi_driver_data(device); |
496 | entry->owner = THIS_MODULE; | 452 | entry->owner = THIS_MODULE; |