From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFB94C48BE5 for ; Sat, 19 Jun 2021 10:51:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B17226120A for ; Sat, 19 Jun 2021 10:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232921AbhFSKxN (ORCPT ); Sat, 19 Jun 2021 06:53:13 -0400 Received: from mga06.intel.com ([134.134.136.31]:27675 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232783AbhFSKxM (ORCPT ); Sat, 19 Jun 2021 06:53:12 -0400 IronPort-SDR: neleyHUv0P0UpCfuQepCDBbOCWwZZfRRXoT3/WX8kA1H8EyaeVBDe2bUTNzN+nEZ6xOudMwVip MUA2BoDwBAaw== X-IronPort-AV: E=McAfee;i="6200,9189,10019"; a="267807102" X-IronPort-AV: E=Sophos;i="5.83,285,1616482800"; d="scan'208";a="267807102" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2021 03:51:01 -0700 IronPort-SDR: +Epd2JPzuQKVgIZ28P0AmJve4W21BtVRQil8JAZ4x25NaABZ5IMUN+kLfhxQCqkPHUVErydyTP YarFheC0k7yQ== X-IronPort-AV: E=Sophos;i="5.83,285,1616482800"; d="scan'208";a="554979339" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2021 03:50:55 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1luYYs-003nwu-RM; Sat, 19 Jun 2021 13:50:50 +0300 Date: Sat, 19 Jun 2021 13:50:50 +0300 From: Andy Shevchenko To: Yury Norov Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , Jean Delvare , Guenter Roeck , Rasmus Villemoes , Marc Zyngier , David Woodhouse , Andrew Morton , Wei Yang , Geert Uytterhoeven , Alexey Klimov , x86@kernel.org, linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org Subject: Re: [PATCH 1/3] include/linux: move for_each_bit() macros from bitops.h to find.h Message-ID: References: <20210618195735.55933-1-yury.norov@gmail.com> <20210618195735.55933-2-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618195735.55933-2-yury.norov@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 18, 2021 at 12:57:33PM -0700, Yury Norov wrote: > for_each_bit() macros depend on find_bit() machinery, and so the > proper place for them is the find.h header. Fine with me. Reviewed-by: Andy Shevchenko > Signed-off-by: Yury Norov > --- > include/linux/bitops.h | 34 ---------------------------------- > include/linux/find.h | 34 ++++++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+), 34 deletions(-) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index 26bf15e6cd35..31ae1ae1a974 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -31,40 +31,6 @@ extern unsigned long __sw_hweight64(__u64 w); > */ > #include > > -#define for_each_set_bit(bit, addr, size) \ > - for ((bit) = find_first_bit((addr), (size)); \ > - (bit) < (size); \ > - (bit) = find_next_bit((addr), (size), (bit) + 1)) > - > -/* same as for_each_set_bit() but use bit as value to start with */ > -#define for_each_set_bit_from(bit, addr, size) \ > - for ((bit) = find_next_bit((addr), (size), (bit)); \ > - (bit) < (size); \ > - (bit) = find_next_bit((addr), (size), (bit) + 1)) > - > -#define for_each_clear_bit(bit, addr, size) \ > - for ((bit) = find_first_zero_bit((addr), (size)); \ > - (bit) < (size); \ > - (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) > - > -/* same as for_each_clear_bit() but use bit as value to start with */ > -#define for_each_clear_bit_from(bit, addr, size) \ > - for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ > - (bit) < (size); \ > - (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) > - > -/** > - * for_each_set_clump8 - iterate over bitmap for each 8-bit clump with set bits > - * @start: bit offset to start search and to store the current iteration offset > - * @clump: location to store copy of current 8-bit clump > - * @bits: bitmap address to base the search on > - * @size: bitmap size in number of bits > - */ > -#define for_each_set_clump8(start, clump, bits, size) \ > - for ((start) = find_first_clump8(&(clump), (bits), (size)); \ > - (start) < (size); \ > - (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8)) > - > static inline int get_bitmask_order(unsigned int count) > { > int order; > diff --git a/include/linux/find.h b/include/linux/find.h > index 6048f8c97418..4500e8ab93e2 100644 > --- a/include/linux/find.h > +++ b/include/linux/find.h > @@ -279,4 +279,38 @@ unsigned long find_next_bit_le(const void *addr, unsigned > #error "Please fix " > #endif > > +#define for_each_set_bit(bit, addr, size) \ > + for ((bit) = find_first_bit((addr), (size)); \ > + (bit) < (size); \ > + (bit) = find_next_bit((addr), (size), (bit) + 1)) > + > +/* same as for_each_set_bit() but use bit as value to start with */ > +#define for_each_set_bit_from(bit, addr, size) \ > + for ((bit) = find_next_bit((addr), (size), (bit)); \ > + (bit) < (size); \ > + (bit) = find_next_bit((addr), (size), (bit) + 1)) > + > +#define for_each_clear_bit(bit, addr, size) \ > + for ((bit) = find_first_zero_bit((addr), (size)); \ > + (bit) < (size); \ > + (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) > + > +/* same as for_each_clear_bit() but use bit as value to start with */ > +#define for_each_clear_bit_from(bit, addr, size) \ > + for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ > + (bit) < (size); \ > + (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) > + > +/** > + * for_each_set_clump8 - iterate over bitmap for each 8-bit clump with set bits > + * @start: bit offset to start search and to store the current iteration offset > + * @clump: location to store copy of current 8-bit clump > + * @bits: bitmap address to base the search on > + * @size: bitmap size in number of bits > + */ > +#define for_each_set_clump8(start, clump, bits, size) \ > + for ((start) = find_first_clump8(&(clump), (bits), (size)); \ > + (start) < (size); \ > + (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8)) > + > #endif /*__LINUX_FIND_H_ */ > -- > 2.30.2 > -- With Best Regards, Andy Shevchenko