Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3216059img; Mon, 25 Mar 2019 06:10:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRGEAgV5iDFqhCTpAHC6XBxE1+5YzE8OawxvLynny/R3r4dQPkB2z5BKTQqFsme++3XIzz X-Received: by 2002:a17:902:e101:: with SMTP id cc1mr13195830plb.129.1553519432210; Mon, 25 Mar 2019 06:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553519432; cv=none; d=google.com; s=arc-20160816; b=AGHN1rVujB3WA54PmyuvpgXy4VvE1k9iQDYkVPf569ywfJWVQsyYR1iPXGNArkGHqN SOLCdYBetY5uAuEkDJzxv29VHyjUtaJQMfeQ7u1J+tvRqBrb9w3Fk4fPeRk7Jv1OvLFb 6kRadRngZl0BKcr3o2iyi/Wfr3W7StAGtfQhZ7ZwXvVKaP8RQnI5DQrcIqOIyRD9qTNb iQuE/KadLX0yCWpcMK44fep0aX5v3MxqNXz64NjXZy+Ht6/IDmgWRsxV3t3ppZmSOTvs nSfJGSri+zLZEEXoN/MX25ovcY2BN7PCTe3BMBLEIW9Gn4LD1DnuYSIJXt0TQUurfz4s EPYw== 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=xGlenYuMUCr7l+elPCSDtDu3eUxFA7kREYsvz8+oJvY=; b=Y87cn4mwWMCWYAQsnTdKRr9RcWHk1oapp4TOskvhAWDCjvCV4cT8CPStE9CTP3D+ln usriYecVHdpmsXDXV3zfvorRv1+MHmB7atvIrK6R/mSsbvn656PBKc734bnCM7RAvtm0 fWU1N5cp/GVk0544E32iCS6bDfzHN+cqRl8M4+eWD6d0hHVMvX25XTJnzMZ1zuFxjFWp 6+2dC8yBSb6qtN9WsckzdTalpQpgJmCgETYT3gPjB60enj9CmqvmR+d3cj+4GiFO/hLb WKTJJ6LlgXUXbUOeZIhooAgMQ/yvDm2cbGmiHlWUBIB1oR2++itOVLHb448ugSmVySgt Yo5A== 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 z20si13925557pgf.324.2019.03.25.06.10.16; Mon, 25 Mar 2019 06:10:32 -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 S1731236AbfCYNJk (ORCPT + 99 others); Mon, 25 Mar 2019 09:09:40 -0400 Received: from mga06.intel.com ([134.134.136.31]:45258 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731158AbfCYNJk (ORCPT ); Mon, 25 Mar 2019 09:09:40 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 06:09:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="129980440" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga006.jf.intel.com with ESMTP; 25 Mar 2019 06:09:35 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h8PM5-0005ti-3q; Mon, 25 Mar 2019 15:09:33 +0200 Date: Mon, 25 Mar 2019 15:09:33 +0200 From: Andy Shevchenko To: Lukas Wunner Cc: William Breathitt Gray , 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, Arnd Bergmann Subject: Re: [PATCH v12 01/11] bitops: Introduce the for_each_set_clump8 macro Message-ID: <20190325130933.GU9224@smile.fi.intel.com> References: <9afc30a574ce3e6a86b51dd522146a1d2156dedd.1553494625.git.vilhelm.gray@gmail.com> <20190325093854.jzkkwaksxi7zvtrg@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190325093854.jzkkwaksxi7zvtrg@wunner.de> 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 Mon, Mar 25, 2019 at 10:38:54AM +0100, Lukas Wunner wrote: > On Mon, Mar 25, 2019 at 03:22:23PM +0900, William Breathitt Gray wrote: > > +/** > > + * find_next_clump8 - find next 8-bit clump with set bits in a memory region > > + * @clump: location to store copy of found clump > > + * @addr: address to base the search on > > + * @offset: bit offset at which to start searching > > + * @size: bitmap size in number of bits > > + * > > + * Returns the bit offset for the next set clump; the found clump value is > > + * copied to the location pointed by @clump. If no bits are set, returns @size. > > + */ > > +unsigned int find_next_clump8(unsigned long *const clump, > > + const unsigned long *const addr, > > + unsigned int offset, const unsigned int size) > > +{ > > + for (; offset < size; offset += 8) { > > + *clump = bitmap_get_value8(addr, size, offset); > > + if (!*clump) > > + continue; > > + > > + return offset; > > + } > > + > > + return size; > > +} > > +EXPORT_SYMBOL(find_next_clump8); > > Just use find_first_bit() / find_next_bit() to use optimized arch-specific > bitops instead of open-coding the iteration over the bitmap. > > See max3191x_get_multiple() for an example. Actually a good point. -- With Best Regards, Andy Shevchenko