[PATCH v2 1/9] ACPI, DOCK: avoid initializing acpi_dock_notifier_list multiple times

From: Jiang Liu
Date: Wed Jun 26 2013 - 12:33:49 EST


From: Jiang Liu <jiang.liu@xxxxxxxxxx>

Function dock_add() will be called multiple times if there are multiple
dock stations, which causes acpi_dock_notifier_list being initialized
multiple times. So move initialization of acpi_dock_notifier_list from
dock_add() to acpi_dock_init().

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxx>
Cc: Len Brown <lenb@xxxxxxxxxx>
Cc: "Rafael J. Wysocki" <rjw@xxxxxxx>
Cc: linux-acpi@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
drivers/acpi/dock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 14de9f4..e944e39 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -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 @@ int __init acpi_dock_init(void)
return 0;
}

+ 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);
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/