linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	Kent Gibson <warthog618@gmail.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH v4 0/8] gpio: notify user-space about config changes in the kernel
Date: Thu, 17 Oct 2024 10:14:08 +0200	[thread overview]
Message-ID: <20241017-gpio-notify-in-kernel-events-v4-0-64bc05f3be0c@linaro.org> (raw)

We currently only emit events on changed line config to user-space on
changes made from user-space. Users have no way of getting notified
about in-kernel changes. This series improves the situation and also
contains a couple other related improvements.

This is a reworked approach which gets and stores as much info (all of
it actually, except for the pinctrl state) the moment the event occurrs
but moves the actual queueing of the event on the kfifo to a dedicated
high-priority, ordered workqueue.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Changes in v4:
- don't emit additional events when emulating open-source or open-drain
  from gpiod_direction_output(), to that end use the nonotify variants
  of gpiod_direction_input()
- store current debounce period in the GPIO line descriptor and remove
  the entire supinfo infrastructure from gpiolib-cdev.c
- fix all (hopefully) corner-cases where two reconfigure or
  requested/reconfigured events could be emitted for a single logical
  event
- emit the reconfigure event from gpio_set_debounce_timeout()
- add a patch refactoring gpio_do_set_config()
- Link to v3: https://lore.kernel.org/r/20241015-gpio-notify-in-kernel-events-v3-0-9edf05802271@linaro.org

Changes in v3:
- don't reach into pinctrl if the USED flag is already set
- reword the comment from patch 5 and move it one patch back
- don't abandon emitting the event if the GPIO chip is gone by the time
  the work is executed, just don't reach into pinctrl and return
  whatever data we already had
- Link to v2: https://lore.kernel.org/r/20241010-gpio-notify-in-kernel-events-v2-0-b560411f7c59@linaro.org

Changes in v2:
- put all line-info events emitting on a workqueue to allow queueing
  them from atomic context
- switch the notifier type used for emitting info events to atomic
- add a patch notifying user-space about drivers requesting their own
  descs
- drop patches that were picked up
- Link to v1: https://lore.kernel.org/r/20241004-gpio-notify-in-kernel-events-v1-0-8ac29e1df4fe@linaro.org

---
Bartosz Golaszewski (8):
      gpiolib: notify user-space when a driver requests its own desc
      gpiolib: unduplicate chip guard in set_config path
      gpio: cdev: go back to storing debounce period in the GPIO descriptor
      gpio: cdev: prepare gpio_desc_to_lineinfo() for being called from atomic
      gpiolib: add a per-gpio_device line state notification workqueue
      gpio: cdev: put emitting the line state events on a workqueue
      gpiolib: switch the line state notifier to atomic
      gpiolib: notify user-space about in-kernel line state changes

 drivers/gpio/gpiolib-cdev.c | 297 ++++++++++++++++++--------------------------
 drivers/gpio/gpiolib.c      | 130 ++++++++++++++-----
 drivers/gpio/gpiolib.h      |  14 ++-
 3 files changed, 239 insertions(+), 202 deletions(-)
---
base-commit: 15e7d45e786a62a211dd0098fee7c57f84f8c681
change-id: 20240924-gpio-notify-in-kernel-events-07cd912153e8

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


             reply	other threads:[~2024-10-17  8:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  8:14 Bartosz Golaszewski [this message]
2024-10-17  8:14 ` [PATCH v4 1/8] gpiolib: notify user-space when a driver requests its own desc Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 2/8] gpiolib: unduplicate chip guard in set_config path Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 3/8] gpio: cdev: go back to storing debounce period in the GPIO descriptor Bartosz Golaszewski
2024-10-17 12:44   ` Kent Gibson
2024-10-17 14:13     ` Bartosz Golaszewski
2024-10-17 14:16       ` Kent Gibson
2024-10-17 14:43         ` Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 4/8] gpio: cdev: prepare gpio_desc_to_lineinfo() for being called from atomic Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 5/8] gpiolib: add a per-gpio_device line state notification workqueue Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 6/8] gpio: cdev: put emitting the line state events on a workqueue Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 7/8] gpiolib: switch the line state notifier to atomic Bartosz Golaszewski
2024-10-17  8:14 ` [PATCH v4 8/8] gpiolib: notify user-space about in-kernel line state changes Bartosz Golaszewski
2024-10-17 12:53   ` Kent Gibson
2024-10-17 14:14     ` Bartosz Golaszewski
2024-10-17 14:20       ` Kent Gibson
2024-10-17 14:25         ` Kent Gibson
2024-10-17 14:59         ` Bartosz Golaszewski
2024-10-17 15:02           ` Kent Gibson
2024-10-17 15:04             ` Bartosz Golaszewski
2024-10-17 15:12               ` Kent Gibson

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=20241017-gpio-notify-in-kernel-events-v4-0-64bc05f3be0c@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=bartosz.golaszewski@linaro.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).