linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [PATCH] gpioset: reword note on post-exit behaviour
Date: Thu, 28 Dec 2023 21:08:37 +0800	[thread overview]
Message-ID: <20231228130837.102524-1-warthog618@gmail.com> (raw)

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.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
 tools/gpioset.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/gpioset.c b/tools/gpioset.c
index 9dc5aeb..f2f9a15 100644
--- a/tools/gpioset.c
+++ b/tools/gpioset.c
@@ -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)
-- 
2.39.2


             reply	other threads:[~2023-12-28 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 13:08 Kent Gibson [this message]
2023-12-28 15:29 ` [libgpiod][PATCH] gpioset: reword note on post-exit behaviour Kent Gibson
2024-01-02 14:06   ` 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=20231228130837.102524-1-warthog618@gmail.com \
    --to=warthog618@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    /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).