Skip to content

Commit

Permalink
asm-generic/atomic.h: fix type used in atomic_clear_mask
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Arun Sharma <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
vapier authored and torvalds committed Jul 26, 2011
1 parent 3eea44e commit f6081bd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/asm-generic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,20 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
return c;
}

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

Expand Down

0 comments on commit f6081bd

Please sign in to comment.