diff options
Diffstat (limited to 'include/asm-generic/bitops')
| -rw-r--r-- | include/asm-generic/bitops/atomic.h | 2 | ||||
| -rw-r--r-- | include/asm-generic/bitops/const_hweight.h | 17 | ||||
| -rw-r--r-- | include/asm-generic/bitops/find.h | 12 | ||||
| -rw-r--r-- | include/asm-generic/bitops/lock.h | 2 | 
4 files changed, 21 insertions, 12 deletions
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h index 9ae6c34dc19..49673510b48 100644 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h @@ -80,7 +80,7 @@ static inline void set_bit(int nr, volatile unsigned long *addr)   *   * clear_bit() is atomic and may not be reordered.  However, it does   * not contain a memory barrier, so if it is used for locking purposes, - * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() + * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic()   * in order to ensure changes are visible on other processors.   */  static inline void clear_bit(int nr, volatile unsigned long *addr) diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h index fa2a50b7ee6..0a7e0662347 100644 --- a/include/asm-generic/bitops/const_hweight.h +++ b/include/asm-generic/bitops/const_hweight.h @@ -5,14 +5,15 @@   * Compile time versions of __arch_hweightN()   */  #define __const_hweight8(w)		\ -      (	(!!((w) & (1ULL << 0))) +	\ -	(!!((w) & (1ULL << 1))) +	\ -	(!!((w) & (1ULL << 2))) +	\ -	(!!((w) & (1ULL << 3))) +	\ -	(!!((w) & (1ULL << 4))) +	\ -	(!!((w) & (1ULL << 5))) +	\ -	(!!((w) & (1ULL << 6))) +	\ -	(!!((w) & (1ULL << 7)))	) +	((unsigned int)			\ +	 ((!!((w) & (1ULL << 0))) +	\ +	  (!!((w) & (1ULL << 1))) +	\ +	  (!!((w) & (1ULL << 2))) +	\ +	  (!!((w) & (1ULL << 3))) +	\ +	  (!!((w) & (1ULL << 4))) +	\ +	  (!!((w) & (1ULL << 5))) +	\ +	  (!!((w) & (1ULL << 6))) +	\ +	  (!!((w) & (1ULL << 7)))))  #define __const_hweight16(w) (__const_hweight8(w)  + __const_hweight8((w)  >> 8 ))  #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16)) diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h index 71c778033f5..998d4d544f1 100644 --- a/include/asm-generic/bitops/find.h +++ b/include/asm-generic/bitops/find.h @@ -7,6 +7,9 @@   * @addr: The address to base the search on   * @offset: The bitnumber to start searching at   * @size: The bitmap size in bits + * + * Returns the bit number for the next set bit + * If no bits are set, returns @size.   */  extern unsigned long find_next_bit(const unsigned long *addr, unsigned long  		size, unsigned long offset); @@ -18,6 +21,9 @@ extern unsigned long find_next_bit(const unsigned long *addr, unsigned long   * @addr: The address to base the search on   * @offset: The bitnumber to start searching at   * @size: The bitmap size in bits + * + * Returns the bit number of the next zero bit + * If no bits are zero, returns @size.   */  extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned  		long size, unsigned long offset); @@ -28,9 +34,10 @@ extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned  /**   * find_first_bit - find the first set bit in a memory region   * @addr: The address to start the search at - * @size: The maximum size to search + * @size: The maximum number of bits to search   *   * Returns the bit number of the first set bit. + * If no bits are set, returns @size.   */  extern unsigned long find_first_bit(const unsigned long *addr,  				    unsigned long size); @@ -38,9 +45,10 @@ extern unsigned long find_first_bit(const unsigned long *addr,  /**   * find_first_zero_bit - find the first cleared bit in a memory region   * @addr: The address to start the search at - * @size: The maximum size to search + * @size: The maximum number of bits to search   *   * Returns the bit number of the first cleared bit. + * If no bits are zero, returns @size.   */  extern unsigned long find_first_zero_bit(const unsigned long *addr,  					 unsigned long size); diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h index 308a9e22c80..c30266e9480 100644 --- a/include/asm-generic/bitops/lock.h +++ b/include/asm-generic/bitops/lock.h @@ -20,7 +20,7 @@   */  #define clear_bit_unlock(nr, addr)	\  do {					\ -	smp_mb__before_clear_bit();	\ +	smp_mb__before_atomic();	\  	clear_bit(nr, addr);		\  } while (0)  | 
