From: Kent Gibson <warthog618@gmail.com>
To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
brgl@bgdev.pl, linus.walleij@linaro.org, andy@kernel.org
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [PATCH v2 0/5] gpiolib: cdev: relocate debounce_period_us
Date: Thu, 14 Dec 2023 17:58:09 +0800 [thread overview]
Message-ID: <20231214095814.132400-1-warthog618@gmail.com> (raw)
This series contains minor improvements to gpiolib-cdev.
Patch 1 replaces discrete lock/unlock calls around critical sections
with scoped_guard(). Excludes desc_gpio_to_lineinfo() as delaying
the change until patch 4 produces a cleaner change.
The banner change is relocating the debounce_period_us from gpiolib's
struct gpio_desc to cdev's struct line. Patch 2 stores the field
locally in cdev. Patch 3 removes the now unused field from gpiolib.
Patch 4 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.
Give 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.
Patch 5 is unrelated to debounce or info, but addresses Andy's
recent complaint 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 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: adopt scoped_guard()
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: improve documentation of get/set values
drivers/gpio/gpiolib-cdev.c | 403 +++++++++++++++++++++++-------------
drivers/gpio/gpiolib.c | 3 -
drivers/gpio/gpiolib.h | 5 -
3 files changed, 260 insertions(+), 151 deletions(-)
--
2.39.2
next reply other threads:[~2023-12-14 9:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 9:58 Kent Gibson [this message]
2023-12-14 9:58 ` [PATCH v2 1/5] gpiolib: cdev: adopt scoped_guard() Kent Gibson
2023-12-14 11:50 ` Kent Gibson
2023-12-14 14:53 ` Andy Shevchenko
2023-12-14 14:53 ` Andy Shevchenko
2023-12-14 9:58 ` [PATCH v2 2/5] gpiolib: cdev: relocate debounce_period_us from struct gpio_desc Kent Gibson
2023-12-14 14:29 ` Bartosz Golaszewski
2023-12-14 14:45 ` Kent Gibson
2023-12-14 14:56 ` Bartosz Golaszewski
2023-12-14 15:08 ` Kent Gibson
2023-12-14 15:03 ` Andy Shevchenko
2023-12-14 15:09 ` Andy Shevchenko
2023-12-14 16:14 ` Kent Gibson
2023-12-14 16:41 ` Andy Shevchenko
2023-12-14 21:06 ` Bartosz Golaszewski
2023-12-15 1:04 ` Kent Gibson
2023-12-15 8:07 ` Bartosz Golaszewski
2023-12-15 8:15 ` Kent Gibson
2023-12-15 16:31 ` Andy Shevchenko
2023-12-14 9:58 ` [PATCH v2 3/5] gpiolib: remove " Kent Gibson
2023-12-14 9:58 ` [PATCH v2 4/5] gpiolib: cdev: reduce locking in gpio_desc_to_lineinfo() Kent Gibson
2023-12-14 15:10 ` Andy Shevchenko
2023-12-14 15:19 ` Kent Gibson
2023-12-14 15:27 ` Andy Shevchenko
2023-12-14 15:34 ` Kent Gibson
2023-12-14 15:46 ` Kent Gibson
2023-12-14 15:52 ` Andy Shevchenko
2023-12-14 15:53 ` Kent Gibson
2023-12-14 16:02 ` Andy Shevchenko
2023-12-14 15:50 ` Andy Shevchenko
2023-12-14 16:05 ` Kent Gibson
2023-12-14 9:58 ` [PATCH v2 5/5] gpiolib: cdev: improve documentation of get/set values Kent Gibson
2023-12-14 15:12 ` Andy Shevchenko
2023-12-14 15:23 ` Kent Gibson
2023-12-14 15:27 ` Andy Shevchenko
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=20231214095814.132400-1-warthog618@gmail.com \
--to=warthog618@gmail.com \
--cc=andy@kernel.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 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).