linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/11]add _LCK support for dock
@ 2008-08-27  3:14 Shaohua Li
  2008-08-27 23:09 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2008-08-27  3:14 UTC (permalink / raw)
  To: linux acpi
  Cc: Len Brown, Andi Kleen, Henrique de Moraes Holschuh, Holger Macht,
	mjg59, Tejun Heo

support _LCK method, which is a optional method for hotplug

Signed-off-by: Shaohua Li <shaohua.li@intel.com> 
---
 drivers/acpi/dock.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Index: linux/drivers/acpi/dock.c
===================================================================
--- linux.orig/drivers/acpi/dock.c	2008-08-27 10:20:08.000000000 +0800
+++ linux/drivers/acpi/dock.c	2008-08-27 10:22:05.000000000 +0800
@@ -452,6 +452,22 @@ static inline void complete_undock(struc
 	ds->flags &= ~(DOCK_UNDOCKING);
 }
 
+static void dock_lock(struct dock_station *ds, int lock)
+{
+	struct acpi_object_list arg_list;
+	union acpi_object arg;
+	acpi_status status;
+
+	arg_list.count = 1;
+	arg_list.pointer = &arg;
+	arg.type = ACPI_TYPE_INTEGER;
+	arg.integer.value = !!lock;
+	status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
+		printk(KERN_WARNING PREFIX "%s device failed\n",
+			lock ? "Locking" : "Unlocking");
+}
+
 /**
  * dock_in_progress - see if we are in the middle of handling a dock event
  * @ds: the dock station
@@ -577,6 +593,7 @@ static int handle_eject_request(struct d
 
 	hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST);
 	undock(ds);
+	dock_lock(ds, 0);
 	eject_dock(ds);
 	if (dock_present(ds)) {
 		printk(KERN_ERR PREFIX "Unable to undock!\n");
@@ -616,6 +633,7 @@ static void dock_notify(acpi_handle hand
 			hotplug_dock_devices(ds, event);
 			complete_dock(ds);
 			dock_event(ds, event, DOCK_EVENT);
+			dock_lock(ds, 1);
 		}
 		break;
 	case ACPI_NOTIFY_DEVICE_CHECK:


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 3/11]add _LCK support for dock
  2008-08-27  3:14 [patch 3/11]add _LCK support for dock Shaohua Li
@ 2008-08-27 23:09 ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2008-08-27 23:09 UTC (permalink / raw)
  To: Shaohua Li
  Cc: linux acpi, Len Brown, Henrique de Moraes Holschuh, Holger Macht,
	mjg59, Tejun Heo

Shaohua Li <shaohua.li@intel.com> writes:

> +static void dock_lock(struct dock_station *ds, int lock)
> +{
> +	struct acpi_object_list arg_list;
> +	union acpi_object arg;
> +	acpi_status status;
> +
> +	arg_list.count = 1;
> +	arg_list.pointer = &arg;
> +	arg.type = ACPI_TYPE_INTEGER;
> +	arg.integer.value = !!lock;
> +	status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL);
> +	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
> +		printk(KERN_WARNING PREFIX "%s device failed\n",
> +			lock ? "Locking" : "Unlocking");

Please use two printks -- that makes the error message greppable.
Output the status and some identifier for the device? Otherwise
the user will have no clue what device failed.

-Andi

-- 
ak@linux.intel.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [patch 3/11]add _LCK support for dock
@ 2008-08-28  2:03 Shaohua Li
  0 siblings, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2008-08-28  2:03 UTC (permalink / raw)
  To: linux acpi
  Cc: Len Brown, Andi Kleen, Henrique de Moraes Holschuh, Holger Macht,
	mjg59, Tejun Heo

support _LCK method, which is a optional method for hotplug

Signed-off-by: Shaohua Li <shaohua.li@intel.com> 
---
 drivers/acpi/dock.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Index: linux/drivers/acpi/dock.c
===================================================================
--- linux.orig/drivers/acpi/dock.c	2008-08-28 09:35:51.000000000 +0800
+++ linux/drivers/acpi/dock.c	2008-08-28 09:40:00.000000000 +0800
@@ -452,6 +452,25 @@ static inline void complete_undock(struc
 	ds->flags &= ~(DOCK_UNDOCKING);
 }
 
+static void dock_lock(struct dock_station *ds, int lock)
+{
+	struct acpi_object_list arg_list;
+	union acpi_object arg;
+	acpi_status status;
+
+	arg_list.count = 1;
+	arg_list.pointer = &arg;
+	arg.type = ACPI_TYPE_INTEGER;
+	arg.integer.value = !!lock;
+	status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		if (lock)
+			printk(KERN_WARNING PREFIX "Locking device failed\n");
+		else
+			printk(KERN_WARNING PREFIX "Unlocking device failed\n");
+	}
+}
+
 /**
  * dock_in_progress - see if we are in the middle of handling a dock event
  * @ds: the dock station
@@ -577,6 +596,7 @@ static int handle_eject_request(struct d
 
 	hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST);
 	undock(ds);
+	dock_lock(ds, 0);
 	eject_dock(ds);
 	if (dock_present(ds)) {
 		printk(KERN_ERR PREFIX "Unable to undock!\n");
@@ -617,6 +637,7 @@ static void dock_notify(acpi_handle hand
 			hotplug_dock_devices(ds, event);
 			complete_dock(ds);
 			dock_event(ds, event, DOCK_EVENT);
+			dock_lock(ds, 1);
 		}
 		break;
 	case ACPI_NOTIFY_DEVICE_CHECK:



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-28  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-27  3:14 [patch 3/11]add _LCK support for dock Shaohua Li
2008-08-27 23:09 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2008-08-28  2:03 Shaohua Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).