From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7906BC47404 for ; Wed, 9 Oct 2019 18:54:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AC5C20679 for ; Wed, 9 Oct 2019 18:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731713AbfJISyS (ORCPT ); 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-Google-Smtp-Source: APXvYqw1BKM4Cuxi1XA4HvctbF2Di+fHjDb86RAW85kLS3qGwPX1DixF1UEOVf5VBTH09sOtqCksZO8jSoTChcOkEKs= 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