linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: bitops: Use BX instead of MOV PC,LR
Date: Thu, 3 Feb 2011 10:44:21 +0000	[thread overview]
Message-ID: <20110203104420.GA2666@arm.com> (raw)
In-Reply-To: <20110202212449.GF31043@n2100.arm.linux.org.uk>

The kernel doesn't officially need to interwork, but using BX
wherever appropriate will help educate people into good assembler
coding habits.

BX is appropriate here because this code is predicated on

Signed-off-by: Dave Martin <dave.martin@linaro.org>
---

A bit of a pedantic one, but is there any chance of switching
to using BX here?

I spend a significant amount of my life trying to educate people
not to do things like mov pc,lr ... though in interworking userspace
is admittedly a different world from the kernel.

Cheers
Dave

 arch/arm/lib/bitops.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index a9d9d15..5527e23 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -12,7 +12,7 @@
 	strex	r0, r2, [r1]
 	cmp	r0, #0
 	bne	1b
-	mov	pc, lr
+	bx	lr
 	.endm
 
 	.macro	testop, instr, store
@@ -33,7 +33,7 @@
 	smp_dmb
 	cmp	r0, #0
 	movne	r0, #1
-2:	mov	pc, lr
+2:	bx	lr
 	.endm
 #else
 	.macro	bitop, instr
@@ -48,7 +48,7 @@
 	\instr	r2, r2, r3
 	str	r2, [r1, r0, lsl #2]
 	restore_irqs ip
-	mov	pc, lr
+	bx	lr
 	.endm
 
 /**
@@ -72,6 +72,6 @@
 	\store	r2, [r1]
 	moveq	r0, #0
 	restore_irqs ip
-	mov	pc, lr
+	bx	lr
 	.endm
 #endif
-- 
1.7.1

  parent reply	other threads:[~2011-02-03 10:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 18:53 [PATCH] ARM: bitops: Fix low-level code to be Thumb-2 compatible Dave Martin
2011-02-02 19:33 ` Nicolas Pitre
2011-02-02 19:50   ` Russell King - ARM Linux
2011-02-02 20:39     ` Nicolas Pitre
2011-02-02 20:47       ` Russell King - ARM Linux
2011-02-02 21:24   ` Russell King - ARM Linux
2011-02-02 21:54     ` Nicolas Pitre
2011-02-03 10:08     ` Dave Martin
2011-02-03 10:44     ` Dave Martin [this message]
2011-02-03 10:47       ` [PATCH REPOST] ARM: bitops: Use BX instead of MOV PC,LR Dave Martin
2011-02-03 16:27         ` Rabin Vincent
2011-02-03 18:06           ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110203104420.GA2666@arm.com \
    --to=dave.martin@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).