Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1192446ybp; Wed, 9 Oct 2019 10:08:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9byDatW7YmeTmDa2Hn8dEtlWXN5WWIHb5rh8gn4kkQAT6XvFQbNiPih5z7+TzmGVrPp76 X-Received: by 2002:a05:6402:b03:: with SMTP id bm3mr3994907edb.112.1570640906845; Wed, 09 Oct 2019 10:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570640906; cv=none; d=google.com; s=arc-20160816; b=uBRTHf/4Y2YXEtVEvxXFSvMfzMwTuAfHrfq4P1/SWRrkVJjvt9ZmmsMlGtM5KxMGQn 5tTsFYchNiAJKvXG6yAEQidMJm/8PM/EieXONKJMWjuPLi+eTzf+vXnz2K+Ol+wHmeyy +fowAQ2hGwFWz0OLsutoxEO+kqdgdxrkSiX0uUyK7gjTlCEgC0gKYCp0P9umXjElOMjV YAKqgd8nWFnghOrFOm3wycT7/xPsTfXPdKNoXP7F+VwvJiKnRoeascoYFoscKdsc6vZQ FiIZ4WBmK4kdV3brEBB0jtkh5wekFNGFKJayKXKyvphRo4hhrC15zWCdz3vKlrOX0+6R 6g+Q== 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:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cXYEAzqhy4HyxKWCqy6LZ1LbETT8kg39/BhJJ7xImgY=; b=rR4E3R5+e94vHWsAyOCqdCSyrMdCeuYVR9tgyZ5wck+vgxqTIysBX1zXpj+eh92vLB Gsvc+fusmrGfzBTyPQms78uWIZ6DjyKrgyJ/9vDsILcpjesDMFReQWV7hJ7gN/numbC2 B3PbJW5G+BEnR0z821vWQS7jkvgF5RXSZyT0q3OGPCck0iIQY7vZgVecjJv4+3077QCR LJh/FlGEnrH3noK7gGW0i87lrVAIpTZ7onYXN4DAc3bWAQ0UZ99U6XahOde6JjjBLl5a /uJn8BhVp2Y0Jqsq+6WyW7JLTEOI77uygemOy7Nwg1qlmcxg3D2/rxrftjxQZPooMwWT 8qPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XzVmSlbV; 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=pass (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 qh16si1520491ejb.349.2019.10.09.10.07.54; Wed, 09 Oct 2019 10:08:26 -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=@gmail.com header.s=20161025 header.b=XzVmSlbV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731883AbfJIRFO (ORCPT + 99 others); Wed, 9 Oct 2019 13:05:14 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:35268 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbfJIRFO (ORCPT ); Wed, 9 Oct 2019 13:05:14 -0400 Received: by mail-yw1-f65.google.com with SMTP id r134so1086199ywg.2; Wed, 09 Oct 2019 10:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cXYEAzqhy4HyxKWCqy6LZ1LbETT8kg39/BhJJ7xImgY=; b=XzVmSlbV54ObweYND+EDGBljHGj8sj2ueCWS95v8Cm859OOOsxIuOqof31AgJZJrgP sYoUG7ZWjf0njqLgiU/hHNjEW3C0MMBKx89WWFO4DlJsMsmXm9jBIVcqPd+ZLd3OohCE KhSVBkByAnQTmF2FGZmUJkgGhHEEaZhRl6B9NyXxJUeV2DGCqJZ0MjYh5FNdExNErUXW GEbdBw/gn5VkXbsjJ7FErGQIO1W5a+kZIEUbAKx6L4oG0gifFpjsyGy6tO64qy7oFvz6 37uGRsoh98fhFqLA7+BGliNL2VfTiKSiDP9UYDDl71wQtxmr3M3OEC59H09+EJL7JJen pD0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cXYEAzqhy4HyxKWCqy6LZ1LbETT8kg39/BhJJ7xImgY=; b=LCvPtMumfKNP3A8dkOFeffqUuv80fN7PyFhiTl61Z/TwINmYrVqfJt9VYPRBDtzXrp ZH5vrlOozTPyvqQ5lYvKRLjm/+1a6MSgAldxvfHPuGwsEzyGuFGPjqCIYfQfg3p+6nWJ 1/YaKP2ilapc9Zvd9wuZ+ChtJqAQZGuVrIdC4yitdHgstJLb93Zw30kWzjJ2lMElNocB E4qwecSB5lAemO/AZjQ8po9xpDmrD8Q2mUHuNO8710J0Rn1re0EhmIcUuK8KpvvQ/B8m 3Gu3cP66XlYPtM8zr1ul5XRvsp9WTG0bRBCDfKd4l5/v4MHFEjh8yR3vvIvk+RPCfRUN s2GQ== X-Gm-Message-State: APjAAAVQ00+TOWBqUIyNg+eJTv8EIt5+x4vliiVSAf4lTa/unE4NVELT 0rD2V6UZZsoG6oc1Wn1tKnI= X-Received: by 2002:a0d:e1c2:: with SMTP id k185mr3552287ywe.103.1570640712141; Wed, 09 Oct 2019 10:05:12 -0700 (PDT) Received: from icarus (072-189-084-142.res.spectrum.com. [72.189.84.142]) by smtp.gmail.com with ESMTPSA id u67sm682257ywf.44.2019.10.09.10.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 10:05:11 -0700 (PDT) Date: Wed, 9 Oct 2019 13:05:08 -0400 From: William Breathitt Gray To: Masahiro Yamada 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 Subject: Re: [PATCH v17 09/14] gpio: uniphier: Utilize for_each_set_clump8 macro Message-ID: <20191009170508.GB93820@icarus> References: <271a7735b02b6a8b1f54c018e38ea932d1fd299e.1570633189.git.vilhelm.gray@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) 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 01:33:06AM +0900, Masahiro Yamada wrote: > 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. No problem, I'll update this patch to declare them all on the same line. William Breathitt Gray > > - 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