@@ -2013,6 +2013,49 @@ void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val)
2013
2013
mutex_unlock (& acpi_scan_lock );
2014
2014
}
2015
2015
2016
+ int acpi_scan_add_dep (acpi_handle handle , struct acpi_handle_list * dep_devices )
2017
+ {
2018
+ u32 count ;
2019
+ int i ;
2020
+
2021
+ for (count = 0 , i = 0 ; i < dep_devices -> count ; i ++ ) {
2022
+ struct acpi_device_info * info ;
2023
+ struct acpi_dep_data * dep ;
2024
+ bool skip , honor_dep ;
2025
+ acpi_status status ;
2026
+
2027
+ status = acpi_get_object_info (dep_devices -> handles [i ], & info );
2028
+ if (ACPI_FAILURE (status )) {
2029
+ acpi_handle_debug (handle , "Error reading _DEP device info\n" );
2030
+ continue ;
2031
+ }
2032
+
2033
+ skip = acpi_info_matches_ids (info , acpi_ignore_dep_ids );
2034
+ honor_dep = acpi_info_matches_ids (info , acpi_honor_dep_ids );
2035
+ kfree (info );
2036
+
2037
+ if (skip )
2038
+ continue ;
2039
+
2040
+ dep = kzalloc (sizeof (* dep ), GFP_KERNEL );
2041
+ if (!dep )
2042
+ continue ;
2043
+
2044
+ count ++ ;
2045
+
2046
+ dep -> supplier = dep_devices -> handles [i ];
2047
+ dep -> consumer = handle ;
2048
+ dep -> honor_dep = honor_dep ;
2049
+
2050
+ mutex_lock (& acpi_dep_list_lock );
2051
+ list_add_tail (& dep -> node , & acpi_dep_list );
2052
+ mutex_unlock (& acpi_dep_list_lock );
2053
+ }
2054
+
2055
+ acpi_handle_list_free (dep_devices );
2056
+ return count ;
2057
+ }
2058
+
2016
2059
static void acpi_scan_init_hotplug (struct acpi_device * adev )
2017
2060
{
2018
2061
struct acpi_hardware_id * hwid ;
@@ -2035,8 +2078,7 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev)
2035
2078
static u32 acpi_scan_check_dep (acpi_handle handle )
2036
2079
{
2037
2080
struct acpi_handle_list dep_devices ;
2038
- u32 count ;
2039
- int i ;
2081
+ u32 count = 0 ;
2040
2082
2041
2083
/*
2042
2084
* Check for _HID here to avoid deferring the enumeration of:
@@ -2045,48 +2087,14 @@ static u32 acpi_scan_check_dep(acpi_handle handle)
2045
2087
* Still, checking for _HID catches more then just these cases ...
2046
2088
*/
2047
2089
if (!acpi_has_method (handle , "_DEP" ) || !acpi_has_method (handle , "_HID" ))
2048
- return 0 ;
2090
+ return count ;
2049
2091
2050
2092
if (!acpi_evaluate_reference (handle , "_DEP" , NULL , & dep_devices )) {
2051
2093
acpi_handle_debug (handle , "Failed to evaluate _DEP.\n" );
2052
- return 0 ;
2053
- }
2054
-
2055
- for (count = 0 , i = 0 ; i < dep_devices .count ; i ++ ) {
2056
- struct acpi_device_info * info ;
2057
- struct acpi_dep_data * dep ;
2058
- bool skip , honor_dep ;
2059
- acpi_status status ;
2060
-
2061
- status = acpi_get_object_info (dep_devices .handles [i ], & info );
2062
- if (ACPI_FAILURE (status )) {
2063
- acpi_handle_debug (handle , "Error reading _DEP device info\n" );
2064
- continue ;
2065
- }
2066
-
2067
- skip = acpi_info_matches_ids (info , acpi_ignore_dep_ids );
2068
- honor_dep = acpi_info_matches_ids (info , acpi_honor_dep_ids );
2069
- kfree (info );
2070
-
2071
- if (skip )
2072
- continue ;
2073
-
2074
- dep = kzalloc (sizeof (* dep ), GFP_KERNEL );
2075
- if (!dep )
2076
- continue ;
2077
-
2078
- count ++ ;
2079
-
2080
- dep -> supplier = dep_devices .handles [i ];
2081
- dep -> consumer = handle ;
2082
- dep -> honor_dep = honor_dep ;
2083
-
2084
- mutex_lock (& acpi_dep_list_lock );
2085
- list_add_tail (& dep -> node , & acpi_dep_list );
2086
- mutex_unlock (& acpi_dep_list_lock );
2094
+ return count ;
2087
2095
}
2088
2096
2089
- acpi_handle_list_free ( & dep_devices );
2097
+ count += acpi_scan_add_dep ( handle , & dep_devices );
2090
2098
return count ;
2091
2099
}
2092
2100
0 commit comments