Skip to content

Commit 285678c

Browse files
author
Bartosz Golaszewski
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent f4af167 commit 285678c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpio/gpiolib-sysfs.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <linux/gpio/consumer.h>
2222
#include <linux/gpio/driver.h>
2323

24+
#include <uapi/linux/gpio.h>
25+
2426
#include "gpiolib.h"
2527
#include "gpiolib-sysfs.h"
2628

@@ -471,10 +473,12 @@ static ssize_t export_store(const struct class *class,
471473
}
472474

473475
status = gpiod_export(desc, true);
474-
if (status < 0)
476+
if (status < 0) {
475477
gpiod_free(desc);
476-
else
478+
} else {
477479
set_bit(FLAG_SYSFS, &desc->flags);
480+
gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_REQUESTED);
481+
}
478482

479483
done:
480484
if (status)

0 commit comments

Comments
 (0)