LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Andi Kleen <ak@suse.de>
Subject: [patch 17/21] Use different constraint for gcc < 4.1 in bitops.
Date: Tue, 20 Feb 2007 17:38:32 -0800	[thread overview]
Message-ID: <20070221013832.GR30227@kroah.com> (raw)
In-Reply-To: <20070221013619.GA30227@kroah.com>

[-- Attachment #1: use-different-constraint-for-gcc-4.1-in-bitops.patch --]
[-- Type: text/plain, Size: 3504 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------

Use different constraint for gcc < 4.1 in bitops.h

+m is really correct for a RMW instruction, but some older gccs
error out. I finally gave in and ifdefed it.

This fixes compilation errors with some compiler version.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/asm-x86_64/bitops.h |   34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

--- linux-2.6.19.4.orig/include/asm-x86_64/bitops.h
+++ linux-2.6.19.4/include/asm-x86_64/bitops.h
@@ -7,7 +7,13 @@
 
 #include <asm/alternative.h>
 
-#define ADDR (*(volatile long *) addr)
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
+/* Technically wrong, but this avoids compilation errors on some gcc
+   versions. */
+#define ADDR "=m" (*(volatile long *) addr)
+#else
+#define ADDR "+m" (*(volatile long *) addr)
+#endif
 
 /**
  * set_bit - Atomically set a bit in memory
@@ -23,7 +29,7 @@ static __inline__ void set_bit(int nr, v
 {
 	__asm__ __volatile__( LOCK_PREFIX
 		"btsl %1,%0"
-		:"+m" (ADDR)
+		:ADDR
 		:"dIr" (nr) : "memory");
 }
 
@@ -40,7 +46,7 @@ static __inline__ void __set_bit(int nr,
 {
 	__asm__ volatile(
 		"btsl %1,%0"
-		:"+m" (ADDR)
+		:ADDR
 		:"dIr" (nr) : "memory");
 }
 
@@ -58,7 +64,7 @@ static __inline__ void clear_bit(int nr,
 {
 	__asm__ __volatile__( LOCK_PREFIX
 		"btrl %1,%0"
-		:"+m" (ADDR)
+		:ADDR
 		:"dIr" (nr));
 }
 
@@ -66,7 +72,7 @@ static __inline__ void __clear_bit(int n
 {
 	__asm__ __volatile__(
 		"btrl %1,%0"
-		:"+m" (ADDR)
+		:ADDR
 		:"dIr" (nr));
 }
 
@@ -86,7 +92,7 @@ static __inline__ void __change_bit(int 
 {
 	__asm__ __volatile__(
 		"btcl %1,%0"
-		:"+m" (ADDR)
+		:ADDR
 		:"dIr" (nr));
 }
 
@@ -103,7 +109,7 @@ static __inline__ void change_bit(int nr
 {
 	__asm__ __volatile__( LOCK_PREFIX
 		"btcl %1,%0"
-		:"+m" (ADDR)
+		:ADDR
 		:"dIr" (nr));
 }
 
@@ -121,7 +127,7 @@ static __inline__ int test_and_set_bit(i
 
 	__asm__ __volatile__( LOCK_PREFIX
 		"btsl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"+m" (ADDR)
+		:"=r" (oldbit),ADDR
 		:"dIr" (nr) : "memory");
 	return oldbit;
 }
@@ -141,7 +147,7 @@ static __inline__ int __test_and_set_bit
 
 	__asm__(
 		"btsl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"+m" (ADDR)
+		:"=r" (oldbit),ADDR
 		:"dIr" (nr));
 	return oldbit;
 }
@@ -160,7 +166,7 @@ static __inline__ int test_and_clear_bit
 
 	__asm__ __volatile__( LOCK_PREFIX
 		"btrl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"+m" (ADDR)
+		:"=r" (oldbit),ADDR
 		:"dIr" (nr) : "memory");
 	return oldbit;
 }
@@ -180,7 +186,7 @@ static __inline__ int __test_and_clear_b
 
 	__asm__(
 		"btrl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"+m" (ADDR)
+		:"=r" (oldbit),ADDR
 		:"dIr" (nr));
 	return oldbit;
 }
@@ -192,7 +198,7 @@ static __inline__ int __test_and_change_
 
 	__asm__ __volatile__(
 		"btcl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"+m" (ADDR)
+		:"=r" (oldbit),ADDR
 		:"dIr" (nr) : "memory");
 	return oldbit;
 }
@@ -211,7 +217,7 @@ static __inline__ int test_and_change_bi
 
 	__asm__ __volatile__( LOCK_PREFIX
 		"btcl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"+m" (ADDR)
+		:"=r" (oldbit),ADDR
 		:"dIr" (nr) : "memory");
 	return oldbit;
 }
@@ -237,7 +243,7 @@ static __inline__ int variable_test_bit(
 	__asm__ __volatile__(
 		"btl %2,%1\n\tsbbl %0,%0"
 		:"=r" (oldbit)
-		:"m" (ADDR),"dIr" (nr));
+		:"m" (*(volatile long *)addr),"dIr" (nr));
 	return oldbit;
 }
 

--

  parent reply	other threads:[~2007-02-21  1:43 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070221012758.925122216@mini.kroah.org>
2007-02-21  1:36 ` [patch 00/21] 2.6.19-stable review Greg KH
2007-02-21  1:36   ` [patch 01/21] V4L: cx88: Fix lockup on suspend Greg KH
2007-02-22  1:00     ` Chuck Ebbert
2007-02-22  1:14       ` Michael Krufky
2007-02-21  1:36   ` [patch 02/21] V4L: Fix quickcam communicator driver for big endian architectures Greg KH
2007-02-21  1:36   ` [patch 03/21] V4L: fix ks0127 status flags Greg KH
2007-02-21  1:36   ` [patch 04/21] V4L: tveeprom: autodetect LG TAPC G701D as tuner type 37 Greg KH
2007-02-21  1:37   ` [patch 05/21] V4L: buf_qbuf: fix videobuf_queue->stream corruption and lockup Greg KH
2007-02-21  1:37   ` [patch 06/21] net/smc911x: match up spin lock/unlock Greg KH
2007-02-21  1:37   ` [patch 07/21] rtc-pcf8563: detect polarity of century bit automatically Greg KH
2007-02-21  1:37   ` [patch 08/21] aio: fix buggy put_ioctx call in aio_complete - v2 Greg KH
2007-02-21  1:37   ` [patch 09/21] x86_64: fix 2.6.18 regression - PTRACE_OLDSETOPTIONS should be accepted Greg KH
2007-02-21  1:37   ` [patch 10/21] ide: fix drive side 80c cable check Greg KH
2007-02-21  1:37   ` [patch 11/21] pata_amd: fix an obvious bug in cable detection Greg KH
2007-02-21  1:37   ` [patch 12/21] bcm43xx: Fix for oops on resume Greg KH
2007-02-21  1:38   ` [patch 13/21] bcm43xx: Fix for oops on ampdu status Greg KH
2007-02-21  1:38   ` [patch 14/21] usb-audio: work around wrong frequency in CM6501 descriptors Greg KH
2007-02-21  1:38   ` [patch 15/21] usbaudio - Fix Oops with broken usb descriptors Greg KH
2007-02-21  1:38   ` [patch 16/21] usbaudio - Fix Oops with unconventional sample rates Greg KH
2007-02-21  1:38   ` Greg KH [this message]
2007-02-21  1:38   ` [patch 18/21] prism54: correct assignment of DOT1XENABLE in WE-19 codepaths Greg KH
2007-02-21  1:38   ` [patch 19/21] net, 8139too.c: fix netpoll deadlock Greg KH
2007-02-21  1:38   ` [patch 20/21] Keys: Fix key serial number collision handling Greg KH
2007-02-21  1:39   ` [patch 21/21] knfsd: Fix a race in closing NFSd connections Greg KH
2007-02-21 13:36   ` [patch 00/21] 2.6.19-stable review Stefan Richter
2007-02-21 13:37     ` Stefan Richter
2007-03-09  5:35     ` Adrian Bunk
2007-02-21 16:38   ` Chuck Ebbert
2007-02-21 16:50   ` Chuck Ebbert
2007-02-21 19:31   ` Chuck Ebbert
2007-02-21 19:47     ` Andrew Morton
2007-02-21 20:09       ` Linus Torvalds
2007-02-21 22:45         ` Eric W. Biederman
2007-02-28  6:37         ` Eric W. Biederman
2007-02-28  8:51           ` Zwane Mwaikambo
2007-02-28 12:28             ` Eric W. Biederman
2007-02-28 19:52               ` [stable] " Greg KH
2007-02-28 23:25                 ` Eric W. Biederman
2007-02-21 20:13       ` Eric W. Biederman
2007-02-21 20:21         ` Chuck Ebbert
2007-02-21 22:19         ` Andi Kleen
2007-02-21 22:20       ` Andi Kleen
2007-02-21 22:39         ` Chuck Ebbert
2007-02-22  1:19           ` Andi Kleen
2007-02-21 20:39     ` Greg KH
2007-02-21 20:44       ` Chuck Ebbert
2007-02-21 22:33   ` Chuck Ebbert
2007-02-21 22:35     ` Chuck Ebbert
2007-02-21 22:43   ` Chuck Ebbert
2007-02-22 16:09   ` Chuck Ebbert

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=20070221013832.GR30227@kroah.com \
    --to=greg@kroah.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    --subject='Re: [patch 17/21] Use different constraint for gcc < 4.1 in bitops.' \
    /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

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).