lkml.org 
[lkml]   [2021]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/1] gpiolib: Introduce for_each_gpio_desc_if() macro
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

\
 
 \ /
  Last update: 2021-05-20 12:13    [W:0.039 / U:4.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site