ACPI: update ej_event interface to take acpi_device
authorYinghai Lu <yinghai@kernel.org>
Fri, 11 Jan 2013 22:40:41 +0000 (22:40 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 15 Jan 2013 12:24:59 +0000 (13:24 +0100)
Should use acpi_device pointer directly instead of use handle and
get the device pointer again later.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpi_memhotplug.c
drivers/acpi/processor_driver.c
drivers/acpi/scan.c
include/acpi/acpi_bus.h

index 327ab4459558f78c8e1e1c39e03d6b0aea7f0629..eaddb7a89c70d93a4bd47c2f7f038c8c9326d4f8 100644 (file)
@@ -361,7 +361,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
                        break;
                }
 
-               ej_event->handle = handle;
+               ej_event->device = device;
                ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
                acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
                                        (void *)ej_event);
index 0777663f443ed6a5372c983ed4ebcdfe40547354..a24ee43e06e4073e1d96ab4482419d8c3957695e 100644 (file)
@@ -733,7 +733,7 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
                        break;
                }
 
-               ej_event->handle = handle;
+               ej_event->device = device;
                ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
                acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
                                        (void *)ej_event);
index d04d0b33656cac6ab23bedae2d024b5558b972f3..388b59c096dcfda934c99c33a482f902fb785294 100644 (file)
@@ -116,20 +116,14 @@ static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
 void acpi_bus_hot_remove_device(void *context)
 {
        struct acpi_eject_event *ej_event = (struct acpi_eject_event *) context;
-       struct acpi_device *device;
-       acpi_handle handle = ej_event->handle;
+       struct acpi_device *device = ej_event->device;
+       acpi_handle handle = device->handle;
        acpi_handle temp;
        struct acpi_object_list arg_list;
        union acpi_object arg;
        acpi_status status = AE_OK;
        u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
 
-       if (acpi_bus_get_device(handle, &device))
-               goto err_out;
-
-       if (!device)
-               goto err_out;
-
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                "Hot-removing device %s...\n", dev_name(&device->dev)));
 
@@ -215,7 +209,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
                goto err;
        }
 
-       ej_event->handle = acpi_device->handle;
+       ej_event->device = acpi_device;
        if (acpi_device->flags.eject_pending) {
                /* event originated from ACPI eject notification */
                ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
@@ -223,7 +217,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
        } else {
                /* event originated from user */
                ej_event->event = ACPI_OST_EC_OSPM_EJECT;
-               (void) acpi_evaluate_hotplug_ost(ej_event->handle,
+               (void) acpi_evaluate_hotplug_ost(acpi_device->handle,
                        ej_event->event, ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
        }
 
index 566f1fdabbd22a67ae4862220b8b644d3b217541..567851b4f04309b3f23aed40b11af65b31e5ce86 100644 (file)
@@ -306,7 +306,7 @@ struct acpi_bus_event {
 };
 
 struct acpi_eject_event {
-       acpi_handle     handle;
+       struct acpi_device      *device;
        u32             event;
 };