linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	 linus.walleij@linaro.org, andy@kernel.org
Subject: Re: [PATCH v4 0/5] gpiolib: cdev: relocate debounce_period_us
Date: Mon, 18 Dec 2023 16:26:07 +0100	[thread overview]
Message-ID: <CAMRc=MdwRc8Ff5kL5rpLO9ZJHuqYcJ77LgtRab3f-M7HSC+QiQ@mail.gmail.com> (raw)
In-Reply-To: <20231216001652.56276-1-warthog618@gmail.com>

On Sat, Dec 16, 2023 at 1:17 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> This series contains minor improvements to gpiolib-cdev.
>
> The banner change is relocating the debounce_period_us from gpiolib's
> struct gpio_desc to cdev's struct line.  Patch 1 stores the field
> locally in cdev.  Patch 2 removes the now unused field from gpiolib.
>
> Patch 3 is somewhat related and removes a FIXME from
> gpio_desc_to_lineinfo().  The FIXME relates to a race condition in
> the calculation of the used flag, but I would assert that from
> the userspace perspective the read operation itself is inherently racy.
> The line being reported as unused in the info provides no guarantee -
> it just an indicator that requesting the line is likely to succeed -
> assuming the line is not otherwise requested in the meantime.
> Given the overall operation is racy, trying to stamp out an unlikely
> race within the operation is pointless. Accept it as a possibility
> that has negligible side-effects and reduce the number of locks held
> simultaneously and the duration that the gpio_lock is held.
>
> Patches 1 and 3 introduce usage of guard() and scoped_guard() to cdev.
> Patch 4 replaces any remaining discrete lock/unlock calls around
> critical sections with guard() or scoped_guard().
>
> Patch 5 is unrelated to debounce or info, but addresses Andy's
> recent lamentation that the linereq get/set values functions are
> confusing and under documented.
> Figured I may as well add that while I was in there.
>
> Changes v3 -> v4:
>  (changes other than using --histogram are to patch 1)
>  - use --histogram to generate patches.
>  - include cleanup.h.
>  - make supinfo_lock static.
>  - immediately return from supinfo_to_lineinfo() if line not found.
>
> Changes v2 -> v3:
>  - reorder patches to move full adoption of guard()/scoped_guard() to
>    patch 4.
>  - use guard() rather than scoped_guard() where the scope extends to the
>    end of the function.
>  - split supinfo into supinfo_tree and supinfo_lock (patch 1).
>  - rename flags to dflags in gpio_desc_to_lineinfo() (patch 3).
>
> Changes v1 -> v2:
>  (changes are to patch 2 unless otherwise noted)
>  - adopt scoped_guard() for critical sections, inserting patch 1 and
>    updating patch 2 and 4.
>  - move rb_node field to beginning of struct line.
>  - merge struct supinfo into supinfo var declaration.
>  - move rb_tree field to beginning of struct supinfo.
>  - replace pr_warn() with WARN().
>  - drop explicit int to bool conversion in line_is_supplemental().
>  - use continue to bypass cleanup in linereq_free().
>  - fix typo in commit message (patch 4)
>
> Kent Gibson (5):
>   gpiolib: cdev: relocate debounce_period_us from struct gpio_desc
>   gpiolib: remove debounce_period_us from struct gpio_desc
>   gpiolib: cdev: reduce locking in gpio_desc_to_lineinfo()
>   gpiolib: cdev: fully adopt guard() and scoped_guard()
>   gpiolib: cdev: improve documentation of get/set values
>
>  drivers/gpio/gpiolib-cdev.c | 391 +++++++++++++++++++++++-------------
>  drivers/gpio/gpiolib.c      |   3 -
>  drivers/gpio/gpiolib.h      |   5 -
>  3 files changed, 246 insertions(+), 153 deletions(-)
>
> --
> 2.39.2
>

I just have two minor nits for patch 1/5, other than that it's ready to go.

Bart

      parent reply	other threads:[~2023-12-18 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16  0:16 [PATCH v4 0/5] gpiolib: cdev: relocate debounce_period_us Kent Gibson
2023-12-16  0:16 ` [PATCH v4 1/5] gpiolib: cdev: relocate debounce_period_us from struct gpio_desc Kent Gibson
2023-12-18 15:24   ` Bartosz Golaszewski
2023-12-18 15:40     ` Kent Gibson
2023-12-18 16:01       ` Bartosz Golaszewski
2023-12-18 16:08         ` Kent Gibson
2023-12-16  0:16 ` [PATCH v4 2/5] gpiolib: remove " Kent Gibson
2023-12-16  0:16 ` [PATCH v4 3/5] gpiolib: cdev: reduce locking in gpio_desc_to_lineinfo() Kent Gibson
2023-12-16  0:16 ` [PATCH v4 4/5] gpiolib: cdev: fully adopt guard() and scoped_guard() Kent Gibson
2023-12-16  0:16 ` [PATCH v4 5/5] gpiolib: cdev: improve documentation of get/set values Kent Gibson
2023-12-18 15:26 ` Bartosz Golaszewski [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='CAMRc=MdwRc8Ff5kL5rpLO9ZJHuqYcJ77LgtRab3f-M7HSC+QiQ@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=andy@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=warthog618@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).