From: Simon Kagstrom <simon.kagstrom@netinsight.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4]: Define test_and_set_bit and test_and_clear bit for ARM
Date: Thu, 20 Aug 2009 10:53:34 +0200 [thread overview]
Message-ID: <20090820105334.4c78714c@marrow.netinsight.se> (raw)
In-Reply-To: <20090820104944.42dbeca7@marrow.netinsight.se>
Needed for (e.g.) ubifs support to work.
Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
---
include/asm-arm/bitops.h | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index b3a9578..b62ff90 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -18,6 +18,7 @@
#ifdef __KERNEL__
#include <asm/types.h>
+#include <asm/proc/system.h>
#define smp_mb__before_clear_bit() do { } while (0)
#define smp_mb__after_clear_bit() do { } while (0)
@@ -55,8 +56,6 @@ static inline void __change_bit(int nr, volatile void *addr)
*p ^= mask;
}
-extern int test_and_set_bit(int nr, volatile void * addr);
-
static inline int __test_and_set_bit(int nr, volatile void *addr)
{
unsigned long mask = BIT_MASK(nr);
@@ -67,7 +66,17 @@ static inline int __test_and_set_bit(int nr, volatile void *addr)
return (old & mask) != 0;
}
-extern int test_and_clear_bit(int nr, volatile void * addr);
+static inline int test_and_set_bit(int nr, volatile void * addr)
+{
+ unsigned long flags;
+ int out;
+
+ local_irq_save(flags);
+ out = __test_and_set_bit(nr, addr);
+ local_irq_restore(flags);
+
+ return out;
+}
static inline int __test_and_clear_bit(int nr, volatile void *addr)
{
@@ -79,6 +88,18 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr)
return (old & mask) != 0;
}
+static inline int test_and_clear_bit(int nr, volatile void * addr)
+{
+ unsigned long flags;
+ int out;
+
+ local_irq_save(flags);
+ out = __test_and_clear_bit(nr, addr);
+ local_irq_restore(flags);
+
+ return out;
+}
+
extern int test_and_change_bit(int nr, volatile void * addr);
static inline int __test_and_change_bit(int nr, volatile void *addr)
--
1.6.0.4
prev parent reply other threads:[~2009-08-20 8:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 8:49 [U-Boot] [PATCH v2 0/4]: bitops cleanup and fixes Simon Kagstrom
2009-08-20 8:52 ` [U-Boot] [PATCH v2 1/4]: Move __set/clear_bit from ubifs.h to bitops.h Simon Kagstrom
2009-08-20 17:44 ` Mike Frysinger
2009-08-20 18:31 ` Wolfgang Denk
2009-08-20 18:55 ` Mike Frysinger
2009-08-21 6:05 ` Simon Kagstrom
2009-08-21 6:29 ` Mike Frysinger
2009-08-21 7:03 ` Simon Kagstrom
2009-08-20 8:53 ` [U-Boot] [PATCH v2 2/4]: Make arm bitops endianness-independent Simon Kagstrom
2009-08-20 8:53 ` [U-Boot] [PATCH v2 3/4]: Define ffs/fls for all architectures Simon Kagstrom
2009-08-20 8:53 ` Simon Kagstrom [this message]
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=20090820105334.4c78714c@marrow.netinsight.se \
--to=simon.kagstrom@netinsight.net \
--cc=u-boot@lists.denx.de \
/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