]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/acpi/platform/aclinux.h
Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / include / acpi / platform / aclinux.h
index 5d2a5e9544d9d4743202852cde379a60fb2f7600..2ce1be9f62918c38a52edf3d8424af1e4c48d25a 100644 (file)
@@ -159,6 +159,24 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
        } while (0)
 #endif
 
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#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;                            \
+})
+
 #endif /* __KERNEL__ */
 
 #endif /* __ACLINUX_H__ */