lkml.org 
[lkml]   [2011]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/6] asm-generic/atomic.h: fix type used in atomic_clear_mask
Date
The atomic helpers are supposed to take an atomic_t pointer, not a
random unsigned long pointer. So convert atomic_clear_mask over.

While we're here, also add some nice documentation to the func.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
include/asm-generic/atomic.h | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 5f62e28..28f5939 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -140,13 +140,20 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)

#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

-static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+/**
+ * atomic_clear_mask - Atomically clear bits in atomic variable
+ * @mask: Mask of the bits to be cleared
+ * @v: pointer of type atomic_t
+ *
+ * Atomically clears the bits set in @mask from @v
+ */
+static inline void atomic_clear_mask(unsigned long mask, atomic_t *v)
{
unsigned long flags;

mask = ~mask;
raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
- *addr &= mask;
+ v->counter &= mask;
raw_local_irq_restore(flags);
}

--
1.7.5.3


\
 
 \ /
  Last update: 2011-06-17 23:57    [W:0.089 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site