Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4250158img; Tue, 26 Mar 2019 06:05:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKFiJXP0kdA2thgS1rTgZfeh5uoXiOH05XaKUrTgW/nsjuSCJIZf5w4W0co1yi8bneC02c X-Received: by 2002:a63:1918:: with SMTP id z24mr4026896pgl.406.1553605520862; Tue, 26 Mar 2019 06:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553605520; cv=none; d=google.com; s=arc-20160816; b=RO4MMRmGSA0bn/CdD87f3gqOtP+tu7k76dgj1eQPYhBSzxA0nOsCWuW/BtpmVoEgjT 3Bzl4XikB4Ivab/CezW6oIMplyMbAeDPXhOKfikHeD8OXFApLNd4CiJxduAiZAYAwIoa q8iuYi+3eQUpLFuGFG9Yg373PSn5N8JYOC7D+XrlQhr3C4tuc48s7PbNDkwvPCMqAT7I zzl8o105Ve/y34BW52JSPEbrzSWZPWBBKR9kt8P4c8JgPu5AOJ4EMeVD/EBJC05QGPq9 08U+ANl9evYYfRVBDekAYnjSmep5+WzlgsSpBqeQDKmbsRQ+KYMq5wPPyhvC44XNDb1G 43/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date; bh=s5D99HyajsZG/QxT5PyDbrUcu0GtoLPY9C6tO7vVSCs=; b=UXXtTwYmslY53AUEuTLrllOwh8zsvu7nyXXToe4CU96eEwHmvLAuADLS7duirlGqRF Q8VnXoTztof8RaFTNjOIIJOkxOIbWwBLgqgJeDsAR7n4NVK7f5xAetKUN/v8I7yh63mb E7GfC21YUxvh9r4eZxae1iib67mkzYtWpWJiwSAaZ8QdvIB638ME9I1qxUD3BbvpCnUs hyjWUn+f70OraaOSrAQU0EpubH6SKs+KSQcU9bzUWjJxSqkQuco2hhoz5b/bi07KTZ+r T2XCS9i9aExQ3yDB7jF6v00nrKaQJzG227uEtWiFDtJ9mRc8jDStF+2u27M7+vxtqHQG 44KA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si15156419pgt.556.2019.03.26.06.05.05; Tue, 26 Mar 2019 06:05:20 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731551AbfCZNDW (ORCPT + 99 others); Tue, 26 Mar 2019 09:03:22 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:35371 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfCZNDW (ORCPT ); Tue, 26 Mar 2019 09:03:22 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id E41E130000CEA; Tue, 26 Mar 2019 14:03:19 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id BC46D33095; Tue, 26 Mar 2019 14:03:19 +0100 (CET) Date: Tue, 26 Mar 2019 14:03:19 +0100 From: Lukas Wunner To: William Breathitt Gray Cc: Andy Shevchenko , 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, andriy.shevchenko@linux.intel.com, 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: <20190326130319.cwn5zl4e222zh6ak@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326102843.GA10264@icarus> <20190326100743.GA10005@icarus> User-Agent: NeoMutt/20170113 (1.7.2) 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 07:08:18PM +0900, William Breathitt Gray wrote: > On Tue, Mar 26, 2019 at 10:43:45AM +0100, Lukas Wunner wrote: > > I'd try to avoid copying around the clump value and use a pointer > > to u8 instead. > > Although in this case we are handling 8-bit clumps, I anticipate device > drivers in the future which may benefit from larger size clumps (e.g. > GPIO devices with 24-bit ports). It'll be better to define clumps > similar to how we're defining bitmaps now (unsigned long *) so that we > can support these sizes if need be in the future without requiring data > type changes. It's just that copying around data in memory may be more expensive than, say, returning from a function, in which case it's usually stored in a register. > 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)" ? (I prefer the multi-line version FWIW.) > Would it be better to define bitmap_get_value8 as a macro then? Or a static inline. Thanks, Lukas