Merge branch 'ull' into test
[linux-2.6/mini2440.git] / drivers / acpi / processor_perflib.c
blobdc98f7a6f2c49bfb701716f330fc70dff13012a5
1 /*
2 * processor_perflib.c - ACPI Processor P-States Library ($Revision: 71 $)
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
7 * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
8 * - Added processor hotplug support
11 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or (at
16 * your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/init.h>
32 #include <linux/cpufreq.h>
34 #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
35 #include <linux/proc_fs.h>
36 #include <linux/seq_file.h>
37 #include <linux/mutex.h>
39 #include <asm/uaccess.h>
40 #endif
41 #include <asm/cpufeature.h>
43 #include <acpi/acpi_bus.h>
44 #include <acpi/processor.h>
46 #define ACPI_PROCESSOR_COMPONENT 0x01000000
47 #define ACPI_PROCESSOR_CLASS "processor"
48 #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
49 #define _COMPONENT ACPI_PROCESSOR_COMPONENT
50 ACPI_MODULE_NAME("processor_perflib");
52 static DEFINE_MUTEX(performance_mutex);
54 /* Use cpufreq debug layer for _PPC changes. */
55 #define cpufreq_printk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, \
56 "cpufreq-core", msg)
59 * _PPC support is implemented as a CPUfreq policy notifier:
60 * This means each time a CPUfreq driver registered also with
61 * the ACPI core is asked to change the speed policy, the maximum
62 * value is adjusted so that it is within the platform limit.
64 * Also, when a new platform limit value is detected, the CPUfreq
65 * policy is adjusted accordingly.
68 /* ignore_ppc:
69 * -1 -> cpufreq low level drivers not initialized -> _PSS, etc. not called yet
70 * ignore _PPC
71 * 0 -> cpufreq low level drivers initialized -> consider _PPC values
72 * 1 -> ignore _PPC totally -> forced by user through boot param
74 static int ignore_ppc = -1;
75 module_param(ignore_ppc, int, 0644);
76 MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
77 "limited by BIOS, this should help");
79 #define PPC_REGISTERED 1
80 #define PPC_IN_USE 2
82 static int acpi_processor_ppc_status;
84 static int acpi_processor_ppc_notifier(struct notifier_block *nb,
85 unsigned long event, void *data)
87 struct cpufreq_policy *policy = data;
88 struct acpi_processor *pr;
89 unsigned int ppc = 0;
91 if (event == CPUFREQ_START && ignore_ppc <= 0) {
92 ignore_ppc = 0;
93 return 0;
96 if (ignore_ppc)
97 return 0;
99 if (event != CPUFREQ_INCOMPATIBLE)
100 return 0;
102 mutex_lock(&performance_mutex);
104 pr = per_cpu(processors, policy->cpu);
105 if (!pr || !pr->performance)
106 goto out;
108 ppc = (unsigned int)pr->performance_platform_limit;
110 if (ppc >= pr->performance->state_count)
111 goto out;
113 cpufreq_verify_within_limits(policy, 0,
114 pr->performance->states[ppc].
115 core_frequency * 1000);
117 out:
118 mutex_unlock(&performance_mutex);
120 return 0;
123 static struct notifier_block acpi_ppc_notifier_block = {
124 .notifier_call = acpi_processor_ppc_notifier,
127 static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
129 acpi_status status = 0;
130 unsigned long long ppc = 0;
133 if (!pr)
134 return -EINVAL;
137 * _PPC indicates the maximum state currently supported by the platform
138 * (e.g. 0 = states 0..n; 1 = states 1..n; etc.
140 status = acpi_evaluate_integer(pr->handle, "_PPC", NULL, &ppc);
142 if (status != AE_NOT_FOUND)
143 acpi_processor_ppc_status |= PPC_IN_USE;
145 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
146 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC"));
147 return -ENODEV;
150 cpufreq_printk("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
151 (int)ppc, ppc ? "" : "not");
153 pr->performance_platform_limit = (int)ppc;
155 return 0;
158 int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
160 int ret;
162 if (ignore_ppc)
163 return 0;
165 ret = acpi_processor_get_platform_limit(pr);
167 if (ret < 0)
168 return (ret);
169 else
170 return cpufreq_update_policy(pr->id);
173 void acpi_processor_ppc_init(void)
175 if (!cpufreq_register_notifier
176 (&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER))
177 acpi_processor_ppc_status |= PPC_REGISTERED;
178 else
179 printk(KERN_DEBUG
180 "Warning: Processor Platform Limit not supported.\n");
183 void acpi_processor_ppc_exit(void)
185 if (acpi_processor_ppc_status & PPC_REGISTERED)
186 cpufreq_unregister_notifier(&acpi_ppc_notifier_block,
187 CPUFREQ_POLICY_NOTIFIER);
189 acpi_processor_ppc_status &= ~PPC_REGISTERED;
192 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
194 int result = 0;
195 acpi_status status = 0;
196 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
197 union acpi_object *pct = NULL;
198 union acpi_object obj = { 0 };
201 status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
202 if (ACPI_FAILURE(status)) {
203 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT"));
204 return -ENODEV;
207 pct = (union acpi_object *)buffer.pointer;
208 if (!pct || (pct->type != ACPI_TYPE_PACKAGE)
209 || (pct->package.count != 2)) {
210 printk(KERN_ERR PREFIX "Invalid _PCT data\n");
211 result = -EFAULT;
212 goto end;
216 * control_register
219 obj = pct->package.elements[0];
221 if ((obj.type != ACPI_TYPE_BUFFER)
222 || (obj.buffer.length < sizeof(struct acpi_pct_register))
223 || (obj.buffer.pointer == NULL)) {
224 printk(KERN_ERR PREFIX "Invalid _PCT data (control_register)\n");
225 result = -EFAULT;
226 goto end;
228 memcpy(&pr->performance->control_register, obj.buffer.pointer,
229 sizeof(struct acpi_pct_register));
232 * status_register
235 obj = pct->package.elements[1];
237 if ((obj.type != ACPI_TYPE_BUFFER)
238 || (obj.buffer.length < sizeof(struct acpi_pct_register))
239 || (obj.buffer.pointer == NULL)) {
240 printk(KERN_ERR PREFIX "Invalid _PCT data (status_register)\n");
241 result = -EFAULT;
242 goto end;
245 memcpy(&pr->performance->status_register, obj.buffer.pointer,
246 sizeof(struct acpi_pct_register));
248 end:
249 kfree(buffer.pointer);
251 return result;
254 static int acpi_processor_get_performance_states(struct acpi_processor *pr)
256 int result = 0;
257 acpi_status status = AE_OK;
258 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
259 struct acpi_buffer format = { sizeof("NNNNNN"), "NNNNNN" };
260 struct acpi_buffer state = { 0, NULL };
261 union acpi_object *pss = NULL;
262 int i;
265 status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
266 if (ACPI_FAILURE(status)) {
267 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS"));
268 return -ENODEV;
271 pss = buffer.pointer;
272 if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) {
273 printk(KERN_ERR PREFIX "Invalid _PSS data\n");
274 result = -EFAULT;
275 goto end;
278 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n",
279 pss->package.count));
281 pr->performance->state_count = pss->package.count;
282 pr->performance->states =
283 kmalloc(sizeof(struct acpi_processor_px) * pss->package.count,
284 GFP_KERNEL);
285 if (!pr->performance->states) {
286 result = -ENOMEM;
287 goto end;
290 for (i = 0; i < pr->performance->state_count; i++) {
292 struct acpi_processor_px *px = &(pr->performance->states[i]);
294 state.length = sizeof(struct acpi_processor_px);
295 state.pointer = px;
297 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i));
299 status = acpi_extract_package(&(pss->package.elements[i]),
300 &format, &state);
301 if (ACPI_FAILURE(status)) {
302 ACPI_EXCEPTION((AE_INFO, status, "Invalid _PSS data"));
303 result = -EFAULT;
304 kfree(pr->performance->states);
305 goto end;
308 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
309 "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n",
311 (u32) px->core_frequency,
312 (u32) px->power,
313 (u32) px->transition_latency,
314 (u32) px->bus_master_latency,
315 (u32) px->control, (u32) px->status));
317 if (!px->core_frequency) {
318 printk(KERN_ERR PREFIX
319 "Invalid _PSS data: freq is zero\n");
320 result = -EFAULT;
321 kfree(pr->performance->states);
322 goto end;
326 end:
327 kfree(buffer.pointer);
329 return result;
332 static int acpi_processor_get_performance_info(struct acpi_processor *pr)
334 int result = 0;
335 acpi_status status = AE_OK;
336 acpi_handle handle = NULL;
338 if (!pr || !pr->performance || !pr->handle)
339 return -EINVAL;
341 status = acpi_get_handle(pr->handle, "_PCT", &handle);
342 if (ACPI_FAILURE(status)) {
343 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
344 "ACPI-based processor performance control unavailable\n"));
345 return -ENODEV;
348 result = acpi_processor_get_performance_control(pr);
349 if (result)
350 goto update_bios;
352 result = acpi_processor_get_performance_states(pr);
353 if (result)
354 goto update_bios;
356 return 0;
359 * Having _PPC but missing frequencies (_PSS, _PCT) is a very good hint that
360 * the BIOS is older than the CPU and does not know its frequencies
362 update_bios:
363 if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){
364 if(boot_cpu_has(X86_FEATURE_EST))
365 printk(KERN_WARNING FW_BUG "BIOS needs update for CPU "
366 "frequency support\n");
368 return result;
371 int acpi_processor_notify_smm(struct module *calling_module)
373 acpi_status status;
374 static int is_done = 0;
377 if (!(acpi_processor_ppc_status & PPC_REGISTERED))
378 return -EBUSY;
380 if (!try_module_get(calling_module))
381 return -EINVAL;
383 /* is_done is set to negative if an error occured,
384 * and to postitive if _no_ error occured, but SMM
385 * was already notified. This avoids double notification
386 * which might lead to unexpected results...
388 if (is_done > 0) {
389 module_put(calling_module);
390 return 0;
391 } else if (is_done < 0) {
392 module_put(calling_module);
393 return is_done;
396 is_done = -EIO;
398 /* Can't write pstate_control to smi_command if either value is zero */
399 if ((!acpi_gbl_FADT.smi_command) || (!acpi_gbl_FADT.pstate_control)) {
400 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_control\n"));
401 module_put(calling_module);
402 return 0;
405 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
406 "Writing pstate_control [0x%x] to smi_command [0x%x]\n",
407 acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
409 status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
410 (u32) acpi_gbl_FADT.pstate_control, 8);
411 if (ACPI_FAILURE(status)) {
412 ACPI_EXCEPTION((AE_INFO, status,
413 "Failed to write pstate_control [0x%x] to "
414 "smi_command [0x%x]", acpi_gbl_FADT.pstate_control,
415 acpi_gbl_FADT.smi_command));
416 module_put(calling_module);
417 return status;
420 /* Success. If there's no _PPC, we need to fear nothing, so
421 * we can allow the cpufreq driver to be rmmod'ed. */
422 is_done = 1;
424 if (!(acpi_processor_ppc_status & PPC_IN_USE))
425 module_put(calling_module);
427 return 0;
430 EXPORT_SYMBOL(acpi_processor_notify_smm);
432 #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
433 /* /proc/acpi/processor/../performance interface (DEPRECATED) */
435 static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
436 static struct file_operations acpi_processor_perf_fops = {
437 .owner = THIS_MODULE,
438 .open = acpi_processor_perf_open_fs,
439 .read = seq_read,
440 .llseek = seq_lseek,
441 .release = single_release,
444 static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
446 struct acpi_processor *pr = seq->private;
447 int i;
450 if (!pr)
451 goto end;
453 if (!pr->performance) {
454 seq_puts(seq, "<not supported>\n");
455 goto end;
458 seq_printf(seq, "state count: %d\n"
459 "active state: P%d\n",
460 pr->performance->state_count, pr->performance->state);
462 seq_puts(seq, "states:\n");
463 for (i = 0; i < pr->performance->state_count; i++)
464 seq_printf(seq,
465 " %cP%d: %d MHz, %d mW, %d uS\n",
466 (i == pr->performance->state ? '*' : ' '), i,
467 (u32) pr->performance->states[i].core_frequency,
468 (u32) pr->performance->states[i].power,
469 (u32) pr->performance->states[i].transition_latency);
471 end:
472 return 0;
475 static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
477 return single_open(file, acpi_processor_perf_seq_show,
478 PDE(inode)->data);
481 static void acpi_cpufreq_add_file(struct acpi_processor *pr)
483 struct acpi_device *device = NULL;
486 if (acpi_bus_get_device(pr->handle, &device))
487 return;
489 /* add file 'performance' [R/W] */
490 proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO,
491 acpi_device_dir(device),
492 &acpi_processor_perf_fops, acpi_driver_data(device));
493 return;
496 static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
498 struct acpi_device *device = NULL;
501 if (acpi_bus_get_device(pr->handle, &device))
502 return;
504 /* remove file 'performance' */
505 remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
506 acpi_device_dir(device));
508 return;
511 #else
512 static void acpi_cpufreq_add_file(struct acpi_processor *pr)
514 return;
516 static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
518 return;
520 #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
522 static int acpi_processor_get_psd(struct acpi_processor *pr)
524 int result = 0;
525 acpi_status status = AE_OK;
526 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
527 struct acpi_buffer format = {sizeof("NNNNN"), "NNNNN"};
528 struct acpi_buffer state = {0, NULL};
529 union acpi_object *psd = NULL;
530 struct acpi_psd_package *pdomain;
532 status = acpi_evaluate_object(pr->handle, "_PSD", NULL, &buffer);
533 if (ACPI_FAILURE(status)) {
534 return -ENODEV;
537 psd = buffer.pointer;
538 if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) {
539 printk(KERN_ERR PREFIX "Invalid _PSD data\n");
540 result = -EFAULT;
541 goto end;
544 if (psd->package.count != 1) {
545 printk(KERN_ERR PREFIX "Invalid _PSD data\n");
546 result = -EFAULT;
547 goto end;
550 pdomain = &(pr->performance->domain_info);
552 state.length = sizeof(struct acpi_psd_package);
553 state.pointer = pdomain;
555 status = acpi_extract_package(&(psd->package.elements[0]),
556 &format, &state);
557 if (ACPI_FAILURE(status)) {
558 printk(KERN_ERR PREFIX "Invalid _PSD data\n");
559 result = -EFAULT;
560 goto end;
563 if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) {
564 printk(KERN_ERR PREFIX "Unknown _PSD:num_entries\n");
565 result = -EFAULT;
566 goto end;
569 if (pdomain->revision != ACPI_PSD_REV0_REVISION) {
570 printk(KERN_ERR PREFIX "Unknown _PSD:revision\n");
571 result = -EFAULT;
572 goto end;
575 end:
576 kfree(buffer.pointer);
577 return result;
580 int acpi_processor_preregister_performance(
581 struct acpi_processor_performance *performance)
583 int count, count_target;
584 int retval = 0;
585 unsigned int i, j;
586 cpumask_t covered_cpus;
587 struct acpi_processor *pr;
588 struct acpi_psd_package *pdomain;
589 struct acpi_processor *match_pr;
590 struct acpi_psd_package *match_pdomain;
592 mutex_lock(&performance_mutex);
594 retval = 0;
596 /* Call _PSD for all CPUs */
597 for_each_possible_cpu(i) {
598 pr = per_cpu(processors, i);
599 if (!pr) {
600 /* Look only at processors in ACPI namespace */
601 continue;
604 if (pr->performance) {
605 retval = -EBUSY;
606 continue;
609 if (!performance || !percpu_ptr(performance, i)) {
610 retval = -EINVAL;
611 continue;
614 pr->performance = percpu_ptr(performance, i);
615 cpu_set(i, pr->performance->shared_cpu_map);
616 if (acpi_processor_get_psd(pr)) {
617 retval = -EINVAL;
618 continue;
621 if (retval)
622 goto err_ret;
625 * Now that we have _PSD data from all CPUs, lets setup P-state
626 * domain info.
628 for_each_possible_cpu(i) {
629 pr = per_cpu(processors, i);
630 if (!pr)
631 continue;
633 /* Basic validity check for domain info */
634 pdomain = &(pr->performance->domain_info);
635 if ((pdomain->revision != ACPI_PSD_REV0_REVISION) ||
636 (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES)) {
637 retval = -EINVAL;
638 goto err_ret;
640 if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL &&
641 pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY &&
642 pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) {
643 retval = -EINVAL;
644 goto err_ret;
648 cpus_clear(covered_cpus);
649 for_each_possible_cpu(i) {
650 pr = per_cpu(processors, i);
651 if (!pr)
652 continue;
654 if (cpu_isset(i, covered_cpus))
655 continue;
657 pdomain = &(pr->performance->domain_info);
658 cpu_set(i, pr->performance->shared_cpu_map);
659 cpu_set(i, covered_cpus);
660 if (pdomain->num_processors <= 1)
661 continue;
663 /* Validate the Domain info */
664 count_target = pdomain->num_processors;
665 count = 1;
666 if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
667 pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL;
668 else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
669 pr->performance->shared_type = CPUFREQ_SHARED_TYPE_HW;
670 else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
671 pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY;
673 for_each_possible_cpu(j) {
674 if (i == j)
675 continue;
677 match_pr = per_cpu(processors, j);
678 if (!match_pr)
679 continue;
681 match_pdomain = &(match_pr->performance->domain_info);
682 if (match_pdomain->domain != pdomain->domain)
683 continue;
685 /* Here i and j are in the same domain */
687 if (match_pdomain->num_processors != count_target) {
688 retval = -EINVAL;
689 goto err_ret;
692 if (pdomain->coord_type != match_pdomain->coord_type) {
693 retval = -EINVAL;
694 goto err_ret;
697 cpu_set(j, covered_cpus);
698 cpu_set(j, pr->performance->shared_cpu_map);
699 count++;
702 for_each_possible_cpu(j) {
703 if (i == j)
704 continue;
706 match_pr = per_cpu(processors, j);
707 if (!match_pr)
708 continue;
710 match_pdomain = &(match_pr->performance->domain_info);
711 if (match_pdomain->domain != pdomain->domain)
712 continue;
714 match_pr->performance->shared_type =
715 pr->performance->shared_type;
716 match_pr->performance->shared_cpu_map =
717 pr->performance->shared_cpu_map;
721 err_ret:
722 for_each_possible_cpu(i) {
723 pr = per_cpu(processors, i);
724 if (!pr || !pr->performance)
725 continue;
727 /* Assume no coordination on any error parsing domain info */
728 if (retval) {
729 cpus_clear(pr->performance->shared_cpu_map);
730 cpu_set(i, pr->performance->shared_cpu_map);
731 pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL;
733 pr->performance = NULL; /* Will be set for real in register */
736 mutex_unlock(&performance_mutex);
737 return retval;
739 EXPORT_SYMBOL(acpi_processor_preregister_performance);
743 acpi_processor_register_performance(struct acpi_processor_performance
744 *performance, unsigned int cpu)
746 struct acpi_processor *pr;
749 if (!(acpi_processor_ppc_status & PPC_REGISTERED))
750 return -EINVAL;
752 mutex_lock(&performance_mutex);
754 pr = per_cpu(processors, cpu);
755 if (!pr) {
756 mutex_unlock(&performance_mutex);
757 return -ENODEV;
760 if (pr->performance) {
761 mutex_unlock(&performance_mutex);
762 return -EBUSY;
765 WARN_ON(!performance);
767 pr->performance = performance;
769 if (acpi_processor_get_performance_info(pr)) {
770 pr->performance = NULL;
771 mutex_unlock(&performance_mutex);
772 return -EIO;
775 acpi_cpufreq_add_file(pr);
777 mutex_unlock(&performance_mutex);
778 return 0;
781 EXPORT_SYMBOL(acpi_processor_register_performance);
783 void
784 acpi_processor_unregister_performance(struct acpi_processor_performance
785 *performance, unsigned int cpu)
787 struct acpi_processor *pr;
790 mutex_lock(&performance_mutex);
792 pr = per_cpu(processors, cpu);
793 if (!pr) {
794 mutex_unlock(&performance_mutex);
795 return;
798 if (pr->performance)
799 kfree(pr->performance->states);
800 pr->performance = NULL;
802 acpi_cpufreq_remove_file(pr);
804 mutex_unlock(&performance_mutex);
806 return;
809 EXPORT_SYMBOL(acpi_processor_unregister_performance);