aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dock.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r--drivers/acpi/dock.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 05ea4be01a83..dcd73ccb514c 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -441,7 +441,7 @@ static void handle_dock(struct dock_station *ds, int dock)
441 acpi_status status; 441 acpi_status status;
442 struct acpi_object_list arg_list; 442 struct acpi_object_list arg_list;
443 union acpi_object arg; 443 union acpi_object arg;
444 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 444 unsigned long long value;
445 445
446 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking"); 446 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking");
447 447
@@ -450,12 +450,10 @@ static void handle_dock(struct dock_station *ds, int dock)
450 arg_list.pointer = &arg; 450 arg_list.pointer = &arg;
451 arg.type = ACPI_TYPE_INTEGER; 451 arg.type = ACPI_TYPE_INTEGER;
452 arg.integer.value = dock; 452 arg.integer.value = dock;
453 status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer); 453 status = acpi_evaluate_integer(ds->handle, "_DCK", &arg_list, &value);
454 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) 454 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
455 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n", 455 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n",
456 status); 456 status);
457
458 kfree(buffer.pointer);
459} 457}
460 458
461static inline void dock(struct dock_station *ds) 459static inline void dock(struct dock_station *ds)
@@ -671,39 +669,20 @@ static void dock_notify(struct dock_station *ds, u32 event)
671 } 669 }
672} 670}
673 671
674struct dock_data { 672static void acpi_dock_deferred_cb(void *data, u32 event)
675 struct dock_station *ds;
676 u32 event;
677};
678
679static void acpi_dock_deferred_cb(void *context)
680{ 673{
681 struct dock_data *data = context;
682
683 acpi_scan_lock_acquire(); 674 acpi_scan_lock_acquire();
684 dock_notify(data->ds, data->event); 675 dock_notify(data, event);
685 acpi_scan_lock_release(); 676 acpi_scan_lock_release();
686 kfree(data);
687} 677}
688 678
689static void dock_notify_handler(acpi_handle handle, u32 event, void *data) 679static void dock_notify_handler(acpi_handle handle, u32 event, void *data)
690{ 680{
691 struct dock_data *dd;
692
693 if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK 681 if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK
694 && event != ACPI_NOTIFY_EJECT_REQUEST) 682 && event != ACPI_NOTIFY_EJECT_REQUEST)
695 return; 683 return;
696 684
697 dd = kmalloc(sizeof(*dd), GFP_KERNEL); 685 acpi_hotplug_execute(acpi_dock_deferred_cb, data, event);
698 if (dd) {
699 acpi_status status;
700
701 dd->ds = data;
702 dd->event = event;
703 status = acpi_os_hotplug_execute(acpi_dock_deferred_cb, dd);
704 if (ACPI_FAILURE(status))
705 kfree(dd);
706 }
707} 686}
708 687
709/** 688/**