Merge back earlier 'acpi-assorted' material
[firefly-linux-kernel-4.4.55.git] / drivers / acpi / scan.c
index 4b2679342e8260b56cb825e36fb457e22c7a2acd..7d9e285da4526bee132d3589a8fe5666b62fcbe4 100644 (file)
@@ -352,10 +352,12 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
        mutex_lock(&acpi_scan_lock);
        lock_device_hotplug();
 
-       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);
@@ -1995,6 +1997,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;