Skip to content

Commit

Permalink
ACPI: osl, add acpi_os_create_lock interface
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Lin Ming authored and Len Brown committed Mar 25, 2011
1 parent d8d75b0 commit 9f63b88
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
33 changes: 25 additions & 8 deletions drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,14 +883,6 @@ void acpi_os_wait_events_complete(void *context)

EXPORT_SYMBOL(acpi_os_wait_events_complete);

/*
* Deallocate the memory for a spinlock.
*/
void acpi_os_delete_lock(acpi_spinlock handle)
{
return;
}

acpi_status
acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
{
Expand Down Expand Up @@ -1321,6 +1313,31 @@ int acpi_resources_are_enforced(void)
}
EXPORT_SYMBOL(acpi_resources_are_enforced);

/*
* Create and initialize a spinlock.
*/
acpi_status
acpi_os_create_lock(acpi_spinlock *out_handle)
{
spinlock_t *lock;

lock = ACPI_ALLOCATE(sizeof(spinlock_t));
if (!lock)
return AE_NO_MEMORY;
spin_lock_init(lock);
*out_handle = lock;

return AE_OK;
}

/*
* Deallocate the memory for a spinlock.
*/
void acpi_os_delete_lock(acpi_spinlock handle)
{
ACPI_FREE(handle);
}

/*
* Acquire a spinlock.
*
Expand Down
3 changes: 3 additions & 0 deletions include/acpi/acpiosxf.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ acpi_os_table_override(struct acpi_table_header *existing_table,
/*
* Spinlock primitives
*/
acpi_status
acpi_os_create_lock(acpi_spinlock *out_handle);

void acpi_os_delete_lock(acpi_spinlock handle);

acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);
Expand Down

0 comments on commit 9f63b88

Please sign in to comment.