[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McATQEVKrh=Pi6u8tSgQac85YoT=U8X6WrdRW8mXgUSyw@mail.gmail.com>
Date: Fri, 7 Feb 2025 14:43:21 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v1 1/1] gpiolib: Deduplicate some code in for_each_requested_gpio_in_range()
On Fri, Feb 7, 2025 at 2:35 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Fri, Feb 07, 2025 at 09:46:31AM +0100, Bartosz Golaszewski wrote:
> > On Tue, Feb 4, 2025 at 6:57 PM Andy Shevchenko
> > <andriy.shevchenko@...ux.intel.com> wrote:
>
> ...
>
> > > /**
> > > - * for_each_hwgpio - Iterates over all GPIOs for given chip.
> > > + * for_each_hwgpio_in_range - Iterates over all GPIOs in a given range
> > > * @_chip: Chip to iterate over.
> > > * @_i: Loop counter.
> > > + * @_base: First GPIO in the ranger.
> > > + * @_size: Amount of GPIOs to check starting from @base.
> > > * @_label: Place to store the address of the label if the GPIO is requested.
> > > * Set to NULL for unused GPIOs.
> > > */
> > > -#define for_each_hwgpio(_chip, _i, _label) \
> > > +#define for_each_hwgpio_in_range(_chip, _i, _base, _size, _label) \
> > > for (CLASS(_gpiochip_for_each_data, _data)(&_label, &_i); \
> > > - *_data.i < _chip->ngpio; \
> > > + *_data.i < _size; \
> > > (*_data.i)++, kfree(*(_data.label)), *_data.label = NULL) \
> > > if (IS_ERR(*_data.label = \
> > > - gpiochip_dup_line_label(_chip, *_data.i))) {} \
> > > + gpiochip_dup_line_label(_chip, _base + *_data.i))) {} \
> > > else
> >
> > Can you add a kerneldoc here as well, please?
>
> Sure, but it will duplicate the above.
>
Will it though? It's a separate macro with different semantics.
Bart
Powered by blists - more mailing lists