Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5269274img; Wed, 27 Mar 2019 05:32:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1LpECpv80wgywTa+eccheAsWE5t8t4P3FYdfbTvkNVqItYfYpexpvQZcasAXjK6Z1efhh X-Received: by 2002:a63:cd06:: with SMTP id i6mr34638335pgg.267.1553689925799; Wed, 27 Mar 2019 05:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553689925; cv=none; d=google.com; s=arc-20160816; b=swjRkAMNdUYtPThp2F2UZTkPr36yBcO35RdMahxQQQ94vj92Xbyy70RBaugpA2uLdV atzXzxYbyNZlotK5W/sv90+vsVhtanBRWo8xhRFdbBRJ9vI8GjpwXReeW9tmbnyaVLik 8EtUNA7oVQUf4twBnX+5/0PjJ6gZveGdj4aoBLy+tlS7A6OrbyCqQaD2wlL+4qxzA8wp Fcb/e2gf85S75PqJIG9ueWm1zdfVOO5vnsO5QCv1W5p/REYzrDuwCG4RWIsZaAzc/tME h1ikbawiBXLy5Mw5zi7g2DSUATIALovEs0+BWeCFb7jyYGujVwdMoPuPT04GvphkbEQA RTkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=kVgm8zTkP+YhB7XA51ujmady8O6JgsT3il2jCwtb1VM=; b=w3dqi8S9P2xkNkilQK1Vl9MGk2KrlWswtUsTxuMF990gWvGL2EbZo1IOfJl/My5rsI hs8S4KHFHQn3To92FXYWId6GNMVVNgT5yGITjZjIZraqFXjajFHCgBIdnLtkrR+Hb9lx Y5UKssxLjMh77SmJCJMk3fzj2KMVrC9Jai2OQO+PP5d4+GHMul4wWwbHO5z9jC3ccpRN 1W4yXRYwjwEtAKEgHjBXzYXI46RzwN8UAUJLiinSvscrw5/xC2LQjRCVnMaNNqMpmabc qMN6+PsT62HW+wcgp/L402sdvos85nDhEXlkeCElkGi82N8aUnfmp7OcL2N6RKbHQAyM FCiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id w9si16618125pgj.590.2019.03.27.05.31.50; Wed, 27 Mar 2019 05:32:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728828AbfC0MbG (ORCPT + 99 others); Wed, 27 Mar 2019 08:31:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:47487 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbfC0MbF (ORCPT ); Wed, 27 Mar 2019 08:31:05 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 05:31:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,276,1549958400"; d="scan'208";a="130597909" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga006.jf.intel.com with ESMTP; 27 Mar 2019 05:31:01 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h97hr-0007F5-48; Wed, 27 Mar 2019 14:30:59 +0200 Date: Wed, 27 Mar 2019 14:30:59 +0200 From: Andy Shevchenko To: William Breathitt Gray Cc: linus.walleij@linaro.org, bgolaszewski@baylibre.com, akpm@linux-foundation.org, linux-gpio@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk, yamada.masahiro@socionext.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, geert@linux-m68k.org, preid@electromag.com.au, Lukas Wunner , Arnd Bergmann Subject: Re: [PATCH v13 01/11] bitops: Introduce the for_each_set_clump8 macro Message-ID: <20190327123059.GI9224@smile.fi.intel.com> References: <497dc4b5b1f668b54e008e10a43d4108f4a41213.1553661964.git.vilhelm.gray@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <497dc4b5b1f668b54e008e10a43d4108f4a41213.1553661964.git.vilhelm.gray@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2019 at 01:58:45PM +0900, William Breathitt Gray wrote: > This macro iterates for each 8-bit group of bits (clump) with set bits, > within a bitmap memory region. For each iteration, "start" is set to the > bit offset of the found clump, while the respective clump value is > stored to the location pointed by "clump". Additionally, the > bitmap_get_value8 and bitmap_set_value8 functions are introduced to > respectively get and set an 8-bit value in a bitmap memory region. > +unsigned long bitmap_get_value8(const unsigned long *addr, unsigned long start) > +{ > + const size_t idx = BIT_WORD(start); > + const unsigned long offset = start % BITS_PER_LONG; > + > + return (addr[idx] >> offset) & 0xFF; I would spell index instead of idx, but it's minor and up to you. > +} -- With Best Regards, Andy Shevchenko