提交 cd73018f 编写于 作者: T Toshi Kani 提交者: Rafael J. Wysocki

ACPI: Update Dock hotplug error messages

Updated Dock hotplug error messages with acpi_handle_<level>()
and pr_<level>().  Replaced acpi_get_name() & kfree() with
apci_handle_<level>().  Added error status to the messages where
needed.
Signed-off-by: NToshi Kani <toshi.kani@hp.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 3d78bd9e
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
...@@ -460,12 +461,8 @@ static void handle_dock(struct dock_station *ds, int dock) ...@@ -460,12 +461,8 @@ static void handle_dock(struct dock_station *ds, int dock)
struct acpi_object_list arg_list; struct acpi_object_list arg_list;
union acpi_object arg; union acpi_object arg;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_get_name(ds->handle, ACPI_FULL_PATHNAME, &name_buffer); acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking");
printk(KERN_INFO PREFIX "%s - %s\n",
(char *)name_buffer.pointer, dock ? "docking" : "undocking");
/* _DCK method has one argument */ /* _DCK method has one argument */
arg_list.count = 1; arg_list.count = 1;
...@@ -474,11 +471,10 @@ static void handle_dock(struct dock_station *ds, int dock) ...@@ -474,11 +471,10 @@ static void handle_dock(struct dock_station *ds, int dock)
arg.integer.value = dock; arg.integer.value = dock;
status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer); status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
ACPI_EXCEPTION((AE_INFO, status, "%s - failed to execute" acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n",
" _DCK\n", (char *)name_buffer.pointer)); status);
kfree(buffer.pointer); kfree(buffer.pointer);
kfree(name_buffer.pointer);
} }
static inline void dock(struct dock_station *ds) static inline void dock(struct dock_station *ds)
...@@ -525,9 +521,11 @@ static void dock_lock(struct dock_station *ds, int lock) ...@@ -525,9 +521,11 @@ static void dock_lock(struct dock_station *ds, int lock)
status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL); status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
if (lock) if (lock)
printk(KERN_WARNING PREFIX "Locking device failed\n"); acpi_handle_warn(ds->handle,
"Locking device failed (0x%x)\n", status);
else else
printk(KERN_WARNING PREFIX "Unlocking device failed\n"); acpi_handle_warn(ds->handle,
"Unlocking device failed (0x%x)\n", status);
} }
} }
...@@ -667,7 +665,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event) ...@@ -667,7 +665,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event)
dock_lock(ds, 0); dock_lock(ds, 0);
eject_dock(ds); eject_dock(ds);
if (dock_present(ds)) { if (dock_present(ds)) {
printk(KERN_ERR PREFIX "Unable to undock!\n"); acpi_handle_err(ds->handle, "Unable to undock!\n");
return -EBUSY; return -EBUSY;
} }
complete_undock(ds); complete_undock(ds);
...@@ -715,7 +713,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) ...@@ -715,7 +713,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data)
begin_dock(ds); begin_dock(ds);
dock(ds); dock(ds);
if (!dock_present(ds)) { if (!dock_present(ds)) {
printk(KERN_ERR PREFIX "Unable to dock!\n"); acpi_handle_err(handle, "Unable to dock!\n");
complete_dock(ds); complete_dock(ds);
break; break;
} }
...@@ -743,7 +741,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) ...@@ -743,7 +741,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data)
dock_event(ds, event, UNDOCK_EVENT); dock_event(ds, event, UNDOCK_EVENT);
break; break;
default: default:
printk(KERN_ERR PREFIX "Unknown dock event %d\n", event); acpi_handle_err(handle, "Unknown dock event %d\n", event);
} }
} }
...@@ -987,7 +985,7 @@ static int __init dock_add(acpi_handle handle) ...@@ -987,7 +985,7 @@ static int __init dock_add(acpi_handle handle)
sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group); sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group);
err_unregister: err_unregister:
platform_device_unregister(dd); platform_device_unregister(dd);
printk(KERN_ERR "%s encountered error %d\n", __func__, ret); acpi_handle_err(handle, "%s encountered error %d\n", __func__, ret);
return ret; return ret;
} }
...@@ -1043,12 +1041,12 @@ static int __init dock_init(void) ...@@ -1043,12 +1041,12 @@ static int __init dock_init(void)
ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL); ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL);
if (!dock_station_count) { if (!dock_station_count) {
printk(KERN_INFO PREFIX "No dock devices found.\n"); pr_info(PREFIX "No dock devices found.\n");
return 0; return 0;
} }
register_acpi_bus_notifier(&dock_acpi_notifier); register_acpi_bus_notifier(&dock_acpi_notifier);
printk(KERN_INFO PREFIX "%s: %d docks/bays found\n", pr_info(PREFIX "%s: %d docks/bays found\n",
ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count); ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册