[PATCH] arm64: spinlock: const qualify read-only functions

Ian Coolidge icoolidge at google.com
Wed Oct 28 12:44:55 PDT 2015


This allows assert_spin_locked() to be used against
spinlocks that are const qualified.

Signed-off-by: Ian Coolidge <icoolidge at google.com>
---
 arch/arm64/include/asm/spinlock.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h
index c85e96d..72a7f33 100644
--- a/arch/arm64/include/asm/spinlock.h
+++ b/arch/arm64/include/asm/spinlock.h
@@ -122,17 +122,17 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
 	: "memory");
 }
 
-static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
+static inline int arch_spin_value_unlocked(const arch_spinlock_t lock)
 {
 	return lock.owner == lock.next;
 }
 
-static inline int arch_spin_is_locked(arch_spinlock_t *lock)
+static inline int arch_spin_is_locked(const arch_spinlock_t *lock)
 {
 	return !arch_spin_value_unlocked(READ_ONCE(*lock));
 }
 
-static inline int arch_spin_is_contended(arch_spinlock_t *lock)
+static inline int arch_spin_is_contended(const arch_spinlock_t *lock)
 {
 	arch_spinlock_t lockval = READ_ONCE(*lock);
 	return (lockval.next - lockval.owner) > 1;
-- 
2.6.0.rc2.230.g3dd15c0




More information about the linux-arm-kernel mailing list