aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@huawei.com>2013-06-22 18:59:55 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-22 18:59:55 -0400
commit94add0f82469fa3c4ff978d03a34da90813c819d (patch)
tree467e9082ad2d979a216b3c0f4f0dbb15c7462b08 /drivers/acpi
parent9e895ace5d82df8929b16f58e9f515f6d54ab82d (diff)
ACPI / dock: Initialize ACPI dock subsystem upfront
Commit 3b63aaa70e1 (PCI: acpiphp: Do not use ACPI PCI subdriver mechanism) introduced an ACPI dock support regression, because it changed the relative initialization order of the ACPI dock subsystem and the ACPI-based PCI hotplug (acpiphp). Namely, the ACPI dock subsystem has to be initialized before acpiphp_enumerate_slots() is first run, which after commit 3b63aaa70e1 happens during the initial enumeration of the PCI hierarchy triggered by the initial ACPI namespace scan in acpi_scan_init(). For this reason, the dock subsystem has to be initialized before the initial ACPI namespace scan in acpi_scan_init(). To make that happen, modify the ACPI dock subsystem to be non-modular and add the invocation of its initialization routine, acpi_dock_init(), to acpi_scan_init() directly before the initial namespace scan. [rjw: Changelog, removal of dock_exit().] References: https://bugzilla.kernel.org/show_bug.cgi?id=59501 Reported-and-tested-by: Alexander E. Patrakov <patrakov@gmail.com> Tested-by: Illya Klymov <xanf@xanf.me> Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Cc: 3.9+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dock.c42
-rw-r--r--drivers/acpi/internal.h5
-rw-r--r--drivers/acpi/scan.c1
3 files changed, 7 insertions, 41 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index ec117c6c996c..c3b34f94382f 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -994,30 +994,6 @@ err_unregister:
994} 994}
995 995
996/** 996/**
997 * dock_remove - free up resources related to the dock station
998 */
999static int dock_remove(struct dock_station *ds)
1000{
1001 struct dock_dependent_device *dd, *tmp;
1002 struct platform_device *dock_device = ds->dock_device;
1003
1004 if (!dock_station_count)
1005 return 0;
1006
1007 /* remove dependent devices */
1008 list_for_each_entry_safe(dd, tmp, &ds->dependent_devices, list)
1009 kfree(dd);
1010
1011 list_del(&ds->sibling);
1012
1013 /* cleanup sysfs */
1014 sysfs_remove_group(&dock_device->dev.kobj, &dock_attribute_group);
1015 platform_device_unregister(dock_device);
1016
1017 return 0;
1018}
1019
1020/**
1021 * find_dock_and_bay - look for dock stations and bays 997 * find_dock_and_bay - look for dock stations and bays
1022 * @handle: acpi handle of a device 998 * @handle: acpi handle of a device
1023 * @lvl: unused 999 * @lvl: unused
@@ -1035,7 +1011,7 @@ find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
1035 return AE_OK; 1011 return AE_OK;
1036} 1012}
1037 1013
1038static int __init dock_init(void) 1014int __init acpi_dock_init(void)
1039{ 1015{
1040 if (acpi_disabled) 1016 if (acpi_disabled)
1041 return 0; 1017 return 0;
@@ -1054,19 +1030,3 @@ static int __init dock_init(void)
1054 ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count); 1030 ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count);
1055 return 0; 1031 return 0;
1056} 1032}
1057
1058static void __exit dock_exit(void)
1059{
1060 struct dock_station *tmp, *dock_station;
1061
1062 unregister_acpi_bus_notifier(&dock_acpi_notifier);
1063 list_for_each_entry_safe(dock_station, tmp, &dock_stations, sibling)
1064 dock_remove(dock_station);
1065}
1066
1067/*
1068 * Must be called before drivers of devices in dock, otherwise we can't know
1069 * which devices are in a dock
1070 */
1071subsys_initcall(dock_init);
1072module_exit(dock_exit);
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 297cbf456f86..c610a76d92c4 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -40,6 +40,11 @@ void acpi_container_init(void);
40#else 40#else
41static inline void acpi_container_init(void) {} 41static inline void acpi_container_init(void) {}
42#endif 42#endif
43#ifdef CONFIG_ACPI_DOCK
44void acpi_dock_init(void);
45#else
46static inline void acpi_dock_init(void) {}
47#endif
43#ifdef CONFIG_ACPI_HOTPLUG_MEMORY 48#ifdef CONFIG_ACPI_HOTPLUG_MEMORY
44void acpi_memory_hotplug_init(void); 49void acpi_memory_hotplug_init(void);
45#else 50#else
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index b14ac46948c9..27da63061e11 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2042,6 +2042,7 @@ int __init acpi_scan_init(void)
2042 acpi_lpss_init(); 2042 acpi_lpss_init();
2043 acpi_container_init(); 2043 acpi_container_init();
2044 acpi_memory_hotplug_init(); 2044 acpi_memory_hotplug_init();
2045 acpi_dock_init();
2045 2046
2046 mutex_lock(&acpi_scan_lock); 2047 mutex_lock(&acpi_scan_lock);
2047 /* 2048 /*