]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Shaohua Li <shaohua.li@intel.com> |
2 | Subject: add _LCK support for dock | |
3 | Patch-mainline: submitted 2008-08-28 | |
4 | References: fate#304731,bnc#401740 | |
5 | ||
6 | support _LCK method, which is a optional method for hotplug | |
7 | ||
8 | Signed-off-by: Shaohua Li <shaohua.li@intel.com> | |
9 | Signed-off-by: Holger Macht <hmacht@suse.de> | |
10 | --- | |
11 | ||
12 | diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c | |
13 | index 78d27ce..7bdf93b 100644 | |
14 | --- a/drivers/acpi/dock.c | |
15 | +++ b/drivers/acpi/dock.c | |
16 | @@ -452,6 +452,25 @@ static inline void complete_undock(struct dock_station *ds) | |
17 | ds->flags &= ~(DOCK_UNDOCKING); | |
18 | } | |
19 | ||
20 | +static void dock_lock(struct dock_station *ds, int lock) | |
21 | +{ | |
22 | + struct acpi_object_list arg_list; | |
23 | + union acpi_object arg; | |
24 | + acpi_status status; | |
25 | + | |
26 | + arg_list.count = 1; | |
27 | + arg_list.pointer = &arg; | |
28 | + arg.type = ACPI_TYPE_INTEGER; | |
29 | + arg.integer.value = !!lock; | |
30 | + status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL); | |
31 | + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | |
32 | + if (lock) | |
33 | + printk(KERN_WARNING PREFIX "Locking device failed\n"); | |
34 | + else | |
35 | + printk(KERN_WARNING PREFIX "Unlocking device failed\n"); | |
36 | + } | |
37 | +} | |
38 | + | |
39 | /** | |
40 | * dock_in_progress - see if we are in the middle of handling a dock event | |
41 | * @ds: the dock station | |
42 | @@ -577,6 +596,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event) | |
43 | ||
44 | hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); | |
45 | undock(ds); | |
46 | + dock_lock(ds, 0); | |
47 | eject_dock(ds); | |
48 | if (dock_present(ds)) { | |
49 | printk(KERN_ERR PREFIX "Unable to undock!\n"); | |
50 | @@ -617,6 +637,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) | |
51 | hotplug_dock_devices(ds, event); | |
52 | complete_dock(ds); | |
53 | dock_event(ds, event, DOCK_EVENT); | |
54 | + dock_lock(ds, 1); | |
55 | } | |
56 | break; | |
57 | case ACPI_NOTIFY_DEVICE_CHECK: |