Skip to contentSkip to conversation

gpioset: reword note on post-exit behaviour

PATCH Superseded Kent Gibson 2 participants 3 messages Dec 28, 2023 – Jan 2, 2024 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpioset: reword note on post-exit behaviour

The note regarding the state of a line after gpioset exits is confusing and unhelpful to the average reader, if not outright incorrect.
A common mis-interpretation is that this behaviour is arbitrarily chosen by spiteful implementors. The note also specifies that the line reverts to default, but that is not always the case, or is at least out of the control of gpioset or libgpiod.

Reword the note to constrain the scope to that relevant to the likely reader, and to emphasize that the behaviour is inherent in the kernel GPIO interface, not in the gpioset implementation.

---
 tools/gpioset.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
tools/gpioset.c +4 -5
index 9dc5aeb..f2f9a15 100644
@@ -76,11 +76,10 @@ static void print_help(void)
 	print_period_help();
 	printf("\n");
 	printf("*Note*\n");
-	printf("    The state of a GPIO line controlled over the character device reverts to default\n");
-	printf("    when the last process referencing the file descriptor representing the device file exits.\n");
-	printf("    This means that it's wrong to run gpioset, have it exit and expect the line to continue\n");
-	printf("    being driven high or low. It may happen if given pin is floating but it must be interpreted\n");
-	printf("    as undefined behavior.\n");
+	printf("    It should not be assumed that a line will retain its state after gpioset exits.\n");
+	printf("    When a process exits, any GPIO lines it has requested are automatically released.\n");
+	printf("    Once released, the state of a line may be modified by the kernel or another process.\n");
+	printf("    To guarantee the requested value, by default gpioset does not exit.\n");
 }
 
 static int parse_drive_or_die(const char *option)
Signature · 1 line
2.39.2
#1 lore raw
Quoted 8 lines · Kent Gibson

The note regarding the state of a line after gpioset exits is confusing and unhelpful to the average reader, if not outright incorrect.
A common mis-interpretation is that this behaviour is arbitrarily chosen by spiteful implementors. The note also specifies that the line reverts to default, but that is not always the case, or is at least out of the control of gpioset or libgpiod.

Quoted 4 lines

Reword the note to constrain the scope to that relevant to the likely reader, and to emphasize that the behaviour is inherent in the kernel GPIO interface, not in the gpioset implementation.

Could've sworn I added the [libgpiod] subject prefix, but clearly not.

#2 lore raw
Quoted 10 lines · Kent Gibson
Quoted 8 lines · Kent Gibson

The note regarding the state of a line after gpioset exits is confusing and unhelpful to the average reader, if not outright incorrect.
A common mis-interpretation is that this behaviour is arbitrarily chosen by spiteful implementors. The note also specifies that the line reverts to default, but that is not always the case, or is at least out of the control of gpioset or libgpiod.

Quoted 6 lines
Quoted 4 lines

Reword the note to constrain the scope to that relevant to the likely reader, and to emphasize that the behaviour is inherent in the kernel GPIO interface, not in the gpioset implementation.

Could've sworn I added the [libgpiod] subject prefix, but clearly not.

No worries, applied.

Bart