Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-25 Thread Russell King - ARM Linux
On Tue, Jan 25, 2011 at 01:57:26PM -, Will Deacon wrote:
 Hi Russell,
 
 Hopefully this isn't too late to be useful.
 
  On Mon, Jan 17, 2011 at 07:21:40PM +, Russell King - ARM Linux wrote:
   Switch the set/clear/change bitops to use the word-based exclusive
   operations, which are only present in a wider range of ARM architectures
   than the byte-based exclusive operations.
  
   Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
  
  As only one person replied to this patch with test information, I'm
  not happy to push this into -rc, and hence that prevents it going into
  -stable too.  That means omap2plus_defconfig .38 mainline kernels
  (including -stable) will remain potentially dangerous when run on
  SMP capable hardware.
  
  Therefore, I see no alternative at the moment but to purposely cause
  builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from
  data corruption.
  
  Please get your tested-by's to me for at least the first three patches
  of this series ASAP.
 
 I've tested this on the Versatile Express (ca9x4, little endian) with a USB
 hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB
 file containing random data whilst the system was fairly loaded. File 
 checksums
 all passed and the kernel didn't do anything untowards.
 
 Tested-by: Will Deacon will.dea...@arm.com
 
 I appreciate this is the same test configuration as the one Nicolas did,
 but it at least replicates his findings.

Was this for just the first three or the complete set?

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-25 Thread Tony Lindgren
* Russell King - ARM Linux li...@arm.linux.org.uk [110117 11:23]:
 Switch the set/clear/change bitops to use the word-based exclusive
 operations, which are only present in a wider range of ARM architectures
 than the byte-based exclusive operations.

This too been in use for about a week now with ext3 and nfs:

Tested-by: Tony Lindgren t...@atomide.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-25 Thread Nicolas Pitre
On Tue, 25 Jan 2011, Will Deacon wrote:

 Hi Russell,
 
 Hopefully this isn't too late to be useful.
 
  On Mon, Jan 17, 2011 at 07:21:40PM +, Russell King - ARM Linux wrote:
   Switch the set/clear/change bitops to use the word-based exclusive
   operations, which are only present in a wider range of ARM architectures
   than the byte-based exclusive operations.
  
   Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
  
  As only one person replied to this patch with test information, I'm
  not happy to push this into -rc, and hence that prevents it going into
  -stable too.  That means omap2plus_defconfig .38 mainline kernels
  (including -stable) will remain potentially dangerous when run on
  SMP capable hardware.
  
  Therefore, I see no alternative at the moment but to purposely cause
  builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from
  data corruption.
  
  Please get your tested-by's to me for at least the first three patches
  of this series ASAP.
 
 I've tested this on the Versatile Express (ca9x4, little endian) with a USB
 hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB
 file containing random data whilst the system was fairly loaded. File 
 checksums
 all passed and the kernel didn't do anything untowards.
 
 Tested-by: Will Deacon will.dea...@arm.com
 
 I appreciate this is the same test configuration as the one Nicolas did,
 but it at least replicates his findings.

Well, I did run parallel instances of the git test suite on a Dove board 
using the sata_mv driver.  Therefore this is still a significant
difference in configuration which is good.


Nicolas
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Poddar, Sourav
On Sun, Jan 23, 2011 at 3:05 PM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:
 On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
 At least another person did post results:

 http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
 http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com

 Slightly different patch - there were three revisions.  I can't attach
 a tested-by given to a different patch to this one.

  That means omap2plus_defconfig .38 mainline kernels
  (including -stable) will remain potentially dangerous when run on
  SMP capable hardware.

 I must admit that this series looks a bit large for stable IMHO.  I
 think that the fix for stable should limit itself only to prevent SMP
 from being selected if anything else than CPU_32v6K is selected.

 The first three are the bare minimum required for -stable.


Boot tested the 14 patch series  with CONFIG_SWP_EMULATE enabled, on
the following boards :


1. Omap2420 SDP

2. Omap2430 SDP

3. Omap3430 SDP

4. Omap4 Blaze

Tested by : Sourav Poddar sourav.pod...@ti.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Poddar, Sourav
On Mon, Jan 24, 2011 at 2:08 PM, Poddar, Sourav sourav.pod...@ti.com wrote:
 On Sun, Jan 23, 2011 at 3:05 PM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
 On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
 At least another person did post results:

 http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
 http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com

 Slightly different patch - there were three revisions.  I can't attach
 a tested-by given to a different patch to this one.

  That means omap2plus_defconfig .38 mainline kernels
  (including -stable) will remain potentially dangerous when run on
  SMP capable hardware.

 I must admit that this series looks a bit large for stable IMHO.  I
 think that the fix for stable should limit itself only to prevent SMP
 from being selected if anything else than CPU_32v6K is selected.

 The first three are the bare minimum required for -stable.



 Boot tested the 14 patch series  with CONFIG_SWP_EMULATE enabled, on
 the following boards :


  1. Omap2420 SDP

  2. Omap2430 SDP

  3. Omap3430 SDP

  4. Omap4 Blaze

  Tested-by: Sourav Poddar sourav.pod...@ti.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Russell King - ARM Linux
On Mon, Jan 24, 2011 at 02:27:24PM +0530, Poddar, Sourav wrote:
 On Mon, Jan 24, 2011 at 2:08 PM, Poddar, Sourav sourav.pod...@ti.com wrote:
  On Sun, Jan 23, 2011 at 3:05 PM, Russell King - ARM Linux
  li...@arm.linux.org.uk wrote:
  On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
  At least another person did post results:
 
  http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
  http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com
 
  Slightly different patch - there were three revisions.  I can't attach
  a tested-by given to a different patch to this one.
 
   That means omap2plus_defconfig .38 mainline kernels
   (including -stable) will remain potentially dangerous when run on
   SMP capable hardware.
 
  I must admit that this series looks a bit large for stable IMHO.  I
  think that the fix for stable should limit itself only to prevent SMP
  from being selected if anything else than CPU_32v6K is selected.
 
  The first three are the bare minimum required for -stable.
 
 
 
  Boot tested the 14 patch series  with CONFIG_SWP_EMULATE enabled, on
  the following boards :
 
 
   1. Omap2420 SDP
 
   2. Omap2430 SDP
 
   3. Omap3430 SDP
 
   4. Omap4 Blaze
 
   Tested-by: Sourav Poddar sourav.pod...@ti.com

Thanks.  It's also important to ascertain which filesystems were tested -
could you let me know please?
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Poddar, Sourav
On Mon, Jan 24, 2011 at 3:58 PM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:
 On Mon, Jan 24, 2011 at 02:27:24PM +0530, Poddar, Sourav wrote:
 On Mon, Jan 24, 2011 at 2:08 PM, Poddar, Sourav sourav.pod...@ti.com wrote:
  On Sun, Jan 23, 2011 at 3:05 PM, Russell King - ARM Linux
  li...@arm.linux.org.uk wrote:
  On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
  At least another person did post results:
 
  http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
  http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com
 
  Slightly different patch - there were three revisions.  I can't attach
  a tested-by given to a different patch to this one.
 
   That means omap2plus_defconfig .38 mainline kernels
   (including -stable) will remain potentially dangerous when run on
   SMP capable hardware.
 
  I must admit that this series looks a bit large for stable IMHO.  I
  think that the fix for stable should limit itself only to prevent SMP
  from being selected if anything else than CPU_32v6K is selected.
 
  The first three are the bare minimum required for -stable.
 
 

  Boot tested the 14 patch series  with CONFIG_SWP_EMULATE enabled, on
  the following boards :


   1. Omap2420 SDP

   2. Omap2430 SDP

   3. Omap3430 SDP

   4. Omap4 Blaze

   Tested-by: Sourav Poddar sourav.pod...@ti.com

 Thanks.  It's also important to ascertain which filesystems were tested -
 could you let me know please?


It is a custom filesystem on BusyBox v1.17.2.
Please let me know if you need some other
information.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Russell King - ARM Linux
On Mon, Jan 24, 2011 at 07:17:54PM +0530, Poddar, Sourav wrote:
 On Mon, Jan 24, 2011 at 3:58 PM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
  On Mon, Jan 24, 2011 at 02:27:24PM +0530, Poddar, Sourav wrote:
  On Mon, Jan 24, 2011 at 2:08 PM, Poddar, Sourav sourav.pod...@ti.com 
  wrote:
   On Sun, Jan 23, 2011 at 3:05 PM, Russell King - ARM Linux
   li...@arm.linux.org.uk wrote:
   On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
   At least another person did post results:
  
   http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
   http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com
  
   Slightly different patch - there were three revisions.  I can't attach
   a tested-by given to a different patch to this one.
  
That means omap2plus_defconfig .38 mainline kernels
(including -stable) will remain potentially dangerous when run on
SMP capable hardware.
  
   I must admit that this series looks a bit large for stable IMHO.  I
   think that the fix for stable should limit itself only to prevent SMP
   from being selected if anything else than CPU_32v6K is selected.
  
   The first three are the bare minimum required for -stable.
  
  
 
   Boot tested the 14 patch series  with CONFIG_SWP_EMULATE enabled, on
   the following boards :
 
 
    1. Omap2420 SDP
 
    2. Omap2430 SDP
 
    3. Omap3430 SDP
 
    4. Omap4 Blaze
 
    Tested-by: Sourav Poddar sourav.pod...@ti.com
 
  Thanks.  It's also important to ascertain which filesystems were tested -
  could you let me know please?
 
 
 It is a custom filesystem on BusyBox v1.17.2.

So you wrote code under fs/ for this filesystem?

 Please let me know if you need some other
 information.

I'm trying to find out what _type_ of filesystem.  ext2, ext3, nfs, cramfs,
etc.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Poddar, Sourav
On Mon, Jan 24, 2011 at 7:41 PM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:
 On Mon, Jan 24, 2011 at 07:17:54PM +0530, Poddar, Sourav wrote:
 On Mon, Jan 24, 2011 at 3:58 PM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
  On Mon, Jan 24, 2011 at 02:27:24PM +0530, Poddar, Sourav wrote:
  On Mon, Jan 24, 2011 at 2:08 PM, Poddar, Sourav sourav.pod...@ti.com 
  wrote:
   On Sun, Jan 23, 2011 at 3:05 PM, Russell King - ARM Linux
   li...@arm.linux.org.uk wrote:
   On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
   At least another person did post results:
  
   http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
   http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com
  
   Slightly different patch - there were three revisions.  I can't attach
   a tested-by given to a different patch to this one.
  
That means omap2plus_defconfig .38 mainline kernels
(including -stable) will remain potentially dangerous when run on
SMP capable hardware.
  
   I must admit that this series looks a bit large for stable IMHO.  I
   think that the fix for stable should limit itself only to prevent SMP
   from being selected if anything else than CPU_32v6K is selected.
  
   The first three are the bare minimum required for -stable.
  
  
 
   Boot tested the 14 patch series  with CONFIG_SWP_EMULATE enabled, on
   the following boards :
 
 
    1. Omap2420 SDP
 
    2. Omap2430 SDP
 
    3. Omap3430 SDP
 
    4. Omap4 Blaze
 
    Tested-by: Sourav Poddar sourav.pod...@ti.com
 
  Thanks.  It's also important to ascertain which filesystems were tested -
  could you let me know please?
 

 It is a custom filesystem on BusyBox v1.17.2.

 So you wrote code under fs/ for this filesystem?

No.

 Please let me know if you need some other
 information.

 I'm trying to find out what _type_ of filesystem.  ext2, ext3, nfs, cramfs,
 etc.


nfs filesystem.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-24 Thread Russell King - ARM Linux
On Mon, Jan 24, 2011 at 08:24:41PM +0530, Poddar, Sourav wrote:
 nfs filesystem.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-23 Thread Russell King - ARM Linux
On Sat, Jan 22, 2011 at 11:44:59PM -0500, Nicolas Pitre wrote:
 At least another person did post results:
 
 http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
 http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com

Slightly different patch - there were three revisions.  I can't attach
a tested-by given to a different patch to this one.

  That means omap2plus_defconfig .38 mainline kernels
  (including -stable) will remain potentially dangerous when run on
  SMP capable hardware.
 
 I must admit that this series looks a bit large for stable IMHO.  I 
 think that the fix for stable should limit itself only to prevent SMP 
 from being selected if anything else than CPU_32v6K is selected.

The first three are the bare minimum required for -stable.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-22 Thread Russell King - ARM Linux
On Mon, Jan 17, 2011 at 07:21:40PM +, Russell King - ARM Linux wrote:
 Switch the set/clear/change bitops to use the word-based exclusive
 operations, which are only present in a wider range of ARM architectures
 than the byte-based exclusive operations.
 
 Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk

As only one person replied to this patch with test information, I'm
not happy to push this into -rc, and hence that prevents it going into
-stable too.  That means omap2plus_defconfig .38 mainline kernels
(including -stable) will remain potentially dangerous when run on
SMP capable hardware.

Therefore, I see no alternative at the moment but to purposely cause
builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from
data corruption.

Please get your tested-by's to me for at least the first three patches
of this series ASAP.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-22 Thread Nicolas Pitre
On Sun, 23 Jan 2011, Russell King - ARM Linux wrote:

 On Mon, Jan 17, 2011 at 07:21:40PM +, Russell King - ARM Linux wrote:
  Switch the set/clear/change bitops to use the word-based exclusive
  operations, which are only present in a wider range of ARM architectures
  than the byte-based exclusive operations.
  
  Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
 
 As only one person replied to this patch with test information, I'm
 not happy to push this into -rc, and hence that prevents it going into
 -stable too.  

At least another person did post results:

http://mid.gmane.org/20110117094602.ga2...@pulham.picochip.com
http://mid.gmane.org/20110117110308.gc2...@pulham.picochip.com

 That means omap2plus_defconfig .38 mainline kernels
 (including -stable) will remain potentially dangerous when run on
 SMP capable hardware.

I must admit that this series looks a bit large for stable IMHO.  I 
think that the fix for stable should limit itself only to prevent SMP 
from being selected if anything else than CPU_32v6K is selected.

This looks perfectly reasonable for 2.6.38-rc to me though.


Nicolas
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex

2011-01-17 Thread Nicolas Pitre
On Mon, 17 Jan 2011, Russell King - ARM Linux wrote:

 Switch the set/clear/change bitops to use the word-based exclusive
 operations, which are only present in a wider range of ARM architectures
 than the byte-based exclusive operations.
 
 Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk

Reviewed-by: Nicolas Pitre nicolas.pi...@linaro.org

Also heavily tested on an ext3 fs read-write, using a LE host.

 ---
  arch/arm/include/asm/bitops.h |   60 
 +++--
  arch/arm/kernel/armksyms.c|   18 
  arch/arm/lib/bitops.h |   38 +
  arch/arm/lib/changebit.S  |   10 +-
  arch/arm/lib/clearbit.S   |   11 +--
  arch/arm/lib/setbit.S |   11 +--
  arch/arm/lib/testchangebit.S  |9 ++
  arch/arm/lib/testclearbit.S   |9 ++
  arch/arm/lib/testsetbit.S |9 ++
  9 files changed, 63 insertions(+), 112 deletions(-)
 
 diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
 index 7b1bb2b..af54ed1 100644
 --- a/arch/arm/include/asm/bitops.h
 +++ b/arch/arm/include/asm/bitops.h
 @@ -149,14 +149,18 @@ atomic_test_and_change_bit(unsigned int bit, 
 volatile unsigned long *p)
   */
  
  /*
 + * Native endian assembly bitops.  nr = 0 - word 0 bit 0.
 + */
 +extern void _set_bit(int nr, volatile unsigned long * p);
 +extern void _clear_bit(int nr, volatile unsigned long * p);
 +extern void _change_bit(int nr, volatile unsigned long * p);
 +extern int _test_and_set_bit(int nr, volatile unsigned long * p);
 +extern int _test_and_clear_bit(int nr, volatile unsigned long * p);
 +extern int _test_and_change_bit(int nr, volatile unsigned long * p);
 +
 +/*
   * Little endian assembly bitops.  nr = 0 - byte 0 bit 0.
   */
 -extern void _set_bit_le(int nr, volatile unsigned long * p);
 -extern void _clear_bit_le(int nr, volatile unsigned long * p);
 -extern void _change_bit_le(int nr, volatile unsigned long * p);
 -extern int _test_and_set_bit_le(int nr, volatile unsigned long * p);
 -extern int _test_and_clear_bit_le(int nr, volatile unsigned long * p);
 -extern int _test_and_change_bit_le(int nr, volatile unsigned long * p);
  extern int _find_first_zero_bit_le(const void * p, unsigned size);
  extern int _find_next_zero_bit_le(const void * p, int size, int offset);
  extern int _find_first_bit_le(const unsigned long *p, unsigned size);
 @@ -165,12 +169,6 @@ extern int _find_next_bit_le(const unsigned long *p, int 
 size, int offset);
  /*
   * Big endian assembly bitops.  nr = 0 - byte 3 bit 0.
   */
 -extern void _set_bit_be(int nr, volatile unsigned long * p);
 -extern void _clear_bit_be(int nr, volatile unsigned long * p);
 -extern void _change_bit_be(int nr, volatile unsigned long * p);
 -extern int _test_and_set_bit_be(int nr, volatile unsigned long * p);
 -extern int _test_and_clear_bit_be(int nr, volatile unsigned long * p);
 -extern int _test_and_change_bit_be(int nr, volatile unsigned long * p);
  extern int _find_first_zero_bit_be(const void * p, unsigned size);
  extern int _find_next_zero_bit_be(const void * p, int size, int offset);
  extern int _find_first_bit_be(const unsigned long *p, unsigned size);
 @@ -180,33 +178,26 @@ extern int _find_next_bit_be(const unsigned long *p, 
 int size, int offset);
  /*
   * The __* form of bitops are non-atomic and may be reordered.
   */
 -#define  ATOMIC_BITOP_LE(name,nr,p)  \
 - (__builtin_constant_p(nr) ? \
 -  atomic_##name(nr, p) : \
 -  _##name##_le(nr,p))
 -
 -#define  ATOMIC_BITOP_BE(name,nr,p)  \
 - (__builtin_constant_p(nr) ? \
 -  atomic_##name(nr, p) : \
 -  _##name##_be(nr,p))
 +#define ATOMIC_BITOP(name,nr,p)  \
 + (__builtin_constant_p(nr) ? atomic_##name(nr, p) : _##name(nr,p))
  #else
 -#define ATOMIC_BITOP_LE(name,nr,p)   _##name##_le(nr,p)
 -#define ATOMIC_BITOP_BE(name,nr,p)   _##name##_be(nr,p)
 +#define ATOMIC_BITOP(name,nr,p)  _##name(nr,p)
  #endif
  
 -#define NONATOMIC_BITOP(name,nr,p)   \
 - (nonatomic_##name(nr, p))
 +/*
 + * Native endian atomic definitions.
 + */
 +#define set_bit(nr,p)ATOMIC_BITOP(set_bit,nr,p)
 +#define clear_bit(nr,p)  ATOMIC_BITOP(clear_bit,nr,p)
 +#define change_bit(nr,p) ATOMIC_BITOP(change_bit,nr,p)
 +#define test_and_set_bit(nr,p)   
 ATOMIC_BITOP(test_and_set_bit,nr,p)
 +#define test_and_clear_bit(nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p)
 +#define test_and_change_bit(nr,p)ATOMIC_BITOP(test_and_change_bit,nr,p)
  
  #ifndef __ARMEB__
  /*
   * These are the little endian, atomic definitions.
   */
 -#define set_bit(nr,p)ATOMIC_BITOP_LE(set_bit,nr,p)
 -#define clear_bit(nr,p)  ATOMIC_BITOP_LE(clear_bit,nr,p)
 -#define change_bit(nr,p) ATOMIC_BITOP_LE(change_bit,nr,p)