diff options
Diffstat (limited to 'drivers/acpi/executer/exutils.c')
-rw-r--r-- | drivers/acpi/executer/exutils.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 6b0aeccbb69b..c0837af0acb1 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -240,72 +240,66 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
240 | * PARAMETERS: field_flags - Flags with Lock rule: | 240 | * PARAMETERS: field_flags - Flags with Lock rule: |
241 | * always_lock or never_lock | 241 | * always_lock or never_lock |
242 | * | 242 | * |
243 | * RETURN: TRUE/FALSE indicating whether the lock was actually acquired | 243 | * RETURN: None |
244 | * | 244 | * |
245 | * DESCRIPTION: Obtain the global lock and keep track of this fact via two | 245 | * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field |
246 | * methods. A global variable keeps the state of the lock, and | 246 | * flags specifiy that it is to be obtained before field access. |
247 | * the state is returned to the caller. | ||
248 | * | 247 | * |
249 | ******************************************************************************/ | 248 | ******************************************************************************/ |
250 | 249 | ||
251 | u8 acpi_ex_acquire_global_lock(u32 field_flags) | 250 | void acpi_ex_acquire_global_lock(u32 field_flags) |
252 | { | 251 | { |
253 | u8 locked = FALSE; | ||
254 | acpi_status status; | 252 | acpi_status status; |
255 | 253 | ||
256 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); | 254 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); |
257 | 255 | ||
258 | /* Only attempt lock if the always_lock bit is set */ | 256 | /* Only use the lock if the always_lock bit is set */ |
257 | |||
258 | if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { | ||
259 | return_VOID; | ||
260 | } | ||
259 | 261 | ||
260 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 262 | /* Attempt to get the global lock, wait forever */ |
261 | 263 | ||
262 | /* We should attempt to get the lock, wait forever */ | 264 | status = acpi_ex_acquire_mutex_object(ACPI_WAIT_FOREVER, |
265 | acpi_gbl_global_lock_mutex, | ||
266 | acpi_os_get_thread_id()); | ||
263 | 267 | ||
264 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); | 268 | if (ACPI_FAILURE(status)) { |
265 | if (ACPI_SUCCESS(status)) { | 269 | ACPI_EXCEPTION((AE_INFO, status, |
266 | locked = TRUE; | 270 | "Could not acquire Global Lock")); |
267 | } else { | ||
268 | ACPI_EXCEPTION((AE_INFO, status, | ||
269 | "Could not acquire Global Lock")); | ||
270 | } | ||
271 | } | 271 | } |
272 | 272 | ||
273 | return_UINT8(locked); | 273 | return_VOID; |
274 | } | 274 | } |
275 | 275 | ||
276 | /******************************************************************************* | 276 | /******************************************************************************* |
277 | * | 277 | * |
278 | * FUNCTION: acpi_ex_release_global_lock | 278 | * FUNCTION: acpi_ex_release_global_lock |
279 | * | 279 | * |
280 | * PARAMETERS: locked_by_me - Return value from corresponding call to | 280 | * PARAMETERS: None |
281 | * acquire_global_lock. | ||
282 | * | 281 | * |
283 | * RETURN: None | 282 | * RETURN: None |
284 | * | 283 | * |
285 | * DESCRIPTION: Release the global lock if it is locked. | 284 | * DESCRIPTION: Release the ACPI hardware Global Lock |
286 | * | 285 | * |
287 | ******************************************************************************/ | 286 | ******************************************************************************/ |
288 | 287 | ||
289 | void acpi_ex_release_global_lock(u8 locked_by_me) | 288 | void acpi_ex_release_global_lock(void) |
290 | { | 289 | { |
291 | acpi_status status; | 290 | acpi_status status; |
292 | 291 | ||
293 | ACPI_FUNCTION_TRACE(ex_release_global_lock); | 292 | ACPI_FUNCTION_TRACE(ex_release_global_lock); |
294 | 293 | ||
295 | /* Only attempt unlock if the caller locked it */ | 294 | /* Release the global lock */ |
296 | |||
297 | if (locked_by_me) { | ||
298 | 295 | ||
299 | /* OK, now release the lock */ | 296 | status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); |
300 | 297 | if (ACPI_FAILURE(status)) { | |
301 | status = acpi_ev_release_global_lock(); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | 298 | ||
304 | /* Report the error, but there isn't much else we can do */ | 299 | /* Report the error, but there isn't much else we can do */ |
305 | 300 | ||
306 | ACPI_EXCEPTION((AE_INFO, status, | 301 | ACPI_EXCEPTION((AE_INFO, status, |
307 | "Could not release ACPI Global Lock")); | 302 | "Could not release Global Lock")); |
308 | } | ||
309 | } | 303 | } |
310 | 304 | ||
311 | return_VOID; | 305 | return_VOID; |