linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Kent Gibson <warthog618@gmail.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v2 1/1] gpiolib: Introduce for_each_gpio_desc_if() macro
Date: Thu, 20 May 2021 11:41:19 +0200	[thread overview]
Message-ID: <YKYuv+pD4lgmrwdu@hovoldconsulting.com> (raw)
In-Reply-To: <YKYo5EBBDbSDiIwD@smile.fi.intel.com>

On Thu, May 20, 2021 at 12:16:20PM +0300, Andy Shevchenko wrote:
> On Thu, May 20, 2021 at 10:33:38AM +0200, Johan Hovold wrote:
> > On Thu, May 20, 2021 at 11:15:31AM +0300, Andy Shevchenko wrote:
> > > On Thu, May 20, 2021 at 11:07 AM Johan Hovold <johan@kernel.org> wrote:
> > > > On Tue, May 18, 2021 at 11:33:39AM +0300, Andy Shevchenko wrote:
> > 
> > > > The _if suffix here is too vague.
> > > >
> > > > Please use a more descriptive name so that you don't need to look at the
> > > > implementation to understand what the macro does.
> > > >
> > > > Perhaps call it
> > > >
> > > >         for_each_gpio_desc_with_flag()

> > > > or just add the more generic macro
> > > >
> > > >         for_each_gpio_desc()
> > > >
> > > > and open-code the test so that it's clear what's going on here.
> > 
> > FWIW, NAK due to the non-descriptive for_each_desc_if() name.
> 
> Btw, missed argument
> 
> ..._with_flag(..., FLAG_...)
> 
> breaks the DRY principle. If you read current code it's clear with that
> 
> _if(..., FLAG_...)

That we have precisely zero for_each_ macros with an _if suffix should
also give you a hint that this is not a good idea.

Again, you shouldn't have to look at the implementation to understand
what a helper does.

Johan

      reply	other threads:[~2021-05-20 10:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  8:33 [PATCH v2 1/1] gpiolib: Introduce for_each_gpio_desc_if() macro Andy Shevchenko
2021-05-18 23:41 ` Linus Walleij
2021-05-20  8:07 ` Johan Hovold
2021-05-20  8:15   ` Andy Shevchenko
2021-05-20  8:33     ` Johan Hovold
2021-05-20  9:03       ` Andy Shevchenko
2021-05-20  9:07         ` Andy Shevchenko
2021-05-20  9:16       ` Andy Shevchenko
2021-05-20  9:41         ` Johan Hovold [this message]

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=YKYuv+pD4lgmrwdu@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=warthog618@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).