linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: locks: remove opencoded #16 for ticket shift
@ 2013-07-15 13:27 Will Deacon
  2013-07-16 16:35 ` Dave Martin
  2013-07-17 13:56 ` Nicolas Pitre
  0 siblings, 2 replies; 6+ messages in thread
From: Will Deacon @ 2013-07-15 13:27 UTC (permalink / raw)
  To: linux-arm-kernel

The ticket width of our spinlocks is defined by TICKET_SHIFT, so remove
the opencoded #16 from the trylock implementation.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/include/asm/spinlock.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index f8b8965..fa3ccce 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -104,11 +104,11 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
 		__asm__ __volatile__(
 		"	ldrex	%0, [%3]\n"
 		"	mov	%2, #0\n"
-		"	subs	%1, %0, %0, ror #16\n"
-		"	addeq	%0, %0, %4\n"
+		"	subs	%1, %0, %0, ror %4\n"
+		"	addeq	%0, %0, %5\n"
 		"	strexeq	%2, %0, [%3]"
 		: "=&r" (slock), "=&r" (contended), "=r" (res)
-		: "r" (&lock->slock), "I" (1 << TICKET_SHIFT)
+		: "r" (&lock->slock), "I" (TICKET_SHIFT), "I" (1 << TICKET_SHIFT)
 		: "cc");
 	} while (res);
 
-- 
1.8.2.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-07-19  9:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 13:27 [PATCH] ARM: locks: remove opencoded #16 for ticket shift Will Deacon
2013-07-16 16:35 ` Dave Martin
2013-07-17 13:56 ` Nicolas Pitre
2013-07-18 17:21   ` Will Deacon
2013-07-18 17:53     ` Nicolas Pitre
2013-07-19  9:05       ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).