Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2475265pxj; Sat, 19 Jun 2021 13:31:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIjXRUnSrvCb4x3pUHbVulVg8xLEnWcBeIgiKpdXQ24fLDwrAf1Y47xmTMmkxxY1SxTKhw X-Received: by 2002:a05:6e02:20cb:: with SMTP id 11mr11339004ilq.132.1624134713295; Sat, 19 Jun 2021 13:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624134713; cv=none; d=google.com; s=arc-20160816; b=Ye4qdmuYiFr46aFd3L/3IlP5fB7LUcvwxUq63xd5L2YGnhuBAe2XE835t7NjhFvn7g zEvRm7Jc3tOutd0dnHsZUB62/HpYcOAIw6Lw4rfeBq5YMEfuWNkdr98qeio6O7kYtUGQ BnBflCEj4wuUe9q5D/4of1bgIkJVqh0wibke0q2J/6KhU5UyPXmd2CAU4+V6LR7XeyNu cFeQ5DaiwsIs9BjRyPPysuYmF3CZEFX27/0b5DgjU5R5czt0e+KODpWtp2QKmrVDCtS8 SNCAmAA+BIrGah8fOi5ngFPfZjPhq5ql2oBc5pttJjme8lptnEssEYX2PoTliJSL33wc i1Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=bs8Qt/BbdVh/GHt1s6UCebap8q8/TNTnXrLnCu5wLyg=; b=zSl5aY25SpIGQewIEC5DoX8fyqlnLLMKoH5BCdqqiYw+aYZkEC8KSYNCWUhJPxhxQa U+3+8z7VN74aKwYa1fXi1ca5x1/xlfs75nVdWrcdpGQIz4B25qguH1cjVP+EpUiTWNfl mX9OcmWAvHRVRx4ow3gEa1ZgxWZf+kPFfkLzvbgIkLyM2VpObOkMIiu7DHDKENJnkPO+ 2omfRqcTf7EwuqNdBHBW6m9TUTrgH9eSSdioA2TZEbS5rkVYiJzgqCLutA6Udqrib0Oi x7Tzi/DoD/eRmadUfpgcwlF7O++5JKoj69g8Cx4WZx84eJ2K5vdc1iZ53kfFbWaMFjeI UYiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si8573931ilu.120.2021.06.19.13.31.41; Sat, 19 Jun 2021 13:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232871AbhFSKxM (ORCPT + 99 others); Sat, 19 Jun 2021 06:53:12 -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