summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2012-10-17 11:41:53 -0700
committerRobert Moore <Robert.Moore@intel.com>2012-10-17 11:41:53 -0700
commit5e59e2fdef92fc6b4506ff26dc0acd64848a8a62 (patch)
treecfa41ecfde1b344345c02fcd3552fc4de75221d3
parent3938951e5584fd8f9b376c4f9345157755910aca (diff)
downloadacpica-5e59e2fdef92fc6b4506ff26dc0acd64848a8a62.tar.gz
Divergence: Backport Linux lockdep fix to ACPICA.
Backport changes made in Linux aclinux.h to ACPICA to reduce divergence of the ACPICA base code from Linux. Following commits are involved: 1. Rafael J. Wysocki <rjw@sisk.pl> ACPI: Fix lockdep false positives in acpi_power_off() https://bugzilla.kernel.org/show_bug.cgi?id=38152 This will decrease 29 lines of 20120913 divergence.diff. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Len Brown <len.brown@intel.com>
-rw-r--r--source/include/acpiosxf.h2
-rw-r--r--source/include/platform/aclinux.h18
2 files changed, 20 insertions, 0 deletions
diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h
index 0a8bdb1c2..f9224b559 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -194,9 +194,11 @@ AcpiOsPhysicalTableOverride (
/*
* Spinlock primitives
*/
+#ifndef AcpiOsCreateLock
ACPI_STATUS
AcpiOsCreateLock (
ACPI_SPINLOCK *OutHandle);
+#endif
void
AcpiOsDeleteLock (
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index 08009d6e8..f2d96d766 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -229,6 +229,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 AcpiOsCreateLock(__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__ */