ACPI / dock: avoid initializing acpi_dock_notifier_list multiple times

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>
This commit is contained in:
Jiang Liu 2013-06-29 00:24:34 +08:00 committed by Rafael J. Wysocki
parent ad81f0545e
commit f22ff5523a

View 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);