WMI: use pr_err() and friends

This makes source more concise and easier to read.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
This commit is contained in:
Dmitry Torokhov 2010-08-26 00:15:19 -07:00 committed by Matthew Garrett
parent 762e1a2ff6
commit 8e07514db8
1 changed files with 29 additions and 35 deletions

View File

@ -27,6 +27,8 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
@ -44,8 +46,6 @@ MODULE_LICENSE("GPL");
#define ACPI_WMI_CLASS "wmi" #define ACPI_WMI_CLASS "wmi"
#define PREFIX "ACPI: WMI: "
static DEFINE_MUTEX(wmi_data_lock); static DEFINE_MUTEX(wmi_data_lock);
static LIST_HEAD(wmi_block_list); static LIST_HEAD(wmi_block_list);
@ -480,25 +480,24 @@ static void wmi_dump_wdg(const struct guid_block *g)
char guid_string[37]; char guid_string[37];
wmi_gtoa(g->guid, guid_string); wmi_gtoa(g->guid, guid_string);
printk(KERN_INFO PREFIX "%s:\n", guid_string);
printk(KERN_INFO PREFIX "\tobject_id: %c%c\n", pr_info("%s:\n", guid_string);
g->object_id[0], g->object_id[1]); pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]);
printk(KERN_INFO PREFIX "\tnotify_id: %02X\n", g->notify_id); pr_info("\tnotify_id: %02X\n", g->notify_id);
printk(KERN_INFO PREFIX "\treserved: %02X\n", g->reserved); pr_info("\treserved: %02X\n", g->reserved);
printk(KERN_INFO PREFIX "\tinstance_count: %d\n", g->instance_count); pr_info("\tinstance_count: %d\n", g->instance_count);
printk(KERN_INFO PREFIX "\tflags: %#x", g->flags); pr_info("\tflags: %#x ", g->flags);
if (g->flags) { if (g->flags) {
printk(" ");
if (g->flags & ACPI_WMI_EXPENSIVE) if (g->flags & ACPI_WMI_EXPENSIVE)
printk("ACPI_WMI_EXPENSIVE "); pr_cont("ACPI_WMI_EXPENSIVE ");
if (g->flags & ACPI_WMI_METHOD) if (g->flags & ACPI_WMI_METHOD)
printk("ACPI_WMI_METHOD "); pr_cont("ACPI_WMI_METHOD ");
if (g->flags & ACPI_WMI_STRING) if (g->flags & ACPI_WMI_STRING)
printk("ACPI_WMI_STRING "); pr_cont("ACPI_WMI_STRING ");
if (g->flags & ACPI_WMI_EVENT) if (g->flags & ACPI_WMI_EVENT)
printk("ACPI_WMI_EVENT "); pr_cont("ACPI_WMI_EVENT ");
} }
printk("\n"); pr_cont("\n");
} }
@ -510,7 +509,7 @@ static void wmi_notify_debug(u32 value, void *context)
status = wmi_get_event_data(value, &response); status = wmi_get_event_data(value, &response);
if (status != AE_OK) { if (status != AE_OK) {
printk(KERN_INFO "wmi: bad event status 0x%x\n", status); pr_info("bad event status 0x%x\n", status);
return; return;
} }
@ -519,22 +518,22 @@ static void wmi_notify_debug(u32 value, void *context)
if (!obj) if (!obj)
return; return;
printk(KERN_INFO PREFIX "DEBUG Event "); pr_info("DEBUG Event ");
switch(obj->type) { switch(obj->type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
printk("BUFFER_TYPE - length %d\n", obj->buffer.length); pr_cont("BUFFER_TYPE - length %d\n", obj->buffer.length);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
printk("STRING_TYPE - %s\n", obj->string.pointer); pr_cont("STRING_TYPE - %s\n", obj->string.pointer);
break; break;
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
printk("INTEGER_TYPE - %llu\n", obj->integer.value); pr_cont("INTEGER_TYPE - %llu\n", obj->integer.value);
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
printk("PACKAGE_TYPE - %d elements\n", obj->package.count); pr_cont("PACKAGE_TYPE - %d elements\n", obj->package.count);
break; break;
default: default:
printk("object type 0x%X\n", obj->type); pr_cont("object type 0x%X\n", obj->type);
} }
kfree(obj); kfree(obj);
} }
@ -845,8 +844,7 @@ static acpi_status parse_wdg(acpi_handle handle)
*/ */
if (guid_already_parsed(gblock[i].guid) == true) { if (guid_already_parsed(gblock[i].guid) == true) {
wmi_gtoa(gblock[i].guid, guid_string); wmi_gtoa(gblock[i].guid, guid_string);
printk(KERN_INFO PREFIX "Skipping duplicate GUID %s\n", pr_info("Skipping duplicate GUID %s\n", guid_string);
guid_string);
continue; continue;
} }
if (debug_dump_wdg) if (debug_dump_wdg)
@ -937,8 +935,7 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
wblock->handler(event, wblock->handler_data); wblock->handler(event, wblock->handler_data);
if (debug_event) { if (debug_event) {
wmi_gtoa(wblock->gblock.guid, guid_string); wmi_gtoa(wblock->gblock.guid, guid_string);
printk(KERN_INFO PREFIX "DEBUG Event GUID:" pr_info("DEBUG Event GUID: %s\n", guid_string);
" %s\n", guid_string);
} }
acpi_bus_generate_netlink_event( acpi_bus_generate_netlink_event(
@ -967,7 +964,7 @@ static int acpi_wmi_add(struct acpi_device *device)
&acpi_wmi_ec_space_handler, &acpi_wmi_ec_space_handler,
NULL, NULL); NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Error installing EC region handler\n"); pr_err("Error installing EC region handler\n");
return -ENODEV; return -ENODEV;
} }
@ -976,7 +973,7 @@ static int acpi_wmi_add(struct acpi_device *device)
acpi_remove_address_space_handler(device->handle, acpi_remove_address_space_handler(device->handle,
ACPI_ADR_SPACE_EC, ACPI_ADR_SPACE_EC,
&acpi_wmi_ec_space_handler); &acpi_wmi_ec_space_handler);
printk(KERN_ERR PREFIX "Failed to parse WDG method\n"); pr_err("Failed to parse WDG method\n");
return -ENODEV; return -ENODEV;
} }
@ -991,9 +988,8 @@ static int __init acpi_wmi_init(void)
return -ENODEV; return -ENODEV;
result = acpi_bus_register_driver(&acpi_wmi_driver); result = acpi_bus_register_driver(&acpi_wmi_driver);
if (result < 0) { if (result < 0) {
printk(KERN_INFO PREFIX "Error loading mapper\n"); pr_err("Error loading mapper\n");
return -ENODEV; return -ENODEV;
} }
@ -1003,20 +999,18 @@ static int __init acpi_wmi_init(void)
return result; return result;
} }
printk(KERN_INFO PREFIX "Mapper loaded\n"); pr_info("Mapper loaded\n");
return result; return 0;
} }
static void __exit acpi_wmi_exit(void) static void __exit acpi_wmi_exit(void)
{ {
wmi_class_exit(); wmi_class_exit();
acpi_bus_unregister_driver(&acpi_wmi_driver); acpi_bus_unregister_driver(&acpi_wmi_driver);
free_wmi_blocks(); free_wmi_blocks();
printk(KERN_INFO PREFIX "Mapper unloaded\n"); pr_info("Mapper unloaded\n");
} }
subsys_initcall(acpi_wmi_init); subsys_initcall(acpi_wmi_init);