qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 2/3] bitops: drop volatile qualifier


From: blauwirbel
Subject: [Qemu-devel] [PATCH v2 2/3] bitops: drop volatile qualifier
Date: Sun, 8 Jul 2012 19:22:32 +0000

From: Blue Swirl <address@hidden>

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 <address@hidden>
---
 bitops.h |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

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)));
 }
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]