[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkda=vhL_LKU1BjOBkJKPuFe5YOX8cAPpzU8SaRKRw1fq-Q@mail.gmail.com>
Date: Thu, 10 Nov 2022 10:55:47 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] pinctrl: Move for_each_maps() to namespace and
hide iterator inside
On Wed, Nov 9, 2022 at 5:08 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> On Wed, Nov 09, 2022 at 05:57:24PM +0200, Andy Shevchenko wrote:
> > First of all, while for_each_maps() is private to pin control subsystem
> > it's still better to have it put into a namespace.
> >
> > Besides that, users are not relying on iterator variable, so hide it
> > inside for-loop.
>
> ...
>
> > +#define for_each_pin_map(_maps_node_, _map_) \
> > + list_for_each_entry(_maps_node_, &pinctrl_maps, node) \
> > + for (unsigned int __i = 0; \
>
> > + _map_ = &_maps_node_->maps[__i], __i < _maps_node_->num_maps; \
>
> Hmm... I think this is actually not okay, if we have maps be NULL and
> num_maps = 0, KABOOM is guaranteed.
>
> I will experiment and update this.
OK
> Meanwhile, Linus, do you think this change is useful?
Even if just a name change, it makes things better by being more
readable so yes :)
Yours,
Linus Walleij
Powered by blists - more mailing lists