Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1304693ybp; Wed, 9 Oct 2019 11:58:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlCFkocDgqC8fanZ6DdlsCtvus5G9OfEgLVBoIWBQH7WQDv7gNan5f7/1IOZtiOCVmpp5K X-Received: by 2002:a17:906:154a:: with SMTP id c10mr4174917ejd.238.1570647486157; Wed, 09 Oct 2019 11:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570647486; cv=none; d=google.com; s=arc-20160816; b=koRyWxn4xd4Qws8PHK699VCsirpv8vzbwwgaC0zUE08WzOYaACz++Lmlbzc+DOvGB/ 4aK2r5hr5au1rJWCBSBgcJohKdQsN5BpDVj0vRtRDgIyrcOYv3GYywmG03lfK5O0Ekon 8kRqeGaPyScW7vtX10R51wJwgTjI7Odt4UPl5Y0uGfTB6rW3TuJyMAt8Bq6VuIG4/DGX PxoyXjt92tqoxX0hpDUAnVC2OLczDxaP00XCCN1sq99JvDwbkxEWOFUf+c5d+j2IrD+i gUWQWiJhp6qxYAZjVeWfw41Y31XhLRtGPwzyelm4boYc9IjkR6KKltXhT1eRSIMUm9EK UT0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=g4TKfxF3gSMTnw+PLh+f5IO7ohcFZfJBiF2mQGYqIL4=; b=TpafwDdOFBoarBG1tKUmyBf/5jIw6OvlVKfeI0GZ/YEVju2lLLgqHi2FFigRGerXiC mYovFmUkg196I2kBH7WiHiiB859WovdAJ5QGOe2j7iBT7kQCDIEU93xcvHWM/yGRYOZh rGujPcf+1N7SJ7yyC1DPVftSbQE/++Wje6S7xK5KjDTN5FUloiohB9i0J9xPaIOUiTCy WJi+YntKHCiG11DYnrVTJZFOuvgoqKhjC4WhNlet5VpKkoVlrYZIgTqv9pre2YNUZk3U 5MjvVDUFmQ+p0LtXaJaF0kGd2HbDXHwLO/xufzIvAqrCtc9aWPNkr6GwlIaP1oEWPHW8 Ci5Q== 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 q5si1601611ejb.174.2019.10.09.11.57.43; Wed, 09 Oct 2019 11:58: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731703AbfJISyS (ORCPT + 99 others); Wed, 9 Oct 2019 14:54:18 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34027 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731413AbfJISyS (ORCPT ); Wed, 9 Oct 2019 14:54:18 -0400 Received: by mail-oi1-f195.google.com with SMTP id 83so2706269oii.1; Wed, 09 Oct 2019 11:54:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g4TKfxF3gSMTnw+PLh+f5IO7ohcFZfJBiF2mQGYqIL4=; b=fvCnyWfI7u+yI6IGvLa4nR6xWk1rE3qmo/Wy7gk62edUIx8BrWvyoOJ0JXTVNTSGGF 9U9a+qpFdgbmPu+a19P3pHfZT9BPiFfXPZtuhYqpBG0u6LTgKfoOLPKPb1DcLW2thKNz agaGNOSFsttv5vVbobHct8H9S8ZSmr+LSXl9MfvsWOVkivCRAmw00DgUN2O4UmauWxNH PEP/cthXvKWmKRHESGR29+204halSdE5tINsKeIiUCPd1bgQNaordS/pwRde+2aFZQMi o9wqpOzEi8A5lNHWlcVfkuKUkPZ/BI7fLynYde6YvIa+gSBv2vBCIIZ3QUQO5DlWsph8 sPGg== X-Gm-Message-State: APjAAAUyVKF4XkGsM32VrFaH2QL3qr/CTBlpwz08SBbNoC0NzholPNCR ezUu65sLX8LnRpz/ikQ2LXdzZu/h9gYijf+z2us= X-Received: by 2002:a05:6808:3b4:: with SMTP id n20mr3648987oie.131.1570647255651; Wed, 09 Oct 2019 11:54:15 -0700 (PDT) MIME-Version: 1.0 References: <893c3b4f03266c9496137cc98ac2b1bd27f92c73.1570633189.git.vilhelm.gray@gmail.com> <20191009170917.GG32742@smile.fi.intel.com> In-Reply-To: <20191009170917.GG32742@smile.fi.intel.com> From: Geert Uytterhoeven Date: Wed, 9 Oct 2019 20:54:04 +0200 Message-ID: Subject: Re: [PATCH v17 01/14] bitops: Introduce the for_each_set_clump8 macro To: Andy Shevchenko Cc: Masahiro Yamada , William Breathitt Gray , Linus Walleij , Bartosz Golaszewski , Andrew Morton , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-arch , Rasmus Villemoes , linux-arm-kernel , Linux PM mailing list , Phil Reid , Lukas Wunner , sean.nyekjaer@prevas.dk, morten.tiljeset@prevas.dk, Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Wed, Oct 9, 2019 at 7:09 PM Andy Shevchenko wrote: > On Thu, Oct 10, 2019 at 01:28:08AM +0900, Masahiro Yamada wrote: > > On Thu, Oct 10, 2019 at 12:27 AM 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. > > > Why is the return type "unsigned long" where you know > > it return the 8-bit value ? > > Because bitmap API operates on unsigned long type. This is not only > consistency, but for sake of flexibility in case we would like to introduce > more calls like clump16 or so. TBH, that doesn't convince me: those functions explicitly take/return an 8-bit value, and have "8" in their name. The 8-bit value is never really related to, retrieved from, or stored in a full "unsigned long" element of a bitmap, only to/from/in a part (byte) of it. Following your rationale, all of iowrite{8,16,32,64}*() should take an "unsigned long" value, too. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds