diff options
Diffstat (limited to 'drivers/acpi/hardware')
-rw-r--r-- | drivers/acpi/hardware/hwregs.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index ec9f5a11a8b3..5a3aa8dd8cb7 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -127,8 +127,7 @@ acpi_status | |||
127 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | 127 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) |
128 | { | 128 | { |
129 | acpi_status status = AE_OK; | 129 | acpi_status status = AE_OK; |
130 | struct acpi_parameter_info info; | 130 | struct acpi_evaluate_info *info; |
131 | char *sleep_state_name; | ||
132 | 131 | ||
133 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); | 132 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); |
134 | 133 | ||
@@ -138,34 +137,39 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
138 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 137 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
139 | } | 138 | } |
140 | 139 | ||
141 | /* Evaluate the namespace object containing the values for this state */ | 140 | /* Allocate the evaluation information block */ |
141 | |||
142 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
143 | if (!info) { | ||
144 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
145 | } | ||
142 | 146 | ||
143 | info.parameters = NULL; | 147 | info->pathname = |
144 | info.return_object = NULL; | ||
145 | sleep_state_name = | ||
146 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | 148 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); |
147 | 149 | ||
148 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); | 150 | /* Evaluate the namespace object containing the values for this state */ |
151 | |||
152 | status = acpi_ns_evaluate(info); | ||
149 | if (ACPI_FAILURE(status)) { | 153 | if (ACPI_FAILURE(status)) { |
150 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 154 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
151 | "%s while evaluating SleepState [%s]\n", | 155 | "%s while evaluating SleepState [%s]\n", |
152 | acpi_format_exception(status), | 156 | acpi_format_exception(status), |
153 | sleep_state_name)); | 157 | info->pathname)); |
154 | 158 | ||
155 | return_ACPI_STATUS(status); | 159 | goto cleanup; |
156 | } | 160 | } |
157 | 161 | ||
158 | /* Must have a return object */ | 162 | /* Must have a return object */ |
159 | 163 | ||
160 | if (!info.return_object) { | 164 | if (!info->return_object) { |
161 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 165 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
162 | sleep_state_name)); | 166 | info->pathname)); |
163 | status = AE_NOT_EXIST; | 167 | status = AE_NOT_EXIST; |
164 | } | 168 | } |
165 | 169 | ||
166 | /* It must be of type Package */ | 170 | /* It must be of type Package */ |
167 | 171 | ||
168 | else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { | 172 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { |
169 | ACPI_ERROR((AE_INFO, | 173 | ACPI_ERROR((AE_INFO, |
170 | "Sleep State return object is not a Package")); | 174 | "Sleep State return object is not a Package")); |
171 | status = AE_AML_OPERAND_TYPE; | 175 | status = AE_AML_OPERAND_TYPE; |
@@ -178,7 +182,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
178 | * by BIOS vendors seems to be to have 2 or more elements, at least | 182 | * by BIOS vendors seems to be to have 2 or more elements, at least |
179 | * one per sleep type (A/B). | 183 | * one per sleep type (A/B). |
180 | */ | 184 | */ |
181 | else if (info.return_object->package.count < 2) { | 185 | else if (info->return_object->package.count < 2) { |
182 | ACPI_ERROR((AE_INFO, | 186 | ACPI_ERROR((AE_INFO, |
183 | "Sleep State return package does not have at least two elements")); | 187 | "Sleep State return package does not have at least two elements")); |
184 | status = AE_AML_NO_OPERAND; | 188 | status = AE_AML_NO_OPERAND; |
@@ -186,35 +190,38 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
186 | 190 | ||
187 | /* The first two elements must both be of type Integer */ | 191 | /* The first two elements must both be of type Integer */ |
188 | 192 | ||
189 | else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) | 193 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) |
190 | != ACPI_TYPE_INTEGER) || | 194 | != ACPI_TYPE_INTEGER) || |
191 | (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) | 195 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) |
192 | != ACPI_TYPE_INTEGER)) { | 196 | != ACPI_TYPE_INTEGER)) { |
193 | ACPI_ERROR((AE_INFO, | 197 | ACPI_ERROR((AE_INFO, |
194 | "Sleep State return package elements are not both Integers (%s, %s)", | 198 | "Sleep State return package elements are not both Integers (%s, %s)", |
195 | acpi_ut_get_object_type_name(info.return_object-> | 199 | acpi_ut_get_object_type_name(info->return_object-> |
196 | package.elements[0]), | 200 | package.elements[0]), |
197 | acpi_ut_get_object_type_name(info.return_object-> | 201 | acpi_ut_get_object_type_name(info->return_object-> |
198 | package.elements[1]))); | 202 | package.elements[1]))); |
199 | status = AE_AML_OPERAND_TYPE; | 203 | status = AE_AML_OPERAND_TYPE; |
200 | } else { | 204 | } else { |
201 | /* Valid _Sx_ package size, type, and value */ | 205 | /* Valid _Sx_ package size, type, and value */ |
202 | 206 | ||
203 | *sleep_type_a = (u8) | 207 | *sleep_type_a = (u8) |
204 | (info.return_object->package.elements[0])->integer.value; | 208 | (info->return_object->package.elements[0])->integer.value; |
205 | *sleep_type_b = (u8) | 209 | *sleep_type_b = (u8) |
206 | (info.return_object->package.elements[1])->integer.value; | 210 | (info->return_object->package.elements[1])->integer.value; |
207 | } | 211 | } |
208 | 212 | ||
209 | if (ACPI_FAILURE(status)) { | 213 | if (ACPI_FAILURE(status)) { |
210 | ACPI_EXCEPTION((AE_INFO, status, | 214 | ACPI_EXCEPTION((AE_INFO, status, |
211 | "While evaluating SleepState [%s], bad Sleep object %p type %s", | 215 | "While evaluating SleepState [%s], bad Sleep object %p type %s", |
212 | sleep_state_name, info.return_object, | 216 | info->pathname, info->return_object, |
213 | acpi_ut_get_object_type_name(info. | 217 | acpi_ut_get_object_type_name(info-> |
214 | return_object))); | 218 | return_object))); |
215 | } | 219 | } |
216 | 220 | ||
217 | acpi_ut_remove_reference(info.return_object); | 221 | acpi_ut_remove_reference(info->return_object); |
222 | |||
223 | cleanup: | ||
224 | ACPI_FREE(info); | ||
218 | return_ACPI_STATUS(status); | 225 | return_ACPI_STATUS(status); |
219 | } | 226 | } |
220 | 227 | ||