ACPI / dock: avoid initializing acpi_dock_notifier_list multiple times
authorJiang Liu <jiang.liu@huawei.com>
Fri, 28 Jun 2013 16:24:34 +0000 (00:24 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 14 Jul 2013 23:33:09 +0000 (01:33 +0200)
Function dock_add() will be called multiple times if there are
multiple dock stations, which causes acpi_dock_notifier_list to be
initialized multiple times.

To avoid that, move the initialization of acpi_dock_notifier_list
from dock_add() to acpi_dock_init().

[rjw: Changelog]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/dock.c

index 826560753389ca3f1d2dd1bc2670f15f059970ae..c36de862fd50459df204fabcc0e03a3f3b16a486 100644 (file)
@@ -1007,7 +1007,6 @@ static int __init dock_add(acpi_handle handle)
        mutex_init(&dock_station->hp_lock);
        spin_lock_init(&dock_station->dd_lock);
        INIT_LIST_HEAD(&dock_station->sibling);
-       ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
        INIT_LIST_HEAD(&dock_station->dependent_devices);
 
        /* we want the dock device to send uevents */
@@ -1078,6 +1077,7 @@ void __init acpi_dock_init(void)
                return;
        }
 
+       ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
        register_acpi_bus_notifier(&dock_acpi_notifier);
        pr_info(PREFIX "%s: %d docks/bays found\n",
                ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count);