Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757865AbbKSGtm (ORCPT ); Thu, 19 Nov 2015 01:49:42 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:36393 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757824AbbKSGtk (ORCPT ); Thu, 19 Nov 2015 01:49:40 -0500 From: Jia He To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Andrew Morton , Rasmus Villemoes , Denys Vlasenko , Kyungmin Park , Michal Nazarewicz , Yury Norov , Tejun Heo , Martin Kepplinger , George Spelvin , Ingo Molnar , Arnd Bergmann , Jia He Subject: [PATCH v3 3/3] linux/bitmap: Replace find_fisrt_{zero_}bit with the new lightweight api Date: Thu, 19 Nov 2015 14:48:44 +0800 Message-Id: <1447915724-29709-4-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1447915724-29709-1-git-send-email-hejianet@gmail.com> References: <1447915724-29709-1-git-send-email-hejianet@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1856 Lines: 53 This is to replace find_fisrt_{zero_}bit with the new lightweight api all_bit_is_{one,zero} in bitmap_{full,empty} Signed-off-by: Jia He --- include/linux/bitmap.h | 4 ++-- include/linux/bitops.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 15524f6..8877a68 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -281,7 +281,7 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) if (small_const_nbits(nbits)) return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); - return find_first_bit(src, nbits) == nbits; + return all_bit_is_zero(src, nbits); } static inline int bitmap_full(const unsigned long *src, unsigned int nbits) @@ -289,7 +289,7 @@ static inline int bitmap_full(const unsigned long *src, unsigned int nbits) if (small_const_nbits(nbits)) return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); - return find_first_zero_bit(src, nbits) == nbits; + return all_bit_is_one(src, nbits); } static __always_inline int bitmap_weight(const unsigned long *src, unsigned int nbits) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index b881028..e34f2ff 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -214,6 +214,9 @@ static inline unsigned long __ffs64(u64 word) return __ffs((unsigned long)word); } +extern unsigned int all_bit_is_one(const unsigned long *addr, unsigned size); +extern unsigned int all_bit_is_zero(const unsigned long *addr, unsigned size); + #ifdef __KERNEL__ #ifndef set_mask_bits -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/