Skip to content

Commit 7afea7b

Browse files
pulkomandyrafaeljw
authored andcommitted
ACPICA: haiku: Fix invalid value used for semaphores
ACPICA commit 49fe4f25483feec2f685b204ef19e28d92979e95 In Haiku, semaphores are represented by integers, not pointers. So, we can't use NULL as the invalid/destroyed value, the correct value is -1. Introduce a platform overridable define to allow this. Fixes #162 (which was closed after coming to the conclusion that this should be done, but the change was never done). Link: acpica/acpica@49fe4f25 Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 36b5c1d commit 7afea7b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

drivers/acpi/acpica/utdelete.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
140140
(void)
141141
acpi_os_delete_semaphore
142142
(acpi_gbl_global_lock_semaphore);
143-
acpi_gbl_global_lock_semaphore = NULL;
143+
acpi_gbl_global_lock_semaphore = ACPI_SEMAPHORE_NULL;
144144

145145
acpi_os_delete_mutex(object->mutex.os_mutex);
146146
acpi_gbl_global_lock_mutex = NULL;
@@ -157,7 +157,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
157157
object, object->event.os_semaphore));
158158

159159
(void)acpi_os_delete_semaphore(object->event.os_semaphore);
160-
object->event.os_semaphore = NULL;
160+
object->event.os_semaphore = ACPI_SEMAPHORE_NULL;
161161
break;
162162

163163
case ACPI_TYPE_METHOD:

drivers/acpi/acpica/utinit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ acpi_status acpi_ut_init_globals(void)
154154

155155
/* Global Lock support */
156156

157-
acpi_gbl_global_lock_semaphore = NULL;
157+
acpi_gbl_global_lock_semaphore = ACPI_SEMAPHORE_NULL;
158158
acpi_gbl_global_lock_mutex = NULL;
159159
acpi_gbl_global_lock_acquired = FALSE;
160160
acpi_gbl_global_lock_handle = 0;

include/acpi/platform/acenv.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@
252252
#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0
253253
#endif
254254

255+
/* NULL/invalid value to use for destroyed or not-yet-created semaphores. */
256+
257+
#ifndef ACPI_SEMAPHORE_NULL
258+
#define ACPI_SEMAPHORE_NULL NULL
259+
#endif
260+
255261
/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
256262

257263
#ifndef ACPI_FLUSH_CPU_CACHE

0 commit comments

Comments
 (0)