Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4265412img; Tue, 26 Mar 2019 06:20:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/ozoXPK7LFH/mTpeU8s6/VsacwKEh3SqnZcKN9/U/i5VHtZRfivzzm5Ej90XPVk+GLqGA X-Received: by 2002:a62:29c5:: with SMTP id p188mr28840324pfp.203.1553606406094; Tue, 26 Mar 2019 06:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553606406; cv=none; d=google.com; s=arc-20160816; b=s6geDffSPz2oTNxCS14exlMkkA3mRbtSKsnMhH+o8LCQ/XGypPmKrqbzWVMXlwIoiq CFkGqeDvBrE7aJpHGjMi4QUJ6TvCpd8nNIauheDWPXY2HPSLMdB5f6tGIqEE/gbbRDkS U2gYrYA3Zo9atD8aZ23NMsnM1ySEBNEsd6+Fh+OGDaJlgobqTHprcdY/wU0swVOdneCO 9tmrObhd04R5D8mxk1md+lsjA1Xqj1FHZSHqnz0FYUUttLgiW6dZpOFjDHXb3MmyYWuE MLOXdx5I1pJ4MKSfOZ21DJqHi+Ni1DYG5BXEK39jCZ2eE96cCw/kIt09HFm+WaGLSNy7 DN+w== 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=114VJjntvzhfDG1KQmEWSAPhQs+oXU1NG+j/HaVmtt0=; b=kEDX96oMXw9yQlDfSq4FjYiGmHa8FzPQ751ppE3gpn+IzIgMQ+8Bfw7wZCJBYAiT2/ FabPQszZMCFZ6HVCV5Rw5XZyMu+kh+UhLo5rAbqMEtnEgmxN60z0ILzTgMZe9Ax6NRbF Uit8C+G2+RaWrhKX3bW9X0L6hxxLaq3rr+Yg4XAtrFNwZaqj1Lt1J0N9ndz1/wLFeLPK DZAs1mYBcl5pPSk7kNdrJmrIsS3qmkfZ/oXVFi1o4rr62OYvUMj4axGTVmtqIO0htaQ8 GASFRwt/A7tgg9fRRs4UqNqaPSOAtrZR4FUiSdoHvI9lscgHzaof5SniHaxSxHZuQl48 SFpQ== 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10si12345711pfa.285.2019.03.26.06.19.50; Tue, 26 Mar 2019 06:20:06 -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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731477AbfCZNTB (ORCPT + 99 others); Tue, 26 Mar 2019 09:19:01 -0400 Received: from mga14.intel.com ([192.55.52.115]:20074 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfCZNTB (ORCPT ); Tue, 26 Mar 2019 09:19:01 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2019 06:19:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,271,1549958400"; d="scan'208";a="145350476" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga002.jf.intel.com with ESMTP; 26 Mar 2019 06:18:56 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h8lyg-0003Gt-Sm; Tue, 26 Mar 2019 15:18:54 +0200 Date: Tue, 26 Mar 2019 15:18:54 +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: <20190326131854.GA9224@smile.fi.intel.com> References: <20190326102843.GA10264@icarus> <20190326100743.GA10005@icarus> <20190326130319.cwn5zl4e222zh6ak@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326130319.cwn5zl4e222zh6ak@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 Tue, Mar 26, 2019 at 02:03:19PM +0100, Lukas Wunner wrote: > On Tue, Mar 26, 2019 at 07:08:18PM +0900, William Breathitt Gray wrote: > > On Tue, Mar 26, 2019 at 10:43:45AM +0100, Lukas Wunner wrote: > > In this case, bitmap_get_value8 could be simplified to something like > > this: > > > > index = BIT_WORD(start); > > offset = start % BITS_PER_LONG; > > return (bitmap[index] >> offset) & 0xFF; > > Hm, shouldn't that be "offset = round_down(start, 8)" ? No, the index points to the word, the offset points to the offset inside word. > (I prefer the multi-line version FWIW.) +1 here. > > Would it be better to define bitmap_get_value8 as a macro then? > > Or a static inline. Please, no macro. It disadvantages in terms of type checking. -- With Best Regards, Andy Shevchenko