===================================================================
@@ -1333,31 +1333,6 @@ 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.
*
* handle is a pointer to the spinlock_t.
===================================================================
@@ -95,14 +95,6 @@ acpi_status
acpi_os_table_override(struct acpi_table_header *existing_table,
struct acpi_table_header **new_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);
void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags);
===================================================================
@@ -159,6 +159,26 @@ static inline void *acpi_os_acquire_obje
} while (0)
#endif
+/*
+ * Spinlock primitives
+ */
+
+#define acpi_os_create_lock(__handle) \
+({ \
+ spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+ \
+ if (lock) { \
+ *(__handle) = lock; \
+ spin_lock_init(*(__handle)); \
+ } \
+ lock ? AE_OK : AE_NO_MEMORY; \
+})
+
+#define acpi_os_delete_lock(__handle) \
+ do { \
+ ACPI_FREE(__handle); \
+ } while (0)
+
#endif /* __KERNEL__ */
#endif /* __ACLINUX_H__ */