Commit 6183a684 authored by Hanjun Guo's avatar Hanjun Guo Committed by Rafael J. Wysocki

ACPI: processor_perflib: Cleanup print messages

The log messages in processor_perflib.c is not in consistency,
we have some printk() calls with PREFIX, but some are not; we
use pr_*() functions without prefix. So add pr_fmt() and unify
them with pr_*() functions.

While at it, fix some obvious coding style issues when going
through the functions.
Signed-off-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 673a0796
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* - Added processor hotplug support * - Added processor hotplug support
*/ */
#define pr_fmt(fmt) "ACPI: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -20,8 +22,6 @@ ...@@ -20,8 +22,6 @@
#include <asm/cpufeature.h> #include <asm/cpufeature.h>
#endif #endif
#define PREFIX "ACPI: "
#define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
static DEFINE_MUTEX(performance_mutex); static DEFINE_MUTEX(performance_mutex);
...@@ -194,7 +194,6 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -194,7 +194,6 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
union acpi_object *pct = NULL; union acpi_object *pct = NULL;
union acpi_object obj = { 0 }; union acpi_object obj = { 0 };
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_evaluation_failure_warn(pr->handle, "_PCT", status); acpi_evaluation_failure_warn(pr->handle, "_PCT", status);
...@@ -204,7 +203,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -204,7 +203,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
pct = (union acpi_object *)buffer.pointer; pct = (union acpi_object *)buffer.pointer;
if (!pct || (pct->type != ACPI_TYPE_PACKAGE) if (!pct || (pct->type != ACPI_TYPE_PACKAGE)
|| (pct->package.count != 2)) { || (pct->package.count != 2)) {
printk(KERN_ERR PREFIX "Invalid _PCT data\n"); pr_err("Invalid _PCT data\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
...@@ -218,7 +217,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -218,7 +217,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
if ((obj.type != ACPI_TYPE_BUFFER) if ((obj.type != ACPI_TYPE_BUFFER)
|| (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.length < sizeof(struct acpi_pct_register))
|| (obj.buffer.pointer == NULL)) { || (obj.buffer.pointer == NULL)) {
printk(KERN_ERR PREFIX "Invalid _PCT data (control_register)\n"); pr_err("Invalid _PCT data (control_register)\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
...@@ -234,7 +233,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -234,7 +233,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
if ((obj.type != ACPI_TYPE_BUFFER) if ((obj.type != ACPI_TYPE_BUFFER)
|| (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.length < sizeof(struct acpi_pct_register))
|| (obj.buffer.pointer == NULL)) { || (obj.buffer.pointer == NULL)) {
printk(KERN_ERR PREFIX "Invalid _PCT data (status_register)\n"); pr_err("Invalid _PCT data (status_register)\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
...@@ -242,7 +241,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -242,7 +241,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
memcpy(&pr->performance->status_register, obj.buffer.pointer, memcpy(&pr->performance->status_register, obj.buffer.pointer,
sizeof(struct acpi_pct_register)); sizeof(struct acpi_pct_register));
end: end:
kfree(buffer.pointer); kfree(buffer.pointer);
return result; return result;
...@@ -294,7 +293,6 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -294,7 +293,6 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
int i; int i;
int last_invalid = -1; int last_invalid = -1;
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_evaluation_failure_warn(pr->handle, "_PSS", status); acpi_evaluation_failure_warn(pr->handle, "_PSS", status);
...@@ -303,7 +301,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -303,7 +301,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
pss = buffer.pointer; pss = buffer.pointer;
if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) {
printk(KERN_ERR PREFIX "Invalid _PSS data\n"); pr_err("Invalid _PSS data\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
...@@ -357,7 +355,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -357,7 +355,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
if (!px->core_frequency || if (!px->core_frequency ||
((u32)(px->core_frequency * 1000) != ((u32)(px->core_frequency * 1000) !=
(px->core_frequency * 1000))) { (px->core_frequency * 1000))) {
printk(KERN_ERR FW_BUG PREFIX pr_err(FW_BUG
"Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n", "Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n",
pr->id, px->core_frequency); pr->id, px->core_frequency);
if (last_invalid == -1) if (last_invalid == -1)
...@@ -375,8 +373,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -375,8 +373,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
} }
if (last_invalid == 0) { if (last_invalid == 0) {
printk(KERN_ERR FW_BUG PREFIX pr_err(FW_BUG
"No valid BIOS _PSS frequency found for processor %d\n", pr->id); "No valid BIOS _PSS frequency found for processor %d\n", pr->id);
result = -EFAULT; result = -EFAULT;
kfree(pr->performance->states); kfree(pr->performance->states);
pr->performance->states = NULL; pr->performance->states = NULL;
...@@ -385,7 +383,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -385,7 +383,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
if (last_invalid > 0) if (last_invalid > 0)
pr->performance->state_count = last_invalid; pr->performance->state_count = last_invalid;
end: end:
kfree(buffer.pointer); kfree(buffer.pointer);
return result; return result;
...@@ -426,7 +424,7 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr) ...@@ -426,7 +424,7 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr)
#ifdef CONFIG_X86 #ifdef CONFIG_X86
if (acpi_has_method(pr->handle, "_PPC")) { if (acpi_has_method(pr->handle, "_PPC")) {
if(boot_cpu_has(X86_FEATURE_EST)) if(boot_cpu_has(X86_FEATURE_EST))
printk(KERN_WARNING FW_BUG "BIOS needs update for CPU " pr_warn(FW_BUG "BIOS needs update for CPU "
"frequency support\n"); "frequency support\n");
} }
#endif #endif
...@@ -520,13 +518,13 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain) ...@@ -520,13 +518,13 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
psd = buffer.pointer; psd = buffer.pointer;
if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) { if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) {
printk(KERN_ERR PREFIX "Invalid _PSD data\n"); pr_err("Invalid _PSD data\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
if (psd->package.count != 1) { if (psd->package.count != 1) {
printk(KERN_ERR PREFIX "Invalid _PSD data\n"); pr_err("Invalid _PSD data\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
...@@ -537,19 +535,19 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain) ...@@ -537,19 +535,19 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
status = acpi_extract_package(&(psd->package.elements[0]), status = acpi_extract_package(&(psd->package.elements[0]),
&format, &state); &format, &state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Invalid _PSD data\n"); pr_err("Invalid _PSD data\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) { if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) {
printk(KERN_ERR PREFIX "Unknown _PSD:num_entries\n"); pr_err("Unknown _PSD:num_entries\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
if (pdomain->revision != ACPI_PSD_REV0_REVISION) { if (pdomain->revision != ACPI_PSD_REV0_REVISION) {
printk(KERN_ERR PREFIX "Unknown _PSD:revision\n"); pr_err("Unknown _PSD:revision\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
...@@ -557,7 +555,7 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain) ...@@ -557,7 +555,7 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL && if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL &&
pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY && pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY &&
pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) { pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) {
printk(KERN_ERR PREFIX "Invalid _PSD:coord_type\n"); pr_err("Invalid _PSD:coord_type\n");
result = -EFAULT; result = -EFAULT;
goto end; goto end;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment