ACPI / tables: Replace printk with pr_*

This patch just does some cleanup to replace printk with pr_*,
and introduces pr_fmt() to remove all PREFIXs in tables.c,
no functional change.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Hanjun Guo 2014-02-20 15:45:33 +08:00 committed by Rafael J. Wysocki
parent cfbf8d4857
commit 730bf5ebb4

View file

@ -23,6 +23,8 @@
* *
*/ */
#define pr_fmt(fmt) "ACPI: " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/smp.h> #include <linux/smp.h>
@ -33,8 +35,6 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#define PREFIX "ACPI: "
#define ACPI_MAX_TABLES 128 #define ACPI_MAX_TABLES 128
static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
@ -55,10 +55,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_local_apic *p = struct acpi_madt_local_apic *p =
(struct acpi_madt_local_apic *)header; (struct acpi_madt_local_apic *)header;
printk(KERN_INFO PREFIX pr_info("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
"LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", p->processor_id, p->id,
p->processor_id, p->id, (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
} }
break; break;
@ -66,11 +65,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_local_x2apic *p = struct acpi_madt_local_x2apic *p =
(struct acpi_madt_local_x2apic *)header; (struct acpi_madt_local_x2apic *)header;
printk(KERN_INFO PREFIX pr_info("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
"X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n", p->local_apic_id, p->uid,
p->local_apic_id, p->uid, (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
(p->lapic_flags & ACPI_MADT_ENABLED) ?
"enabled" : "disabled");
} }
break; break;
@ -78,9 +75,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_io_apic *p = struct acpi_madt_io_apic *p =
(struct acpi_madt_io_apic *)header; (struct acpi_madt_io_apic *)header;
printk(KERN_INFO PREFIX pr_info("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
"IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", p->id, p->address, p->global_irq_base);
p->id, p->address, p->global_irq_base);
} }
break; break;
@ -88,18 +84,15 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_interrupt_override *p = struct acpi_madt_interrupt_override *p =
(struct acpi_madt_interrupt_override *)header; (struct acpi_madt_interrupt_override *)header;
printk(KERN_INFO PREFIX pr_info("INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
"INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", p->bus, p->source_irq, p->global_irq,
p->bus, p->source_irq, p->global_irq, mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]);
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]);
if (p->inti_flags & if (p->inti_flags &
~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK)) ~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK))
printk(KERN_INFO PREFIX pr_info("INT_SRC_OVR unexpected reserved flags: 0x%x\n",
"INT_SRC_OVR unexpected reserved flags: 0x%x\n", p->inti_flags &
p->inti_flags &
~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK)); ~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK));
} }
break; break;
@ -107,11 +100,10 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_nmi_source *p = struct acpi_madt_nmi_source *p =
(struct acpi_madt_nmi_source *)header; (struct acpi_madt_nmi_source *)header;
printk(KERN_INFO PREFIX pr_info("NMI_SRC (%s %s global_irq %d)\n",
"NMI_SRC (%s %s global_irq %d)\n", mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], p->global_irq);
p->global_irq);
} }
break; break;
@ -119,12 +111,11 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_local_apic_nmi *p = struct acpi_madt_local_apic_nmi *p =
(struct acpi_madt_local_apic_nmi *)header; (struct acpi_madt_local_apic_nmi *)header;
printk(KERN_INFO PREFIX pr_info("LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
"LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", p->processor_id,
p->processor_id, mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ],
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], p->lint);
p->lint);
} }
break; break;
@ -137,12 +128,11 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK; polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK;
trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2; trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
printk(KERN_INFO PREFIX pr_info("X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n",
"X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n", p->uid,
p->uid, mps_inti_flags_polarity[polarity],
mps_inti_flags_polarity[polarity], mps_inti_flags_trigger[trigger],
mps_inti_flags_trigger[trigger], p->lint);
p->lint);
} }
break; break;
@ -150,9 +140,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_local_apic_override *p = struct acpi_madt_local_apic_override *p =
(struct acpi_madt_local_apic_override *)header; (struct acpi_madt_local_apic_override *)header;
printk(KERN_INFO PREFIX pr_info("LAPIC_ADDR_OVR (address[%p])\n",
"LAPIC_ADDR_OVR (address[%p])\n", (void *)(unsigned long)p->address);
(void *)(unsigned long)p->address);
} }
break; break;
@ -160,10 +149,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_io_sapic *p = struct acpi_madt_io_sapic *p =
(struct acpi_madt_io_sapic *)header; (struct acpi_madt_io_sapic *)header;
printk(KERN_INFO PREFIX pr_info("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
"IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", p->id, (void *)(unsigned long)p->address,
p->id, (void *)(unsigned long)p->address, p->global_irq_base);
p->global_irq_base);
} }
break; break;
@ -171,10 +159,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_local_sapic *p = struct acpi_madt_local_sapic *p =
(struct acpi_madt_local_sapic *)header; (struct acpi_madt_local_sapic *)header;
printk(KERN_INFO PREFIX pr_info("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
"LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", p->processor_id, p->id, p->eid,
p->processor_id, p->id, p->eid, (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
} }
break; break;
@ -182,19 +169,17 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
{ {
struct acpi_madt_interrupt_source *p = struct acpi_madt_interrupt_source *p =
(struct acpi_madt_interrupt_source *)header; (struct acpi_madt_interrupt_source *)header;
printk(KERN_INFO PREFIX pr_info("PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
"PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], p->type, p->id, p->eid, p->io_sapic_vector,
p->type, p->id, p->eid, p->io_sapic_vector, p->global_irq);
p->global_irq);
} }
break; break;
default: default:
printk(KERN_WARNING PREFIX pr_warn("Found unsupported MADT entry (type = 0x%x)\n",
"Found unsupported MADT entry (type = 0x%x)\n", header->type);
header->type);
break; break;
} }
} }
@ -225,7 +210,7 @@ acpi_table_parse_entries(char *id,
acpi_get_table_with_size(id, 0, &table_header, &tbl_size); acpi_get_table_with_size(id, 0, &table_header, &tbl_size);
if (!table_header) { if (!table_header) {
printk(KERN_WARNING PREFIX "%4.4s not present\n", id); pr_warn("%4.4s not present\n", id);
return -ENODEV; return -ENODEV;
} }
@ -248,7 +233,7 @@ acpi_table_parse_entries(char *id,
* infinite loop. * infinite loop.
*/ */
if (entry->length == 0) { if (entry->length == 0) {
pr_err(PREFIX "[%4.4s:0x%02x] Invalid zero length\n", id, entry_id); pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, entry_id);
goto err; goto err;
} }
@ -256,8 +241,8 @@ acpi_table_parse_entries(char *id,
((unsigned long)entry + entry->length); ((unsigned long)entry + entry->length);
} }
if (max_entries && count > max_entries) { if (max_entries && count > max_entries) {
printk(KERN_WARNING PREFIX "[%4.4s:0x%02x] ignored %i entries of " pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n",
"%i found\n", id, entry_id, count - max_entries, count); id, entry_id, count - max_entries, count);
} }
early_acpi_os_unmap_memory((char *)table_header, tbl_size); early_acpi_os_unmap_memory((char *)table_header, tbl_size);
@ -322,13 +307,11 @@ static void __init check_multiple_madt(void)
acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size); acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size);
if (table) { if (table) {
printk(KERN_WARNING PREFIX pr_warn("BIOS bug: multiple APIC/MADT found, using %d\n",
"BIOS bug: multiple APIC/MADT found," acpi_apic_instance);
" using %d\n", acpi_apic_instance); pr_warn("If \"acpi_apic_instance=%d\" works better, "
printk(KERN_WARNING PREFIX "notify linux-acpi@vger.kernel.org\n",
"If \"acpi_apic_instance=%d\" works better, " acpi_apic_instance ? 0 : 2);
"notify linux-acpi@vger.kernel.org\n",
acpi_apic_instance ? 0 : 2);
early_acpi_os_unmap_memory(table, tbl_size); early_acpi_os_unmap_memory(table, tbl_size);
} else } else
@ -365,8 +348,7 @@ static int __init acpi_parse_apic_instance(char *str)
acpi_apic_instance = simple_strtoul(str, NULL, 0); acpi_apic_instance = simple_strtoul(str, NULL, 0);
printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n", pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance);
acpi_apic_instance);
return 0; return 0;
} }