aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2012-10-22 19:30:26 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-14 18:16:00 -0500
commit8ab0ab2570cfc48303e545944f53690a6983a898 (patch)
treeb9ba616dac343878d341a4bc24b5c854bf2ce055 /drivers/acpi
parenta3cd8d2789c2e265e09377f260e7d2ac9cec81bb (diff)
ACPI: dock: Remove redundant ACPI NS walk
Combined two ACPI namespace walks, which look for dock stations and then bays separately, into a single walk. Signed-off-by: Toshi Kani <toshi.kani@hp.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dock.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 88eb14304667..ae4ebf2d4cd2 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -1016,44 +1016,32 @@ static int dock_remove(struct dock_station *ds)
1016} 1016}
1017 1017
1018/** 1018/**
1019 * find_dock - look for a dock station 1019 * find_dock_and_bay - look for dock stations and bays
1020 * @handle: acpi handle of a device 1020 * @handle: acpi handle of a device
1021 * @lvl: unused 1021 * @lvl: unused
1022 * @context: counter of dock stations found 1022 * @context: unused
1023 * @rv: unused 1023 * @rv: unused
1024 * 1024 *
1025 * This is called by acpi_walk_namespace to look for dock stations. 1025 * This is called by acpi_walk_namespace to look for dock stations and bays.
1026 */ 1026 */
1027static __init acpi_status 1027static __init acpi_status
1028find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) 1028find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
1029{ 1029{
1030 if (is_dock(handle)) 1030 if (is_dock(handle) || is_ejectable_bay(handle))
1031 dock_add(handle); 1031 dock_add(handle);
1032 1032
1033 return AE_OK; 1033 return AE_OK;
1034} 1034}
1035 1035
1036static __init acpi_status
1037find_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
1038{
1039 /* If bay is a dock, it's already handled */
1040 if (is_ejectable_bay(handle) && !is_dock(handle))
1041 dock_add(handle);
1042 return AE_OK;
1043}
1044
1045static int __init dock_init(void) 1036static int __init dock_init(void)
1046{ 1037{
1047 if (acpi_disabled) 1038 if (acpi_disabled)
1048 return 0; 1039 return 0;
1049 1040
1050 /* look for a dock station */ 1041 /* look for dock stations and bays */
1051 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1042 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1052 ACPI_UINT32_MAX, find_dock, NULL, NULL, NULL); 1043 ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL);
1053 1044
1054 /* look for bay */
1055 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1056 ACPI_UINT32_MAX, find_bay, NULL, NULL, NULL);
1057 if (!dock_station_count) { 1045 if (!dock_station_count) {
1058 printk(KERN_INFO PREFIX "No dock devices found.\n"); 1046 printk(KERN_INFO PREFIX "No dock devices found.\n");
1059 return 0; 1047 return 0;