diff options
Diffstat (limited to 'drivers/acpi/hardware/hwregs.c')
-rw-r--r-- | drivers/acpi/hardware/hwregs.c | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 5a3aa8dd8cb7..ae142de19507 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -61,10 +61,13 @@ ACPI_MODULE_NAME("hwregs") | |||
61 | * DESCRIPTION: Clears all fixed and general purpose status bits | 61 | * DESCRIPTION: Clears all fixed and general purpose status bits |
62 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 62 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
63 | * | 63 | * |
64 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
65 | * | ||
64 | ******************************************************************************/ | 66 | ******************************************************************************/ |
65 | acpi_status acpi_hw_clear_acpi_status(u32 flags) | 67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) |
66 | { | 68 | { |
67 | acpi_status status; | 69 | acpi_status status; |
70 | acpi_cpu_flags lock_flags = 0; | ||
68 | 71 | ||
69 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); | 72 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); |
70 | 73 | ||
@@ -72,12 +75,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags) | |||
72 | ACPI_BITMASK_ALL_FIXED_STATUS, | 75 | ACPI_BITMASK_ALL_FIXED_STATUS, |
73 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); | 76 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); |
74 | 77 | ||
75 | if (flags & ACPI_MTX_LOCK) { | 78 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
76 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
77 | if (ACPI_FAILURE(status)) { | ||
78 | return_ACPI_STATUS(status); | ||
79 | } | ||
80 | } | ||
81 | 79 | ||
82 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, | 80 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
83 | ACPI_REGISTER_PM1_STATUS, | 81 | ACPI_REGISTER_PM1_STATUS, |
@@ -102,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags) | |||
102 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 100 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
103 | 101 | ||
104 | unlock_and_exit: | 102 | unlock_and_exit: |
105 | if (flags & ACPI_MTX_LOCK) { | 103 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
106 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
107 | } | ||
108 | return_ACPI_STATUS(status); | 104 | return_ACPI_STATUS(status); |
109 | } | 105 | } |
110 | 106 | ||
@@ -264,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | |||
264 | * | 260 | * |
265 | * DESCRIPTION: ACPI bit_register read function. | 261 | * DESCRIPTION: ACPI bit_register read function. |
266 | * | 262 | * |
263 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
264 | * | ||
267 | ******************************************************************************/ | 265 | ******************************************************************************/ |
268 | 266 | ||
269 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | 267 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) |
@@ -281,23 +279,12 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
281 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 279 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
282 | } | 280 | } |
283 | 281 | ||
284 | if (flags & ACPI_MTX_LOCK) { | ||
285 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
286 | if (ACPI_FAILURE(status)) { | ||
287 | return_ACPI_STATUS(status); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | /* Read from the register */ | 282 | /* Read from the register */ |
292 | 283 | ||
293 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, | 284 | status = acpi_hw_register_read(ACPI_MTX_LOCK, |
294 | bit_reg_info->parent_register, | 285 | bit_reg_info->parent_register, |
295 | ®ister_value); | 286 | ®ister_value); |
296 | 287 | ||
297 | if (flags & ACPI_MTX_LOCK) { | ||
298 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
299 | } | ||
300 | |||
301 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
302 | 289 | ||
303 | /* Normalize the value that was read */ | 290 | /* Normalize the value that was read */ |
@@ -331,12 +318,15 @@ ACPI_EXPORT_SYMBOL(acpi_get_register) | |||
331 | * | 318 | * |
332 | * DESCRIPTION: ACPI Bit Register write function. | 319 | * DESCRIPTION: ACPI Bit Register write function. |
333 | * | 320 | * |
321 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
322 | * | ||
334 | ******************************************************************************/ | 323 | ******************************************************************************/ |
335 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | 324 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) |
336 | { | 325 | { |
337 | u32 register_value = 0; | 326 | u32 register_value = 0; |
338 | struct acpi_bit_register_info *bit_reg_info; | 327 | struct acpi_bit_register_info *bit_reg_info; |
339 | acpi_status status; | 328 | acpi_status status; |
329 | acpi_cpu_flags lock_flags; | ||
340 | 330 | ||
341 | ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); | 331 | ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); |
342 | 332 | ||
@@ -349,12 +339,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
349 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 339 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
350 | } | 340 | } |
351 | 341 | ||
352 | if (flags & ACPI_MTX_LOCK) { | 342 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
353 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
354 | if (ACPI_FAILURE(status)) { | ||
355 | return_ACPI_STATUS(status); | ||
356 | } | ||
357 | } | ||
358 | 343 | ||
359 | /* Always do a register read first so we can insert the new bits */ | 344 | /* Always do a register read first so we can insert the new bits */ |
360 | 345 | ||
@@ -462,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
462 | 447 | ||
463 | unlock_and_exit: | 448 | unlock_and_exit: |
464 | 449 | ||
465 | if (flags & ACPI_MTX_LOCK) { | 450 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
466 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
467 | } | ||
468 | 451 | ||
469 | /* Normalize the value that was read */ | 452 | /* Normalize the value that was read */ |
470 | 453 | ||
@@ -500,14 +483,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
500 | u32 value1 = 0; | 483 | u32 value1 = 0; |
501 | u32 value2 = 0; | 484 | u32 value2 = 0; |
502 | acpi_status status; | 485 | acpi_status status; |
486 | acpi_cpu_flags lock_flags = 0; | ||
503 | 487 | ||
504 | ACPI_FUNCTION_TRACE(hw_register_read); | 488 | ACPI_FUNCTION_TRACE(hw_register_read); |
505 | 489 | ||
506 | if (ACPI_MTX_LOCK == use_lock) { | 490 | if (ACPI_MTX_LOCK == use_lock) { |
507 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 491 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
508 | if (ACPI_FAILURE(status)) { | ||
509 | return_ACPI_STATUS(status); | ||
510 | } | ||
511 | } | 492 | } |
512 | 493 | ||
513 | switch (register_id) { | 494 | switch (register_id) { |
@@ -585,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
585 | 566 | ||
586 | unlock_and_exit: | 567 | unlock_and_exit: |
587 | if (ACPI_MTX_LOCK == use_lock) { | 568 | if (ACPI_MTX_LOCK == use_lock) { |
588 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 569 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
589 | } | 570 | } |
590 | 571 | ||
591 | if (ACPI_SUCCESS(status)) { | 572 | if (ACPI_SUCCESS(status)) { |
@@ -613,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
613 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | 594 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) |
614 | { | 595 | { |
615 | acpi_status status; | 596 | acpi_status status; |
597 | acpi_cpu_flags lock_flags = 0; | ||
616 | 598 | ||
617 | ACPI_FUNCTION_TRACE(hw_register_write); | 599 | ACPI_FUNCTION_TRACE(hw_register_write); |
618 | 600 | ||
619 | if (ACPI_MTX_LOCK == use_lock) { | 601 | if (ACPI_MTX_LOCK == use_lock) { |
620 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 602 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
621 | if (ACPI_FAILURE(status)) { | ||
622 | return_ACPI_STATUS(status); | ||
623 | } | ||
624 | } | 603 | } |
625 | 604 | ||
626 | switch (register_id) { | 605 | switch (register_id) { |
@@ -710,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | |||
710 | 689 | ||
711 | unlock_and_exit: | 690 | unlock_and_exit: |
712 | if (ACPI_MTX_LOCK == use_lock) { | 691 | if (ACPI_MTX_LOCK == use_lock) { |
713 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 692 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
714 | } | 693 | } |
715 | 694 | ||
716 | return_ACPI_STATUS(status); | 695 | return_ACPI_STATUS(status); |