diff mbox

[v2,2/3] bitops: drop volatile qualifier

Message ID 1bc42618f0651b6903bc0bec9a26914da30c7bcf.1341775234.git.blauwirbel@gmail.com
State New
Headers show

Commit Message

Blue Swirl July 8, 2012, 7:22 p.m. UTC
From: Blue Swirl <blauwirbel@gmail.com>

Qualifier 'volatile' is not useful for applications, it's too strict
for single threaded code but does not give the real atomicity guarantees
needed for multithreaded code.

Drop them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 bitops.h |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

Comments

Peter Maydell July 9, 2012, 7:46 a.m. UTC | #1
On 8 July 2012 20:22,  <blauwirbel@gmail.com> wrote:
> From: Blue Swirl <blauwirbel@gmail.com>
>
> Qualifier 'volatile' is not useful for applications, it's too strict
> for single threaded code but does not give the real atomicity guarantees
> needed for multithreaded code.
>
> Drop them.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
(though of course it won't apply without patch 1 and I disagree with
patch 1, so you'll need to fix up this patch if you want to apply
it on its own.)

-- PMM
diff mbox

Patch

diff --git a/bitops.h b/bitops.h
index f6ac721..bc99727 100644
--- a/bitops.h
+++ b/bitops.h
@@ -114,7 +114,7 @@  static inline unsigned int ffz(unsigned long word)
  * @nr: the bit to set
  * @addr: the address to start counting from
  */
-static inline void set_bit(unsigned int nr, volatile unsigned long *addr)
+static inline void set_bit(unsigned int nr, unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
@@ -127,7 +127,7 @@  static inline void set_bit(unsigned int nr, volatile unsigned long *addr)
  * @nr: Bit to clear
  * @addr: Address to start counting from
  */
-static inline void clear_bit(unsigned int nr, volatile unsigned long *addr)
+static inline void clear_bit(unsigned int nr, unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
@@ -140,7 +140,7 @@  static inline void clear_bit(unsigned int nr, volatile unsigned long *addr)
  * @nr: Bit to change
  * @addr: Address to start counting from
  */
-static inline void change_bit(unsigned int nr, volatile unsigned long *addr)
+static inline void change_bit(unsigned int nr, unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
@@ -153,8 +153,7 @@  static inline void change_bit(unsigned int nr, volatile unsigned long *addr)
  * @nr: Bit to set
  * @addr: Address to count from
  */
-static inline int test_and_set_bit(unsigned int nr,
-                                   volatile unsigned long *addr)
+static inline int test_and_set_bit(unsigned int nr, unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
@@ -169,8 +168,7 @@  static inline int test_and_set_bit(unsigned int nr,
  * @nr: Bit to clear
  * @addr: Address to count from
  */
-static inline int test_and_clear_bit(unsigned int nr,
-                                     volatile unsigned long *addr)
+static inline int test_and_clear_bit(unsigned int nr, unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
@@ -185,8 +183,7 @@  static inline int test_and_clear_bit(unsigned int nr,
  * @nr: Bit to change
  * @addr: Address to count from
  */
-static inline int test_and_change_bit(unsigned int nr,
-                                      volatile unsigned long *addr)
+static inline int test_and_change_bit(unsigned int nr, unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
@@ -201,8 +198,7 @@  static inline int test_and_change_bit(unsigned int nr,
  * @nr: bit number to test
  * @addr: Address to start counting from
  */
-static inline int test_bit(unsigned int nr,
-                           const volatile unsigned long *addr)
+static inline int test_bit(unsigned int nr, const unsigned long *addr)
 {
 	return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
 }