linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Syed Nayyar Waris <syednwaris@gmail.com>,
	akpm@linux-foundation.org, linus.walleij@linaro.org,
	bgolaszewski@baylibre.com, michal.simek@xilinx.com,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/4] gpio: xilinx: Utilize for_each_set_clump macro
Date: Thu, 30 Apr 2020 19:32:45 -0400	[thread overview]
Message-ID: <20200430233227.GA15963@icarus> (raw)
In-Reply-To: <20200430163855.GU185537@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

On Thu, Apr 30, 2020 at 07:38:55PM +0300, Andy Shevchenko wrote:
> On Thu, Apr 30, 2020 at 09:45:14PM +0530, Syed Nayyar Waris wrote:
> > On Wed, Apr 29, 2020 at 01:21:14PM +0300, Andy Shevchenko wrote:
> > > On Wed, Apr 29, 2020 at 04:39:47AM +0530, Syed Nayyar Waris wrote:
> 
> ...
> 
> > > > +	const unsigned long state_size = BITS_PER_TYPE(*state);
> > > 
> > > This '*state' is unneeded complication, use BITS_PER_U32.
> > > 
> > > > +#define TOTAL_BITS BITS_PER_TYPE(chip->gpio_state)
> > > 
> > > This macro makes code uglier, besides the fact of absence of #undef.
> > > And also see above.
> > 
> > Thank you for your review comments. Just want to clarify, you want
> >  a new macro to be created - 'BITS_PER_U32' ?
> 
> It's already there (read bits.h).

I'm having trouble finding the BITS_PER_U32 macro; are you thinking of
BITS_PER_LONG? I don't think there are any cases where u32 is not 32
bits wide, so perhaps it'll be better to just hardcode 32 directly in
the code here to make it easier to read.

William Breathitt Gray

> 
> > Also, don't you think that with BITS_PER_TYPE(), in case later the type
> > of 'state' changes, it will be reflected in this code without any code
> > change?
> 
> If it changes the bits per type will be least issues there. The rationale
> behind is to have code readable. In proposed change it is not.
> 
> > Let me know if I have misunderstood something.
> > 
> > > 
> > > > +	DECLARE_BITMAP(old, TOTAL_BITS);
> > > > +	DECLARE_BITMAP(new, TOTAL_BITS);
> > > > +	DECLARE_BITMAP(changed, TOTAL_BITS);
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-04-30 23:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 23:03 [PATCH v3 0/4] Introduce the for_each_set_clump macro Syed Nayyar Waris
2020-04-28 23:04 ` [PATCH v3 1/4] bitops: Introduce the " Syed Nayyar Waris
2020-04-28 23:05 ` [PATCH v3 2/4] lib/test_bitmap.c: Add for_each_set_clump test cases Syed Nayyar Waris
2020-04-29 10:16   ` Andy Shevchenko
2020-04-28 23:07 ` [PATCH v3 3/4] gpio: thunderx: Utilize for_each_set_clump macro Syed Nayyar Waris
2020-04-29 10:17   ` Andy Shevchenko
2020-04-30 16:22     ` Syed Nayyar Waris
2020-04-28 23:09 ` [PATCH v3 4/4] gpio: xilinx: " Syed Nayyar Waris
2020-04-29 10:21   ` Andy Shevchenko
2020-04-30 16:15     ` Syed Nayyar Waris
2020-04-30 16:38       ` Andy Shevchenko
2020-04-30 23:32         ` William Breathitt Gray [this message]
2020-05-01 13:32           ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200430233227.GA15963@icarus \
    --to=vilhelm.gray@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=syednwaris@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).