Merge tag 'v3.10.55' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / acpi / scan.c
index 27da63061e11ae88c628242e0eed71fc0e1d7588..091682fb1617085ced673f304d0a4431e4b9f499 100644 (file)
@@ -237,13 +237,13 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
 
        mutex_lock(&acpi_scan_lock);
 
-       acpi_bus_get_device(handle, &device);
-       if (device) {
-               dev_warn(&device->dev, "Attempt to re-insert\n");
-               goto out;
+       if (ost_source != ACPI_NOTIFY_BUS_CHECK) {
+               acpi_bus_get_device(handle, &device);
+               if (device) {
+                       dev_warn(&device->dev, "Attempt to re-insert\n");
+                       goto out;
+               }
        }
-       acpi_evaluate_hotplug_ost(handle, ost_source,
-                                 ACPI_OST_SC_INSERT_IN_PROGRESS, NULL);
        error = acpi_bus_scan(handle);
        if (error) {
                acpi_handle_warn(handle, "Namespace scan failure\n");
@@ -769,12 +769,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data)
        device->driver->ops.notify(device, event);
 }
 
-static acpi_status acpi_device_notify_fixed(void *data)
+static void acpi_device_notify_fixed(void *data)
 {
        struct acpi_device *device = data;
 
        /* Fixed hardware devices have no handles */
        acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
+}
+
+static acpi_status acpi_device_fixed_event(void *data)
+{
+       acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data);
        return AE_OK;
 }
 
@@ -785,12 +790,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
        if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
                status =
                    acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
-                                                    acpi_device_notify_fixed,
+                                                    acpi_device_fixed_event,
                                                     device);
        else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
                status =
                    acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
-                                                    acpi_device_notify_fixed,
+                                                    acpi_device_fixed_event,
                                                     device);
        else
                status = acpi_install_notify_handler(device->handle,
@@ -807,10 +812,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
 {
        if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
                acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
-                                               acpi_device_notify_fixed);
+                                               acpi_device_fixed_event);
        else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
                acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
-                                               acpi_device_notify_fixed);
+                                               acpi_device_fixed_event);
        else
                acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
                                           acpi_device_notify);
@@ -1790,7 +1795,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
         */
        list_for_each_entry(hwid, &pnp.ids, list) {
                handler = acpi_scan_match_handler(hwid->id, NULL);
-               if (handler) {
+               if (handler && !handler->hotplug.ignore) {
                        acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
                                        acpi_hotplug_notify_cb, handler);
                        break;
@@ -1890,6 +1895,9 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
        if (acpi_bus_get_device(handle, &device))
                return AE_CTRL_DEPTH;
 
+       if (device->handler)
+               return AE_OK;
+
        ret = acpi_scan_attach_handler(device);
        if (ret)
                return ret > 0 ? AE_OK : AE_CTRL_DEPTH;
@@ -2040,6 +2048,7 @@ int __init acpi_scan_init(void)
        acpi_pci_link_init();
        acpi_platform_init();
        acpi_lpss_init();
+       acpi_cmos_rtc_init();
        acpi_container_init();
        acpi_memory_hotplug_init();
        acpi_dock_init();