Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1156273ybp; Wed, 9 Oct 2019 09:35:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCCshFf/THSIxKEv9C1D5tqUSsum8UdVCIZ9Yhvr7EbRbohbNtrFJXFJE4tnyExU8DhgiS X-Received: by 2002:a17:906:3ec8:: with SMTP id d8mr3714500ejj.57.1570638917015; Wed, 09 Oct 2019 09:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570638917; cv=none; d=google.com; s=arc-20160816; b=aQTqOzK/uqfCG3BeCfmnWjtKTkjkZR4MLHIzew1pc5uEx6ZT+5rxlR/zOrNBZXRAc9 1ctfm4Oa1qGf6VzB1wxlPQ1jvPuaIU/6p935tbNEp2CIQyK441ksQKEtdT/GCoKryTd3 6bcx7C0nYvKn8asEcMuIOzdGFlrekg55ahtAT+NWERAB8QTsVAe1tsn3brXWkPT1KxAd tC3TNv3BXzryPiNmwCyCTFPqoUKU2SqIypvyufNA9IGCVvSOiG7WweZySwLA5nTi/KRy 8j7d5RQafSok+/0MWKSMcwAcN+sOfcBO17t+uQyJDixDJrarmUpgDrnz86UycGMJAgP5 U/7Q== 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:dkim-signature:dkim-filter; bh=y7V7634zQnspw5C5IJL3KPw/IDKbvhhOq4Dz/8oh3dQ=; b=EoU4ttdDX6UH/BTh123mNAF5G4XRB9OnVvdRwynP1VaSm4RBwIL4D63SYCIaLlTWCR XOpr4S7FT66DY4zBXtxxGpY9+ird8vtb8g3QKI9z4yeoIYyog0GV7/4PRHmHGHnvCzTt yxWqN0jC5KcO0K8qibMCtPYimbxPNC0a1qpPLucoPsbzdLG7pqtN4/LSu18dxLwsEpfF AjhyD6E1j9rog0OB7sidP1vFrk8vp3uQXLpeUscobJYYJXtK+zpIJsKeGjt/bYTv4LGv 2CmzDefHO4Q5x6qxoYRrCypm/w92lzgph9NuO4cn4iGzOOi7myI1TJrFDR2gu08H4S1C dV1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=MsS3ZQ20; 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 r19si1491884eji.376.2019.10.09.09.34.53; Wed, 09 Oct 2019 09:35:16 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=MsS3ZQ20; 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 S1731665AbfJIQeG (ORCPT + 99 others); Wed, 9 Oct 2019 12:34:06 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:28439 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731612AbfJIQeG (ORCPT ); Wed, 9 Oct 2019 12:34:06 -0400 Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com [209.85.217.41]) (authenticated) by conssluserg-06.nifty.com with ESMTP id x99GXhxY009609; Thu, 10 Oct 2019 01:33:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x99GXhxY009609 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570638824; bh=y7V7634zQnspw5C5IJL3KPw/IDKbvhhOq4Dz/8oh3dQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MsS3ZQ20/OfPGrsMG5IyzSZauuNMqtsxIcdmU7pNnKcntklAvx/7zJDpvaPX3+PQC YDxZTkiLEqLn9oPGmJdCvJECLI8dFyVq2vS0dsGe+NYDKgNjM05Hrg8DIctf99V1F5 oER2VyTZ4WwhcVy3va2uzGTpz1WEeicEkMdkQRSRR1CYdpYzaIJdRxHLBQqjRgfitH MDxgGdTLCElhyNuFu4PnLPyuPqRLr8VU+Ren4+1DmOGOhdSRcE8J1A6VaOTdBJlUBz ioBL50QAv0d422bx2Ik9XUFY2jy+nGel9ea8TRaSpK7S9NP5z2/0q9aiEK3cwarHwU QYnmyxZVjuxDw== X-Nifty-SrcIP: [209.85.217.41] Received: by mail-vs1-f41.google.com with SMTP id w195so1912625vsw.11; Wed, 09 Oct 2019 09:33:43 -0700 (PDT) X-Gm-Message-State: APjAAAVxi43/ISGtq51ADyXmhh9eD47DCk3WHkMiUgQ3lgcclp5iBdEZ YB6VcYqAVG0DYICVE1ioCxNCCHHVdDHJTOGVzCc= X-Received: by 2002:a05:6102:97:: with SMTP id t23mr2437001vsp.179.1570638822621; Wed, 09 Oct 2019 09:33:42 -0700 (PDT) MIME-Version: 1.0 References: <271a7735b02b6a8b1f54c018e38ea932d1fd299e.1570633189.git.vilhelm.gray@gmail.com> In-Reply-To: <271a7735b02b6a8b1f54c018e38ea932d1fd299e.1570633189.git.vilhelm.gray@gmail.com> From: Masahiro Yamada Date: Thu, 10 Oct 2019 01:33:06 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v17 09/14] gpio: uniphier: Utilize for_each_set_clump8 macro To: William Breathitt Gray Cc: Linus Walleij , Bartosz Golaszewski , Andrew Morton , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-arch , Andy Shevchenko , Rasmus Villemoes , linux-arm-kernel , Linux PM mailing list , Geert Uytterhoeven , preid@electromag.com.au, Lukas Wunner , sean.nyekjaer@prevas.dk, morten.tiljeset@prevas.dk 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 On Thu, Oct 10, 2019 at 12:27 AM William Breathitt Gray wrote: > > Replace verbose implementation in set_multiple callback with > for_each_set_clump8 macro to simplify code and improve clarity. An > improvement in this case is that banks that are not masked will now be > skipped. > > Cc: Masahiro Yamada > Signed-off-by: William Breathitt Gray > --- > drivers/gpio/gpio-uniphier.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c > index 93cdcc41e9fb..3e4b15d0231e 100644 > --- a/drivers/gpio/gpio-uniphier.c > +++ b/drivers/gpio/gpio-uniphier.c > @@ -15,9 +15,6 @@ > #include > #include > > -#define UNIPHIER_GPIO_BANK_MASK \ > - GENMASK((UNIPHIER_GPIO_LINES_PER_BANK) - 1, 0) > - > #define UNIPHIER_GPIO_IRQ_MAX_NUM 24 > > #define UNIPHIER_GPIO_PORT_DATA 0x0 /* data */ > @@ -147,15 +144,14 @@ static void uniphier_gpio_set(struct gpio_chip *chip, > static void uniphier_gpio_set_multiple(struct gpio_chip *chip, > unsigned long *mask, unsigned long *bits) > { > - unsigned int bank, shift, bank_mask, bank_bits; > - int i; > + unsigned long i; > + unsigned long bank_mask; > + unsigned long bank; > + unsigned long bank_bits; Please do not split it into multiple lines unless you need to do so. Thanks. > - for (i = 0; i < chip->ngpio; i += UNIPHIER_GPIO_LINES_PER_BANK) { > + for_each_set_clump8(i, bank_mask, mask, chip->ngpio) { > bank = i / UNIPHIER_GPIO_LINES_PER_BANK; > - shift = i % BITS_PER_LONG; > - bank_mask = (mask[BIT_WORD(i)] >> shift) & > - UNIPHIER_GPIO_BANK_MASK; > - bank_bits = bits[BIT_WORD(i)] >> shift; > + bank_bits = bitmap_get_value8(bits, i); > > uniphier_gpio_bank_write(chip, bank, UNIPHIER_GPIO_PORT_DATA, > bank_mask, bank_bits); > -- > 2.23.0 > -- Best Regards Masahiro Yamada