Skip to content

Commit 6183a68

Browse files
guohanjunrafaeljw
authored andcommitted
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: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 673a079 commit 6183a68

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

drivers/acpi/processor_perflib.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* - Added processor hotplug support
1010
*/
1111

12+
#define pr_fmt(fmt) "ACPI: " fmt
13+
1214
#include <linux/kernel.h>
1315
#include <linux/module.h>
1416
#include <linux/init.h>
@@ -20,8 +22,6 @@
2022
#include <asm/cpufeature.h>
2123
#endif
2224

23-
#define PREFIX "ACPI: "
24-
2525
#define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
2626

2727
static DEFINE_MUTEX(performance_mutex);
@@ -194,7 +194,6 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
194194
union acpi_object *pct = NULL;
195195
union acpi_object obj = { 0 };
196196

197-
198197
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
199198
if (ACPI_FAILURE(status)) {
200199
acpi_evaluation_failure_warn(pr->handle, "_PCT", status);
@@ -204,7 +203,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
204203
pct = (union acpi_object *)buffer.pointer;
205204
if (!pct || (pct->type != ACPI_TYPE_PACKAGE)
206205
|| (pct->package.count != 2)) {
207-
printk(KERN_ERR PREFIX "Invalid _PCT data\n");
206+
pr_err("Invalid _PCT data\n");
208207
result = -EFAULT;
209208
goto end;
210209
}
@@ -218,7 +217,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
218217
if ((obj.type != ACPI_TYPE_BUFFER)
219218
|| (obj.buffer.length < sizeof(struct acpi_pct_register))
220219
|| (obj.buffer.pointer == NULL)) {
221-
printk(KERN_ERR PREFIX "Invalid _PCT data (control_register)\n");
220+
pr_err("Invalid _PCT data (control_register)\n");
222221
result = -EFAULT;
223222
goto end;
224223
}
@@ -234,15 +233,15 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
234233
if ((obj.type != ACPI_TYPE_BUFFER)
235234
|| (obj.buffer.length < sizeof(struct acpi_pct_register))
236235
|| (obj.buffer.pointer == NULL)) {
237-
printk(KERN_ERR PREFIX "Invalid _PCT data (status_register)\n");
236+
pr_err("Invalid _PCT data (status_register)\n");
238237
result = -EFAULT;
239238
goto end;
240239
}
241240

242241
memcpy(&pr->performance->status_register, obj.buffer.pointer,
243242
sizeof(struct acpi_pct_register));
244243

245-
end:
244+
end:
246245
kfree(buffer.pointer);
247246

248247
return result;
@@ -294,7 +293,6 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
294293
int i;
295294
int last_invalid = -1;
296295

297-
298296
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
299297
if (ACPI_FAILURE(status)) {
300298
acpi_evaluation_failure_warn(pr->handle, "_PSS", status);
@@ -303,7 +301,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
303301

304302
pss = buffer.pointer;
305303
if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) {
306-
printk(KERN_ERR PREFIX "Invalid _PSS data\n");
304+
pr_err("Invalid _PSS data\n");
307305
result = -EFAULT;
308306
goto end;
309307
}
@@ -357,7 +355,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
357355
if (!px->core_frequency ||
358356
((u32)(px->core_frequency * 1000) !=
359357
(px->core_frequency * 1000))) {
360-
printk(KERN_ERR FW_BUG PREFIX
358+
pr_err(FW_BUG
361359
"Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n",
362360
pr->id, px->core_frequency);
363361
if (last_invalid == -1)
@@ -375,8 +373,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
375373
}
376374

377375
if (last_invalid == 0) {
378-
printk(KERN_ERR FW_BUG PREFIX
379-
"No valid BIOS _PSS frequency found for processor %d\n", pr->id);
376+
pr_err(FW_BUG
377+
"No valid BIOS _PSS frequency found for processor %d\n", pr->id);
380378
result = -EFAULT;
381379
kfree(pr->performance->states);
382380
pr->performance->states = NULL;
@@ -385,7 +383,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
385383
if (last_invalid > 0)
386384
pr->performance->state_count = last_invalid;
387385

388-
end:
386+
end:
389387
kfree(buffer.pointer);
390388

391389
return result;
@@ -426,7 +424,7 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr)
426424
#ifdef CONFIG_X86
427425
if (acpi_has_method(pr->handle, "_PPC")) {
428426
if(boot_cpu_has(X86_FEATURE_EST))
429-
printk(KERN_WARNING FW_BUG "BIOS needs update for CPU "
427+
pr_warn(FW_BUG "BIOS needs update for CPU "
430428
"frequency support\n");
431429
}
432430
#endif
@@ -520,13 +518,13 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
520518

521519
psd = buffer.pointer;
522520
if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) {
523-
printk(KERN_ERR PREFIX "Invalid _PSD data\n");
521+
pr_err("Invalid _PSD data\n");
524522
result = -EFAULT;
525523
goto end;
526524
}
527525

528526
if (psd->package.count != 1) {
529-
printk(KERN_ERR PREFIX "Invalid _PSD data\n");
527+
pr_err("Invalid _PSD data\n");
530528
result = -EFAULT;
531529
goto end;
532530
}
@@ -537,27 +535,27 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
537535
status = acpi_extract_package(&(psd->package.elements[0]),
538536
&format, &state);
539537
if (ACPI_FAILURE(status)) {
540-
printk(KERN_ERR PREFIX "Invalid _PSD data\n");
538+
pr_err("Invalid _PSD data\n");
541539
result = -EFAULT;
542540
goto end;
543541
}
544542

545543
if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) {
546-
printk(KERN_ERR PREFIX "Unknown _PSD:num_entries\n");
544+
pr_err("Unknown _PSD:num_entries\n");
547545
result = -EFAULT;
548546
goto end;
549547
}
550548

551549
if (pdomain->revision != ACPI_PSD_REV0_REVISION) {
552-
printk(KERN_ERR PREFIX "Unknown _PSD:revision\n");
550+
pr_err("Unknown _PSD:revision\n");
553551
result = -EFAULT;
554552
goto end;
555553
}
556554

557555
if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL &&
558556
pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY &&
559557
pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) {
560-
printk(KERN_ERR PREFIX "Invalid _PSD:coord_type\n");
558+
pr_err("Invalid _PSD:coord_type\n");
561559
result = -EFAULT;
562560
goto end;
563561
}

0 commit comments

Comments
 (0)