All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Mika Westerberg <westeri@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Kent Gibson <warthog618@gmail.com>
Subject: Re: [PATCH v1 2/3] gpiolib: Rename gpio_set_debounce_timeout() to gpiod_do_set_debounce()
Date: Tue, 4 Mar 2025 15:38:08 +0200	[thread overview]
Message-ID: <Z8cCQPWBmJXFgKAe@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=MfsKc+r=uhDZVbd_BW=Gs1BpaidPC1tfF6TGqcq9bgP6Q@mail.gmail.com>

On Tue, Mar 04, 2025 at 01:15:02PM +0100, Bartosz Golaszewski wrote:
> On Tue, Mar 4, 2025 at 1:00 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Mar 04, 2025 at 01:31:35PM +0200, Mika Westerberg wrote:
> > > On Tue, Mar 04, 2025 at 01:16:54PM +0200, Andy Shevchenko wrote:
> > > > On Tue, Mar 04, 2025 at 01:11:57PM +0200, Mika Westerberg wrote:
> > > > > On Tue, Mar 04, 2025 at 12:59:25PM +0200, Andy Shevchenko wrote:
> > > > > > On Tue, Mar 04, 2025 at 11:18:04AM +0200, Mika Westerberg wrote:
> > > > > > > On Mon, Mar 03, 2025 at 06:00:33PM +0200, Andy Shevchenko wrote:
> > > > > > > > In order to reduce the 'gpio' namespace when operate over GPIO descriptor
> > > > > > > > rename gpio_set_debounce_timeout() to gpiod_do_set_debounce().
> > > > > > >
> > > > > > > To me anything that has '_do_' in their name sounds like an internal static
> > > > > > > function that gets wrapped by the actual API function(s).
> > > > > > >
> > > > > > > For instance it could be
> > > > > > >
> > > > > > >   int gpio_set_debounce_timeout()
> > > > > > >   {
> > > > > > >       ...
> > > > > > >       gpiod_do_set_debounce()
> > > > > > >       ...
> > > > > > >
> > > > > > > However, gpiod_set_debounce_timeout() or gpiod_set_debounce() sounds good
> > > > > > > to me.
> > > > > >
> > > > > > Then please propose the second name for gpiod_set_config_XXX to follow
> > > > > > the same pattern. The series unifies naming and reduces the current
> > > > > > inconsistency.
> > > >
> > > > > gpiod_set_config()?
> > > >
> > > > The problem is that
> > > >
> > > > gpiod_set_debounce() and gpiod_set_config() are _existing_ public APIs.
> > > > That's why I considered "_do_" fitting the purpose.
> > >
> > > I see.
> > >
> > > Hmm, we have:
> > >
> > > int gpiod_set_debounce(struct gpio_desc *desc, unsigned int debounce)
> > > {
> > >         unsigned long config;
> > >
> > >         config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce);
> > >         return gpiod_set_config(desc, config);
> > > }
> > >
> > > and
> > >
> > > int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce)
> > > {
> > >       int ret;
> > >
> > >       ret = gpio_set_config_with_argument_optional(desc,
> > >                                                    PIN_CONFIG_INPUT_DEBOUNCE,
> > >                                                    debounce);
> > >       if (!ret)
> > >               gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_CONFIG);
> > >
> > >       return ret;
> > > }
> > >
> > > I wonder if there is an opportunity to consolidate? ;-)
> >
> > Send a patch! I would be glad to see less functions and internal APIs in
> > GPIOLIB.
> >
> 
> I'm definitely in favor of consolidation instead of renaming to
> gpiod_go_set_debounce(). If anything a better name would be:
> gpiod_set_debounce_nocheck() to indicate the actual functionality.
> 
> How about first extending gpio_set_config_with_argument() to take a
> boolean "optional" argument and removing
> gpio_set_config_with_argument_optional() altogether? Both are internal
> to drivers/gpio/ so it would have no effect on consumers.

Consider this series as a report then, I am not going to spend time on it.
Thank you for the review.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-03-04 13:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 16:00 [PATCH v1 0/3] gpiolib: Reduce 'gpio' namespace when operate over GPIOd Andy Shevchenko
2025-03-03 16:00 ` [PATCH v1 1/3] gpiolib: Align FLAG_* definitions in the struct gpio_desc Andy Shevchenko
2025-03-04  8:44   ` Linus Walleij
2025-03-03 16:00 ` [PATCH v1 2/3] gpiolib: Rename gpio_set_debounce_timeout() to gpiod_do_set_debounce() Andy Shevchenko
2025-03-04  8:44   ` Linus Walleij
2025-03-04  9:18   ` Mika Westerberg
2025-03-04 10:59     ` Andy Shevchenko
2025-03-04 11:11       ` Mika Westerberg
2025-03-04 11:16         ` Andy Shevchenko
2025-03-04 11:31           ` Mika Westerberg
2025-03-04 12:00             ` Andy Shevchenko
2025-03-04 12:15               ` Bartosz Golaszewski
2025-03-04 13:38                 ` Andy Shevchenko [this message]
2025-03-04 13:43                   ` Bartosz Golaszewski
2025-03-03 16:00 ` [PATCH v1 3/3] gpiolib: Rename gpio_do_set_config() --> gpiod_do_set_config() Andy Shevchenko
2025-03-03 16:09   ` Andy Shevchenko
2025-03-03 16:10     ` Andy Shevchenko
2025-03-04  8:45     ` Linus Walleij
2025-03-04 13:41 ` (subset) [PATCH v1 0/3] gpiolib: Reduce 'gpio' namespace when operate over GPIOd Bartosz Golaszewski

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=Z8cCQPWBmJXFgKAe@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-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=warthog618@gmail.com \
    --cc=westeri@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.