linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramon Fried <rfried.dev@gmail.com>
To: bgolaszewski@baylibre.com
Cc: linus.walleij@linaro.org, linux-gpio@vger.kernel.org,
	Ramon Fried <rfried.dev@gmail.com>
Subject: [libgpiod] [PATCH] gpioinfo: mark kernel claimed lines as used
Date: Tue, 30 Jul 2019 22:04:10 +0300	[thread overview]
Message-ID: <20190730190410.24786-1-rfried.dev@gmail.com> (raw)

In case where the GPIOLINE_FLAG_KERNEL flag was set because of muxing,
The used column was still showing the pin as "unused"
Fix that by writing "used".

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
---
 tools/gpioinfo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/gpioinfo.c b/tools/gpioinfo.c
index bb17262..85f8758 100644
--- a/tools/gpioinfo.c
+++ b/tools/gpioinfo.c
@@ -119,8 +119,11 @@ static void list_lines(struct gpiod_chip *chip)
 		     : prinfo(&of, 12, "unnamed");
 		printf(" ");
 
-		consumer ? prinfo(&of, 12, "\"%s\"", consumer)
-			 : prinfo(&of, 12, "unused");
+		if (gpiod_line_is_used(line) && !consumer)
+			prinfo(&of, 12, "used");
+		else
+			consumer ? prinfo(&of, 12, "\"%s\"", consumer)
+				 : prinfo(&of, 12, "unused");
 		printf(" ");
 
 		prinfo(&of, 8, "%s ", direction == GPIOD_LINE_DIRECTION_INPUT
-- 
2.22.0


             reply	other threads:[~2019-07-30 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 19:04 Ramon Fried [this message]
2019-07-31  7:44 ` [libgpiod] [PATCH] gpioinfo: mark kernel claimed lines as used Bartosz Golaszewski
2019-07-31  7:48   ` Ramon Fried
2019-07-31  7:50     ` 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=20190730190410.24786-1-rfried.dev@gmail.com \
    --to=rfried.dev@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --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).