Skip to content

Commit 4140054

Browse files
guohanjunrafaeljw
authored andcommitted
ACPI: processor_throttling: Cleanup the printing messages
The log messages in processor_throttling.c is not in consistency, we have some printk() calls with PREFIX, but some are not; also 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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 6183a68 commit 4140054

File tree

1 file changed

+26
-34
lines changed

1 file changed

+26
-34
lines changed

drivers/acpi/processor_throttling.c

Lines changed: 26 additions & 34 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/slab.h>
@@ -20,8 +22,6 @@
2022
#include <asm/io.h>
2123
#include <linux/uaccess.h>
2224

23-
#define PREFIX "ACPI: "
24-
2525
/* ignore_tpc:
2626
* 0 -> acpi processor driver doesn't ignore _TPC values
2727
* 1 -> acpi processor driver ignores _TPC values
@@ -236,8 +236,7 @@ static int acpi_processor_throttling_notifier(unsigned long event, void *data)
236236
if (pr->throttling_platform_limit > target_state)
237237
target_state = pr->throttling_platform_limit;
238238
if (target_state >= p_throttling->state_count) {
239-
printk(KERN_WARNING
240-
"Exceed the limit of T-state \n");
239+
pr_warn("Exceed the limit of T-state \n");
241240
target_state = p_throttling->state_count - 1;
242241
}
243242
p_tstate->target_state = target_state;
@@ -256,8 +255,7 @@ static int acpi_processor_throttling_notifier(unsigned long event, void *data)
256255
cpu, target_state);
257256
break;
258257
default:
259-
printk(KERN_WARNING
260-
"Unsupported Throttling notifier event\n");
258+
pr_warn("Unsupported Throttling notifier event\n");
261259
break;
262260
}
263261

@@ -422,7 +420,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
422420
ptc = (union acpi_object *)buffer.pointer;
423421
if (!ptc || (ptc->type != ACPI_TYPE_PACKAGE)
424422
|| (ptc->package.count != 2)) {
425-
printk(KERN_ERR PREFIX "Invalid _PTC data\n");
423+
pr_err("Invalid _PTC data\n");
426424
result = -EFAULT;
427425
goto end;
428426
}
@@ -436,8 +434,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
436434
if ((obj.type != ACPI_TYPE_BUFFER)
437435
|| (obj.buffer.length < sizeof(struct acpi_ptc_register))
438436
|| (obj.buffer.pointer == NULL)) {
439-
printk(KERN_ERR PREFIX
440-
"Invalid _PTC data (control_register)\n");
437+
pr_err("Invalid _PTC data (control_register)\n");
441438
result = -EFAULT;
442439
goto end;
443440
}
@@ -453,7 +450,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
453450
if ((obj.type != ACPI_TYPE_BUFFER)
454451
|| (obj.buffer.length < sizeof(struct acpi_ptc_register))
455452
|| (obj.buffer.pointer == NULL)) {
456-
printk(KERN_ERR PREFIX "Invalid _PTC data (status_register)\n");
453+
pr_err("Invalid _PTC data (status_register)\n");
457454
result = -EFAULT;
458455
goto end;
459456
}
@@ -465,14 +462,14 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
465462

466463
if ((throttling->control_register.bit_width +
467464
throttling->control_register.bit_offset) > 32) {
468-
printk(KERN_ERR PREFIX "Invalid _PTC control register\n");
465+
pr_err("Invalid _PTC control register\n");
469466
result = -EFAULT;
470467
goto end;
471468
}
472469

473470
if ((throttling->status_register.bit_width +
474471
throttling->status_register.bit_offset) > 32) {
475-
printk(KERN_ERR PREFIX "Invalid _PTC status register\n");
472+
pr_err("Invalid _PTC status register\n");
476473
result = -EFAULT;
477474
goto end;
478475
}
@@ -506,7 +503,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
506503

507504
tss = buffer.pointer;
508505
if (!tss || (tss->type != ACPI_TYPE_PACKAGE)) {
509-
printk(KERN_ERR PREFIX "Invalid _TSS data\n");
506+
pr_err("Invalid _TSS data\n");
510507
result = -EFAULT;
511508
goto end;
512509
}
@@ -546,15 +543,14 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
546543
}
547544

548545
if (!tx->freqpercentage) {
549-
printk(KERN_ERR PREFIX
550-
"Invalid _TSS data: freq is zero\n");
546+
pr_err("Invalid _TSS data: freq is zero\n");
551547
result = -EFAULT;
552548
kfree(pr->throttling.states_tss);
553549
goto end;
554550
}
555551
}
556552

557-
end:
553+
end:
558554
kfree(buffer.pointer);
559555

560556
return result;
@@ -587,13 +583,13 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
587583

588584
tsd = buffer.pointer;
589585
if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) {
590-
printk(KERN_ERR PREFIX "Invalid _TSD data\n");
586+
pr_err("Invalid _TSD data\n");
591587
result = -EFAULT;
592588
goto end;
593589
}
594590

595591
if (tsd->package.count != 1) {
596-
printk(KERN_ERR PREFIX "Invalid _TSD data\n");
592+
pr_err("Invalid _TSD data\n");
597593
result = -EFAULT;
598594
goto end;
599595
}
@@ -606,19 +602,19 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
606602
status = acpi_extract_package(&(tsd->package.elements[0]),
607603
&format, &state);
608604
if (ACPI_FAILURE(status)) {
609-
printk(KERN_ERR PREFIX "Invalid _TSD data\n");
605+
pr_err("Invalid _TSD data\n");
610606
result = -EFAULT;
611607
goto end;
612608
}
613609

614610
if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) {
615-
printk(KERN_ERR PREFIX "Unknown _TSD:num_entries\n");
611+
pr_err("Unknown _TSD:num_entries\n");
616612
result = -EFAULT;
617613
goto end;
618614
}
619615

620616
if (pdomain->revision != ACPI_TSD_REV0_REVISION) {
621-
printk(KERN_ERR PREFIX "Unknown _TSD:revision\n");
617+
pr_err("Unknown _TSD:revision\n");
622618
result = -EFAULT;
623619
goto end;
624620
}
@@ -639,7 +635,7 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
639635
pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL;
640636
}
641637

642-
end:
638+
end:
643639
kfree(buffer.pointer);
644640
return result;
645641
}
@@ -711,8 +707,7 @@ static int acpi_throttling_rdmsr(u64 *value)
711707

712708
if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
713709
!this_cpu_has(X86_FEATURE_ACPI)) {
714-
printk(KERN_ERR PREFIX
715-
"HARDWARE addr space,NOT supported yet\n");
710+
pr_err("HARDWARE addr space,NOT supported yet\n");
716711
} else {
717712
msr_low = 0;
718713
msr_high = 0;
@@ -732,8 +727,7 @@ static int acpi_throttling_wrmsr(u64 value)
732727

733728
if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
734729
!this_cpu_has(X86_FEATURE_ACPI)) {
735-
printk(KERN_ERR PREFIX
736-
"HARDWARE addr space,NOT supported yet\n");
730+
pr_err("HARDWARE addr space,NOT supported yet\n");
737731
} else {
738732
msr = value;
739733
wrmsr_safe(MSR_IA32_THERM_CONTROL,
@@ -745,15 +739,13 @@ static int acpi_throttling_wrmsr(u64 value)
745739
#else
746740
static int acpi_throttling_rdmsr(u64 *value)
747741
{
748-
printk(KERN_ERR PREFIX
749-
"HARDWARE addr space,NOT supported yet\n");
742+
pr_err("HARDWARE addr space,NOT supported yet\n");
750743
return -1;
751744
}
752745

753746
static int acpi_throttling_wrmsr(u64 value)
754747
{
755-
printk(KERN_ERR PREFIX
756-
"HARDWARE addr space,NOT supported yet\n");
748+
pr_err("HARDWARE addr space,NOT supported yet\n");
757749
return -1;
758750
}
759751
#endif
@@ -784,7 +776,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
784776
ret = acpi_throttling_rdmsr(value);
785777
break;
786778
default:
787-
printk(KERN_ERR PREFIX "Unknown addr space %d\n",
779+
pr_err("Unknown addr space %d\n",
788780
(u32) (throttling->status_register.space_id));
789781
}
790782
return ret;
@@ -817,7 +809,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr,
817809
ret = acpi_throttling_wrmsr(value);
818810
break;
819811
default:
820-
printk(KERN_ERR PREFIX "Unknown addr space %d\n",
812+
pr_err("Unknown addr space %d\n",
821813
(u32) (throttling->control_register.space_id));
822814
}
823815
return ret;
@@ -926,7 +918,7 @@ static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
926918
}
927919
/* TBD: Support duty_cycle values that span bit 4. */
928920
else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
929-
printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
921+
pr_warn("duty_cycle spans bit 4\n");
930922
return -EINVAL;
931923
}
932924

@@ -1246,7 +1238,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
12461238
goto end;
12471239
}
12481240

1249-
end:
1241+
end:
12501242
if (result)
12511243
pr->flags.throttling = 0;
12521244

0 commit comments

Comments
 (0)