diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-10-31 21:01:53 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-11-04 08:56:19 +0100 |
commit | 285678c947197b0a071328f9344b0312e5545e92 (patch) | |
tree | 7b5b5e3d46cac5f9599970a9dd341f74b396de4c /drivers/gpio | |
parent | f4af1671c28854bb0a400740a9c6ebacb8b9aa6b (diff) | |
download | lwn-285678c947197b0a071328f9344b0312e5545e92.tar.gz lwn-285678c947197b0a071328f9344b0312e5545e92.zip |
gpio: sysfs: emit chardev line-state events on GPIO export
We already emit a CONFIG_RELEASED event when a line is unexported over
sysfs (this is handled by gpiod_free()) but we don't do the opposite
when it's exported. This adds the missing call to
gpiod_line_state_notify().
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20241031-gpio-notify-sysfs-v4-3-142021c2195c@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-sysfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 8d726dcd6d79..329ebba3d6d4 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -21,6 +21,8 @@ #include <linux/gpio/consumer.h> #include <linux/gpio/driver.h> +#include <uapi/linux/gpio.h> + #include "gpiolib.h" #include "gpiolib-sysfs.h" @@ -471,10 +473,12 @@ static ssize_t export_store(const struct class *class, } status = gpiod_export(desc, true); - if (status < 0) + if (status < 0) { gpiod_free(desc); - else + } else { set_bit(FLAG_SYSFS, &desc->flags); + gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED); + } done: if (status) |