From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-gpio <linux-gpio@vger.kernel.org>,
Vaibhav Gupta <vaibhavgupta40@gmail.com>
Subject: Re: [PATCH v1 1/2] gpio: pch: Use BIT() and GENMASK() where it's appropriate
Date: Wed, 15 Apr 2020 13:17:41 +0200 [thread overview]
Message-ID: <CAMpxmJWvkC0_c8ehrYbbALOXQrtx5GcCX0FuDmBCRObhkzy7dg@mail.gmail.com> (raw)
In-Reply-To: <20200409150921.GG3676135@smile.fi.intel.com>
czw., 9 kwi 2020 o 17:09 Andy Shevchenko
<andriy.shevchenko@linux.intel.com> napisał(a):
>
> On Mon, Apr 06, 2020 at 09:23:30AM +0200, Bartosz Golaszewski wrote:
> > czw., 2 kwi 2020 o 22:19 Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> napisał(a):
> > >
> > > Use BIT() and GENMASK() where it's appropriate.
> > > At the same time drop it where it's not appropriate.
>
> Thanks for review, my comments below.
>
> ...
>
> > > #define PCH_EDGE_FALLING 0
> > > -#define PCH_EDGE_RISING BIT(0)
> > > -#define PCH_LEVEL_L BIT(1)
> > > -#define PCH_LEVEL_H (BIT(0) | BIT(1))
> > > +#define PCH_EDGE_RISING 1
> > > +#define PCH_LEVEL_L 2
> > > +#define PCH_LEVEL_H 3
> >
> > If these define bitmask values for some fields in registers, then I'd
> > suggest to write it as hex numbers. I find it much more readable this
> > way.
>
> You meant
> 0x0
> 0x1
> 0x2
> 0x3
> ?
>
> But what the benefit comes out of it? There are sliding 3 bits (3 bits
> per each GPIO line), so this numbers in hex, in my opinion, will add
> a confusion: "Are they always in position 2..0 or not?"
>
> That said, I'm not against the change, but I would like to be sure
> what is the benefit.
>
Frankly this is just my personal preference. I think it's consistent
with the majority of codebase in the kernel but I won't block this
patch for that reason. Feel free to leave it like it is if you prefer
it.
Bart
next prev parent reply other threads:[~2020-04-15 11:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-02 20:18 [PATCH v1 1/2] gpio: pch: Use BIT() and GENMASK() where it's appropriate Andy Shevchenko
2020-04-02 20:18 ` [PATCH v1 2/2] gpio: pch: Get rid of unneeded variable in IRQ handler Andy Shevchenko
2020-04-06 7:23 ` [PATCH v1 1/2] gpio: pch: Use BIT() and GENMASK() where it's appropriate Bartosz Golaszewski
2020-04-09 15:09 ` Andy Shevchenko
2020-04-15 11:17 ` Bartosz Golaszewski [this message]
2020-04-15 12:01 ` 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=CAMpxmJWvkC0_c8ehrYbbALOXQrtx5GcCX0FuDmBCRObhkzy7dg@mail.gmail.com \
--to=bgolaszewski@baylibre.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=vaibhavgupta40@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).