Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp891729imm; Thu, 4 Oct 2018 05:11:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV60rz6awSXQ3r6aWmazxQbgLvfOPu2oCBprUiLZDWmnB7ARWJEaUnlSOrRxRXNWZ/x3tGPbC X-Received: by 2002:a63:fe13:: with SMTP id p19-v6mr5463804pgh.265.1538655095395; Thu, 04 Oct 2018 05:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538655095; cv=none; d=google.com; s=arc-20160816; b=f39Ksg3S5C0aDoPC8EeaoLEByTK/NTL93I245dNzK98dmIDs/RVisazXc5+5/1wDBO S8Fcw0vbtEdNF1/8pJNOCfYqS7hBqU9+UVrl/Tm6J8ZcTUhvnCQLMRHya1JSx18V0/hu lcxIwk2UusGy1Qr8EH7wof50BYHdP/B4hhaTI8HAXdZKo0ycXN8XcizImvTGTWeJO4LU CJMI2FaWezVLRTkiuBWHDB13RcU/7S2HwKBEs6hLSu233GRCF/gBmfbaCWPxkwjVOMn1 ZTnuPR7KQmKAxGkavloxPLTmP2azfTwni8FqO6aiezt0qiwPQ0ecQpNJqI49J4tC3aCT sVPA== 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=grQPusvraz0G7OTK9uW7Fl4nXsRIN6mhnHxjFc34L14=; b=b62oZbslIgL2uqHtXYvISuLpmdne+icoObxmhh4DGsK3uoqiNDUprZWTFk3nOVkqvy 4AqWCxUQ78CzuR1O3zjplQhUQuqodzyeN53dsajfQ3rb4eLDL7HirkbuMc+2pNhDDVeD Mf6wQxMKrXDBqSc5bP3mQvklb5Ptjvk3F7ea19Fvrb28Xi0Gd6JLodxsIVG70IeBTgvC rzz3APjUNZtLE37aZ0/EElSuklS2XIkmMWc029iBgakeOeHoYLazYnISShXkZOP+C+3f qflQq1OS1Ko+xeLxenNw6UfMtWkgbyv3kxFyt5A8EpP4Epnn2FdYKp603+CnUOzNFG8w RMsw== 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 o125-v6si3452637pgo.302.2018.10.04.05.11.18; Thu, 04 Oct 2018 05:11:35 -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 S1727368AbeJDTD7 (ORCPT + 99 others); Thu, 4 Oct 2018 15:03:59 -0400 Received: from mga18.intel.com ([134.134.136.126]:38447 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727203AbeJDTD6 (ORCPT ); Thu, 4 Oct 2018 15:03:58 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 05:10:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,338,1534834800"; d="scan'208";a="268409948" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga005.fm.intel.com with ESMTP; 04 Oct 2018 05:10:47 -0700 Received: from andy by smile with local (Exim 4.91) (envelope-from ) id 1g82Ss-0007tM-9i; Thu, 04 Oct 2018 15:10:46 +0300 Date: Thu, 4 Oct 2018 15:10:46 +0300 From: Andy Shevchenko To: William Breathitt Gray Cc: Rasmus Villemoes , linus.walleij@linaro.org, akpm@linux-foundation.org, linux-gpio@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: Re: [RESEND PATCH v4 1/8] bitops: Introduce the for_each_set_clump macro Message-ID: <20181004121046.GT15943@smile.fi.intel.com> References: <40ecad49-2797-0d30-b52d-a2e6838dc1ab@rasmusvillemoes.dk> <20181002082142.GC15943@smile.fi.intel.com> <20181003114804.GE15943@smile.fi.intel.com> <20181004103620.GB4779@icarus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181004103620.GB4779@icarus> 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 Thu, Oct 04, 2018 at 07:36:20PM +0900, William Breathitt Gray wrote: > On Wed, Oct 03, 2018 at 02:48:04PM +0300, Andy Shevchenko wrote: > > On Tue, Oct 02, 2018 at 11:21:42AM +0300, Andy Shevchenko wrote: > > > > > I would rather go with two prototypes to get()/set() a clump in the bitmap > > > in a way when it's aligned and BITS_PER_LONG % clump_size == 0. > > > > To make things much easier, restrict clump_size to the one > > from the following set: > > > > 1, 2, 4, 8, 16, 32 even on 64-bit platforms. > > > > If it would be simpler solution to add 64 here (implying 32-bit platform), > > I would vote for that. > > > > For the generic case we might need something like: > > > > unsigned long bitmap_get_bits(unsigned long *src, unsigned int start, unsigned int nbits) > > { > > assert(nbits > BITS_PER_LONG); > > > > /* Something like Rasmus proposed earlier */ > > } > > > > And similar to setter. > > > > > > -- > > With Best Regards, > > Andy Shevchenko > > I have no objections to have a simplier macro for these common clump > sizes -- afterall, I suspect most drivers will likely use clump sizes > that are powers of 2 anyway. It would be nice to have a more versatile > macro though for those drivers that would benefit from odd clump sizes, > but we can perhaps postpone that until the need arises (the GPIO drivers > in this patchset all use a power of 2). Yes, this is my point of view: don't produce additional complexity to some which has no users (yet). When we would really have groups out of an odd bit number, we may reconsider. -- With Best Regards, Andy Shevchenko