* [PATCH] ACPI : Implement ACPI_NOTIFY_EJECT_REQUEST for ACPI container
@ 2012-06-05 6:26 Yasuaki Ishimatsu
2012-06-12 5:33 ` Yasuaki Ishimatsu
0 siblings, 1 reply; 2+ messages in thread
From: Yasuaki Ishimatsu @ 2012-06-05 6:26 UTC (permalink / raw)
To: lenb, linux-acpi, linux-kernel
Even if ACPI_NOTIFY_EJECT_REQUEST is notified to ACPI container, ACPI
container just calls kobject_uevent(). The patch implements a function
to remove all devices included in ACPI container.
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
drivers/acpi/container.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
Index: linux-3.5-rc1/drivers/acpi/container.c
===================================================================
--- linux-3.5-rc1.orig/drivers/acpi/container.c 2012-06-05 14:01:54.000000000 +0900
+++ linux-3.5-rc1/drivers/acpi/container.c 2012-06-05 14:17:40.940836226 +0900
@@ -123,6 +123,8 @@ static int acpi_container_remove(struct
acpi_status status = AE_OK;
struct acpi_container *pc = NULL;
+ kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
+
pc = acpi_driver_data(device);
kfree(pc);
return status;
@@ -152,6 +154,32 @@ static int container_device_add(struct a
return result;
}
+static void container_device_remove(struct acpi_device *device,
+ acpi_handle handle)
+{
+ struct acpi_object_list arg_list;
+ union acpi_object arg;
+ int result;
+ acpi_status status;
+
+ result = acpi_bus_trim(device, 1);
+ if (result) {
+ printk(KERN_WARNING "Removing contaier failed");
+ return;
+ }
+
+ arg_list.count = 1;
+ arg_list.pointer = &arg;
+ arg.type = ACPI_TYPE_INTEGER;
+ arg.integer.value = 1;
+
+ status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
+ if (ACPI_FAILURE(status))
+ printk(KERN_WARNING "Eject device failed\n");
+
+ return;
+}
+
static void container_notify_cb(acpi_handle handle, u32 type, void *context)
{
struct acpi_device *device = NULL;
@@ -183,13 +211,13 @@ static void container_notify_cb(acpi_han
} else {
if (ACPI_SUCCESS(status)) {
/* device exist and this is a remove request */
- kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
+ container_device_remove(device, handle);
}
}
break;
case ACPI_NOTIFY_EJECT_REQUEST:
if (!acpi_bus_get_device(handle, &device) && device) {
- kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
+ container_device_remove(device, handle);
}
break;
default:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI : Implement ACPI_NOTIFY_EJECT_REQUEST for ACPI container
2012-06-05 6:26 [PATCH] ACPI : Implement ACPI_NOTIFY_EJECT_REQUEST for ACPI container Yasuaki Ishimatsu
@ 2012-06-12 5:33 ` Yasuaki Ishimatsu
0 siblings, 0 replies; 2+ messages in thread
From: Yasuaki Ishimatsu @ 2012-06-12 5:33 UTC (permalink / raw)
To: lenb, linux-acpi, linux-kernel
Please ignore the patch.
I found that ACPI container driver does not need to implement EJECT routine
because it has already prepared eject file at userland.
2012/06/05 15:26, Yasuaki Ishimatsu wrote:
> Even if ACPI_NOTIFY_EJECT_REQUEST is notified to ACPI container, ACPI
> container just calls kobject_uevent(). The patch implements a function
> to remove all devices included in ACPI container.
>
> Signed-off-by: Yasuaki Ishimatsu<isimatu.yasuaki@jp.fujitsu.com>
>
> ---
> drivers/acpi/container.c | 32 ++++++++++++++++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
>
> Index: linux-3.5-rc1/drivers/acpi/container.c
> ===================================================================
> --- linux-3.5-rc1.orig/drivers/acpi/container.c 2012-06-05 14:01:54.000000000 +0900
> +++ linux-3.5-rc1/drivers/acpi/container.c 2012-06-05 14:17:40.940836226 +0900
> @@ -123,6 +123,8 @@ static int acpi_container_remove(struct
> acpi_status status = AE_OK;
> struct acpi_container *pc = NULL;
>
> + kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
> +
> pc = acpi_driver_data(device);
> kfree(pc);
> return status;
> @@ -152,6 +154,32 @@ static int container_device_add(struct a
> return result;
> }
>
> +static void container_device_remove(struct acpi_device *device,
> + acpi_handle handle)
> +{
> + struct acpi_object_list arg_list;
> + union acpi_object arg;
> + int result;
> + acpi_status status;
> +
> + result = acpi_bus_trim(device, 1);
> + if (result) {
> + printk(KERN_WARNING "Removing contaier failed");
> + return;
> + }
> +
> + arg_list.count = 1;
> + arg_list.pointer =&arg;
> + arg.type = ACPI_TYPE_INTEGER;
> + arg.integer.value = 1;
> +
> + status = acpi_evaluate_object(handle, "_EJ0",&arg_list, NULL);
> + if (ACPI_FAILURE(status))
> + printk(KERN_WARNING "Eject device failed\n");
> +
> + return;
> +}
> +
> static void container_notify_cb(acpi_handle handle, u32 type, void *context)
> {
> struct acpi_device *device = NULL;
> @@ -183,13 +211,13 @@ static void container_notify_cb(acpi_han
> } else {
> if (ACPI_SUCCESS(status)) {
> /* device exist and this is a remove request */
> - kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
> + container_device_remove(device, handle);
> }
> }
> break;
> case ACPI_NOTIFY_EJECT_REQUEST:
> if (!acpi_bus_get_device(handle,&device)&& device) {
> - kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
> + container_device_remove(device, handle);
> }
> break;
> default:
>
> --
> 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] 2+ messages in thread
end of thread, other threads:[~2012-06-12 5:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 6:26 [PATCH] ACPI : Implement ACPI_NOTIFY_EJECT_REQUEST for ACPI container Yasuaki Ishimatsu
2012-06-12 5:33 ` Yasuaki Ishimatsu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.