gpioinfo: mark kernel claimed lines as used
PATCH v2 1/1 gpioinfo: mark kernel claimed lines as used
In case where the GPIOLINE_FLAG_KERNEL flag was set and no consumer string is provided by the kernel, the used column was still showing the pin as "unused" Fix that by writing "kernel".
---
v2:
* Restructure for clarity
* Print "kernel" if line is used by kernel.
* Update commit message
tools/gpioinfo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/gpioinfo.c +6 -2
@@ -119,8 +119,12 @@ 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)) +prinfo (&of,12 ,"unused" ); +else + consumer ?prinfo (&of,12 ,"\"%s\"" , consumer) + :prinfo (&of,12 ,"kernel" ); +printf (" " ); prinfo(&of, 8, "%s ", direction == GPIOD_LINE_DIRECTION_INPUT
Signature · 1 line
2.22.0
śr., 31 lip 2019 o 19:38 Ramon Fried <[email protected]> napisał(a):
Quoted 36 lines
In case where the
GPIOLINE_FLAG_KERNELflag was set and no consumer string is provided by the kernel, the used column was still showing the pin as "unused" Fix that by writing "kernel".Signed-off-by Ramon Fried <[email protected]>---
v2:
* Restructure for clarity
* Print "kernel" if line is used by kernel.
* Update commit messagetools/gpioinfo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/gpioinfo.c +6
-3@@ -119,8 +119,12 @@ 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)) +prinfo (&of,12 ,"unused" ); +else + consumer ?prinfo (&of,12 ,"\"%s\"" , consumer) + :prinfo (&of,12 ,"kernel" ); +printf (" " ); prinfo(&of, 8, "%s ", direction == GPIOD_LINE_DIRECTION_INPUT --
Quoted 2 lines
2.22.0
Applied with indentation and alignment fixed.
Bart