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 4/5] gpiolib: simplify notifying user-space about line requests
Date: Fri, 04 Oct 2024 16:43:25 +0200 [thread overview]
Message-ID: <20241004-gpio-notify-in-kernel-events-v1-4-8ac29e1df4fe@linaro.org> (raw)
In-Reply-To: <20241004-gpio-notify-in-kernel-events-v1-0-8ac29e1df4fe@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Instead of emitting the line state change event on request in three
different places, just do it once, closer to the source: in
gpiod_request_commit().
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpiolib-cdev.c | 6 ------
drivers/gpio/gpiolib.c | 4 ++--
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index b0050250ac3a..f614a981253d 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -372,8 +372,6 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
goto out_free_lh;
}
- gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED);
-
dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
offset);
}
@@ -1842,8 +1840,6 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
lr->lines[i].edflags = edflags;
- gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED);
-
dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
offset);
}
@@ -2234,8 +2230,6 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
if (ret)
goto out_free_le;
- gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED);
-
irq = gpiod_to_irq(desc);
if (irq <= 0) {
ret = -ENODEV;
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 97346b746ef5..190ece4d6850 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2345,6 +2345,8 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label)
if (ret)
goto out_clear_bit;
+ gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED);
+
return 0;
out_clear_bit:
@@ -4365,8 +4367,6 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer,
return ERR_PTR(ret);
}
- gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED);
-
return desc;
}
--
2.43.0
next prev parent reply other threads:[~2024-10-04 14:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 14:43 [PATCH 0/5] gpio: notify user-space about config changes in the kernel Bartosz Golaszewski
2024-10-04 14:43 ` [PATCH 1/5] gpiolib: use v2 defines for line state change events Bartosz Golaszewski
2024-10-04 14:43 ` [PATCH 2/5] gpiolib: unify two loops initializing GPIO descriptors Bartosz Golaszewski
2024-10-09 16:09 ` Linus Walleij
2024-10-04 14:43 ` [PATCH 3/5] gpio: cdev: update flags at once when reconfiguring from user-space Bartosz Golaszewski
2024-10-09 16:10 ` Linus Walleij
2024-10-04 14:43 ` Bartosz Golaszewski [this message]
2024-10-05 3:46 ` [PATCH 4/5] gpiolib: simplify notifying user-space about line requests Kent Gibson
2024-10-05 9:34 ` Bartosz Golaszewski
2024-10-05 9:49 ` Kent Gibson
2024-10-04 14:43 ` [PATCH 5/5] gpiolib: notify user-space about in-kernel line state changes Bartosz Golaszewski
2024-10-05 7:46 ` Kent Gibson
2024-10-05 9:42 ` Bartosz Golaszewski
2024-10-05 9:54 ` Kent Gibson
2024-10-05 18:45 ` Bartosz Golaszewski
2024-10-05 19:11 ` Kent Gibson
2024-10-06 13:29 ` [PATCH 0/5] gpio: notify user-space about config changes in the kernel Kent Gibson
2024-10-08 8:22 ` (subset) " 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=20241004-gpio-notify-in-kernel-events-v1-4-8ac29e1df4fe@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).