Skip to content

Commit 14fad24

Browse files
hkallweitrafaeljw
authored andcommitted
x86/acpi: Switch to pr_xxx log functions
Switching to pr_debug et al has two benefits: - We don't have to add PREFIX to each log statement - Debug output is suppressed except DEBUG is defined or dynamic debugging is enabled for the respective code piece. In addition ensure that longer messages aren't split to multiple lines in source code, checkpatch complains otherwise. Signed-off-by: Heiner Kallweit <[email protected]> Acked-by: Pavel Machek <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent d07f6ca commit 14fad24

File tree

1 file changed

+47
-71
lines changed

1 file changed

+47
-71
lines changed

arch/x86/kernel/acpi/boot.c

Lines changed: 47 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (C) 2001, 2002 Paul Diefenbaugh <[email protected]>
66
* Copyright (C) 2001 Jun Nakajima <[email protected]>
77
*/
8+
#define pr_fmt(fmt) "ACPI: " fmt
89

910
#include <linux/init.h>
1011
#include <linux/acpi.h>
@@ -42,8 +43,6 @@ EXPORT_SYMBOL(acpi_disabled);
4243
# include <asm/proto.h>
4344
#endif /* X86 */
4445

45-
#define PREFIX "ACPI: "
46-
4746
int acpi_noirq; /* skip ACPI IRQ initialization */
4847
static int acpi_nobgrt; /* skip ACPI BGRT */
4948
int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */
@@ -130,15 +129,14 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
130129

131130
madt = (struct acpi_table_madt *)table;
132131
if (!madt) {
133-
printk(KERN_WARNING PREFIX "Unable to map MADT\n");
132+
pr_warn("Unable to map MADT\n");
134133
return -ENODEV;
135134
}
136135

137136
if (madt->address) {
138137
acpi_lapic_addr = (u64) madt->address;
139138

140-
printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
141-
madt->address);
139+
pr_debug("Local APIC address 0x%08x\n", madt->address);
142140
}
143141

144142
default_acpi_madt_oem_check(madt->header.oem_id,
@@ -161,7 +159,7 @@ static int acpi_register_lapic(int id, u32 acpiid, u8 enabled)
161159
int cpu;
162160

163161
if (id >= MAX_LOCAL_APIC) {
164-
printk(KERN_INFO PREFIX "skipped apicid that is too big\n");
162+
pr_info("skipped apicid that is too big\n");
165163
return -EINVAL;
166164
}
167165

@@ -213,13 +211,13 @@ acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
213211
*/
214212
if (!apic->apic_id_valid(apic_id)) {
215213
if (enabled)
216-
pr_warn(PREFIX "x2apic entry ignored\n");
214+
pr_warn("x2apic entry ignored\n");
217215
return 0;
218216
}
219217

220218
acpi_register_lapic(apic_id, processor->uid, enabled);
221219
#else
222-
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
220+
pr_warn("x2apic entry ignored\n");
223221
#endif
224222

225223
return 0;
@@ -306,7 +304,7 @@ acpi_parse_x2apic_nmi(union acpi_subtable_headers *header,
306304
acpi_table_print_madt_entry(&header->common);
307305

308306
if (x2apic_nmi->lint != 1)
309-
printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
307+
pr_warn("NMI not connected to LINT 1!\n");
310308

311309
return 0;
312310
}
@@ -324,7 +322,7 @@ acpi_parse_lapic_nmi(union acpi_subtable_headers * header, const unsigned long e
324322
acpi_table_print_madt_entry(&header->common);
325323

326324
if (lapic_nmi->lint != 1)
327-
printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
325+
pr_warn("NMI not connected to LINT 1!\n");
328326

329327
return 0;
330328
}
@@ -514,14 +512,14 @@ acpi_parse_int_src_ovr(union acpi_subtable_headers * header,
514512

515513
if (intsrc->source_irq == 0) {
516514
if (acpi_skip_timer_override) {
517-
printk(PREFIX "BIOS IRQ0 override ignored.\n");
515+
pr_warn("BIOS IRQ0 override ignored.\n");
518516
return 0;
519517
}
520518

521519
if ((intsrc->global_irq == 2) && acpi_fix_pin2_polarity
522520
&& (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
523521
intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK;
524-
printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
522+
pr_warn("BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
525523
}
526524
}
527525

@@ -597,7 +595,7 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
597595
if (old == new)
598596
return;
599597

600-
printk(PREFIX "setting ELCR to %04x (from %04x)\n", new, old);
598+
pr_warn("setting ELCR to %04x (from %04x)\n", new, old);
601599
outb(new, 0x4d0);
602600
outb(new >> 8, 0x4d1);
603601
}
@@ -754,7 +752,7 @@ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
754752

755753
cpu = acpi_register_lapic(physid, acpi_id, ACPI_MADT_ENABLED);
756754
if (cpu < 0) {
757-
pr_info(PREFIX "Unable to map lapic to logical cpu number\n");
755+
pr_info("Unable to map lapic to logical cpu number\n");
758756
return cpu;
759757
}
760758

@@ -870,8 +868,7 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
870868
struct acpi_table_hpet *hpet_tbl = (struct acpi_table_hpet *)table;
871869

872870
if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
873-
printk(KERN_WARNING PREFIX "HPET timers must be located in "
874-
"memory.\n");
871+
pr_warn("HPET timers must be located in memory.\n");
875872
return -1;
876873
}
877874

@@ -883,9 +880,7 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
883880
* want to allocate a resource there.
884881
*/
885882
if (!hpet_address) {
886-
printk(KERN_WARNING PREFIX
887-
"HPET id: %#x base: %#lx is invalid\n",
888-
hpet_tbl->id, hpet_address);
883+
pr_warn("HPET id: %#x base: %#lx is invalid\n", hpet_tbl->id, hpet_address);
889884
return 0;
890885
}
891886
#ifdef CONFIG_X86_64
@@ -896,21 +891,17 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
896891
*/
897892
if (hpet_address == 0xfed0000000000000UL) {
898893
if (!hpet_force_user) {
899-
printk(KERN_WARNING PREFIX "HPET id: %#x "
900-
"base: 0xfed0000000000000 is bogus\n "
901-
"try hpet=force on the kernel command line to "
902-
"fix it up to 0xfed00000.\n", hpet_tbl->id);
894+
pr_warn("HPET id: %#x base: 0xfed0000000000000 is bogus, try hpet=force on the kernel command line to fix it up to 0xfed00000.\n",
895+
hpet_tbl->id);
903896
hpet_address = 0;
904897
return 0;
905898
}
906-
printk(KERN_WARNING PREFIX
907-
"HPET id: %#x base: 0xfed0000000000000 fixed up "
908-
"to 0xfed00000.\n", hpet_tbl->id);
899+
pr_warn("HPET id: %#x base: 0xfed0000000000000 fixed up to 0xfed00000.\n",
900+
hpet_tbl->id);
909901
hpet_address >>= 32;
910902
}
911903
#endif
912-
printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
913-
hpet_tbl->id, hpet_address);
904+
pr_info("HPET id: %#x base: %#lx\n", hpet_tbl->id, hpet_address);
914905

915906
/*
916907
* Allocate and initialize the HPET firmware resource for adding into
@@ -955,24 +946,24 @@ late_initcall(hpet_insert_resource);
955946
static int __init acpi_parse_fadt(struct acpi_table_header *table)
956947
{
957948
if (!(acpi_gbl_FADT.boot_flags & ACPI_FADT_LEGACY_DEVICES)) {
958-
pr_debug("ACPI: no legacy devices present\n");
949+
pr_debug("no legacy devices present\n");
959950
x86_platform.legacy.devices.pnpbios = 0;
960951
}
961952

962953
if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
963954
!(acpi_gbl_FADT.boot_flags & ACPI_FADT_8042) &&
964955
x86_platform.legacy.i8042 != X86_LEGACY_I8042_PLATFORM_ABSENT) {
965-
pr_debug("ACPI: i8042 controller is absent\n");
956+
pr_debug("i8042 controller is absent\n");
966957
x86_platform.legacy.i8042 = X86_LEGACY_I8042_FIRMWARE_ABSENT;
967958
}
968959

969960
if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) {
970-
pr_debug("ACPI: not registering RTC platform device\n");
961+
pr_debug("not registering RTC platform device\n");
971962
x86_platform.legacy.rtc = 0;
972963
}
973964

974965
if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_VGA) {
975-
pr_debug("ACPI: probing for VGA not safe\n");
966+
pr_debug("probing for VGA not safe\n");
976967
x86_platform.legacy.no_vga = 1;
977968
}
978969

@@ -997,8 +988,7 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
997988
pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
998989
}
999990
if (pmtmr_ioport)
1000-
printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
1001-
pmtmr_ioport);
991+
pr_info("PM-Timer IO Port: %#x\n", pmtmr_ioport);
1002992
#endif
1003993
return 0;
1004994
}
@@ -1024,8 +1014,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
10241014
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
10251015
acpi_parse_lapic_addr_ovr, 0);
10261016
if (count < 0) {
1027-
printk(KERN_ERR PREFIX
1028-
"Error parsing LAPIC address override entry\n");
1017+
pr_err("Error parsing LAPIC address override entry\n");
10291018
return count;
10301019
}
10311020

@@ -1057,20 +1046,19 @@ static int __init acpi_parse_madt_lapic_entries(void)
10571046
sizeof(struct acpi_table_madt),
10581047
madt_proc, ARRAY_SIZE(madt_proc), MAX_LOCAL_APIC);
10591048
if (ret < 0) {
1060-
printk(KERN_ERR PREFIX
1061-
"Error parsing LAPIC/X2APIC entries\n");
1049+
pr_err("Error parsing LAPIC/X2APIC entries\n");
10621050
return ret;
10631051
}
10641052

10651053
count = madt_proc[0].count;
10661054
x2count = madt_proc[1].count;
10671055
}
10681056
if (!count && !x2count) {
1069-
printk(KERN_ERR PREFIX "No LAPIC entries present\n");
1057+
pr_err("No LAPIC entries present\n");
10701058
/* TBD: Cleanup to allow fallback to MPS */
10711059
return -ENODEV;
10721060
} else if (count < 0 || x2count < 0) {
1073-
printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
1061+
pr_err("Error parsing LAPIC entry\n");
10741062
/* TBD: Cleanup to allow fallback to MPS */
10751063
return count;
10761064
}
@@ -1080,7 +1068,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
10801068
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI,
10811069
acpi_parse_lapic_nmi, 0);
10821070
if (count < 0 || x2count < 0) {
1083-
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
1071+
pr_err("Error parsing LAPIC NMI entry\n");
10841072
/* TBD: Cleanup to allow fallback to MPS */
10851073
return count;
10861074
}
@@ -1139,7 +1127,7 @@ static void __init mp_config_acpi_legacy_irqs(void)
11391127
}
11401128

11411129
if (idx != mp_irq_entries) {
1142-
printk(KERN_DEBUG "ACPI: IRQ%d used by override.\n", i);
1130+
pr_debug("ACPI: IRQ%d used by override.\n", i);
11431131
continue; /* IRQ already used */
11441132
}
11451133

@@ -1179,26 +1167,24 @@ static int __init acpi_parse_madt_ioapic_entries(void)
11791167
* if "noapic" boot option, don't look for IO-APICs
11801168
*/
11811169
if (skip_ioapic_setup) {
1182-
printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
1183-
"due to 'noapic' option.\n");
1170+
pr_info("Skipping IOAPIC probe due to 'noapic' option.\n");
11841171
return -ENODEV;
11851172
}
11861173

11871174
count = acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
11881175
MAX_IO_APICS);
11891176
if (!count) {
1190-
printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
1177+
pr_err("No IOAPIC entries present\n");
11911178
return -ENODEV;
11921179
} else if (count < 0) {
1193-
printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
1180+
pr_err("Error parsing IOAPIC entry\n");
11941181
return count;
11951182
}
11961183

11971184
count = acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE,
11981185
acpi_parse_int_src_ovr, nr_irqs);
11991186
if (count < 0) {
1200-
printk(KERN_ERR PREFIX
1201-
"Error parsing interrupt source overrides entry\n");
1187+
pr_err("Error parsing interrupt source overrides entry\n");
12021188
/* TBD: Cleanup to allow fallback to MPS */
12031189
return count;
12041190
}
@@ -1218,7 +1204,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
12181204
count = acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE,
12191205
acpi_parse_nmi_src, nr_irqs);
12201206
if (count < 0) {
1221-
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
1207+
pr_err("Error parsing NMI SRC entry\n");
12221208
/* TBD: Cleanup to allow fallback to MPS */
12231209
return count;
12241210
}
@@ -1251,8 +1237,7 @@ static void __init early_acpi_process_madt(void)
12511237
/*
12521238
* Dell Precision Workstation 410, 610 come here.
12531239
*/
1254-
printk(KERN_ERR PREFIX
1255-
"Invalid BIOS MADT, disabling ACPI\n");
1240+
pr_err("Invalid BIOS MADT, disabling ACPI\n");
12561241
disable_acpi();
12571242
}
12581243
}
@@ -1289,8 +1274,7 @@ static void __init acpi_process_madt(void)
12891274
/*
12901275
* Dell Precision Workstation 410, 610 come here.
12911276
*/
1292-
printk(KERN_ERR PREFIX
1293-
"Invalid BIOS MADT, disabling ACPI\n");
1277+
pr_err("Invalid BIOS MADT, disabling ACPI\n");
12941278
disable_acpi();
12951279
}
12961280
} else {
@@ -1300,8 +1284,7 @@ static void __init acpi_process_madt(void)
13001284
* Boot with "acpi=off" to use MPS on such a system.
13011285
*/
13021286
if (smp_found_config) {
1303-
printk(KERN_WARNING PREFIX
1304-
"No APIC-table, disabling MPS\n");
1287+
pr_warn("No APIC-table, disabling MPS\n");
13051288
smp_found_config = 0;
13061289
}
13071290
}
@@ -1311,20 +1294,17 @@ static void __init acpi_process_madt(void)
13111294
* processors, where MPS only supports physical.
13121295
*/
13131296
if (acpi_lapic && acpi_ioapic)
1314-
printk(KERN_INFO "Using ACPI (MADT) for SMP configuration "
1315-
"information\n");
1297+
pr_info("Using ACPI (MADT) for SMP configuration information\n");
13161298
else if (acpi_lapic)
1317-
printk(KERN_INFO "Using ACPI for processor (LAPIC) "
1318-
"configuration information\n");
1299+
pr_info("Using ACPI for processor (LAPIC) configuration information\n");
13191300
#endif
13201301
return;
13211302
}
13221303

13231304
static int __init disable_acpi_irq(const struct dmi_system_id *d)
13241305
{
13251306
if (!acpi_force) {
1326-
printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
1327-
d->ident);
1307+
pr_notice("%s detected: force use of acpi=noirq\n", d->ident);
13281308
acpi_noirq_set();
13291309
}
13301310
return 0;
@@ -1333,8 +1313,7 @@ static int __init disable_acpi_irq(const struct dmi_system_id *d)
13331313
static int __init disable_acpi_pci(const struct dmi_system_id *d)
13341314
{
13351315
if (!acpi_force) {
1336-
printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
1337-
d->ident);
1316+
pr_notice("%s detected: force use of pci=noacpi\n", d->ident);
13381317
acpi_disable_pci();
13391318
}
13401319
return 0;
@@ -1343,11 +1322,10 @@ static int __init disable_acpi_pci(const struct dmi_system_id *d)
13431322
static int __init dmi_disable_acpi(const struct dmi_system_id *d)
13441323
{
13451324
if (!acpi_force) {
1346-
printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
1325+
pr_notice("%s detected: acpi off\n", d->ident);
13471326
disable_acpi();
13481327
} else {
1349-
printk(KERN_NOTICE
1350-
"Warning: DMI blacklist says broken, but acpi forced\n");
1328+
pr_notice("Warning: DMI blacklist says broken, but acpi forced\n");
13511329
}
13521330
return 0;
13531331
}
@@ -1574,9 +1552,9 @@ int __init early_acpi_boot_init(void)
15741552
*/
15751553
if (acpi_blacklisted()) {
15761554
if (acpi_force) {
1577-
printk(KERN_WARNING PREFIX "acpi=force override\n");
1555+
pr_warn("acpi=force override\n");
15781556
} else {
1579-
printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
1557+
pr_warn("Disabling ACPI support\n");
15801558
disable_acpi();
15811559
return 1;
15821560
}
@@ -1692,9 +1670,7 @@ int __init acpi_mps_check(void)
16921670
#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
16931671
/* mptable code is not built-in*/
16941672
if (acpi_disabled || acpi_noirq) {
1695-
printk(KERN_WARNING "MPS support code is not built-in.\n"
1696-
"Using acpi=off or acpi=noirq or pci=noacpi "
1697-
"may have problem\n");
1673+
pr_warn("MPS support code is not built-in, using acpi=off or acpi=noirq or pci=noacpi may have problem\n");
16981674
return 1;
16991675
}
17001676
#endif

0 commit comments

Comments
 (0)