From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v1 1/1] gpiolib: Deduplicate some code in for_each_requested_gpio_in_range()
Date: Fri, 7 Feb 2025 16:06:12 +0200 [thread overview]
Message-ID: <Z6YTVMdfbWA57qTo@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=McATQEVKrh=Pi6u8tSgQac85YoT=U8X6WrdRW8mXgUSyw@mail.gmail.com>
On Fri, Feb 07, 2025 at 02:43:21PM +0100, Bartosz Golaszewski wrote:
> On Fri, Feb 7, 2025 at 2:35 PM Andy Shevchenko
> <andriy.shevchenko@linux.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@linux.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.
With 80%+. Whatever, I'll add it.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-02-07 14:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 17:56 [PATCH v1 1/1] gpiolib: Deduplicate some code in for_each_requested_gpio_in_range() Andy Shevchenko
2025-02-07 8:46 ` Bartosz Golaszewski
2025-02-07 13:35 ` Andy Shevchenko
2025-02-07 13:43 ` Bartosz Golaszewski
2025-02-07 14:06 ` Andy Shevchenko [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=Z6YTVMdfbWA57qTo@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.