All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH libgpiod 1/2] tools: gpioinfo: don't implicity unquote unnamed lines
Date: Fri, 21 Mar 2025 19:44:16 +0800	[thread overview]
Message-ID: <20250321114416.GA150664@rigel> (raw)
In-Reply-To: <20250321-gpioinfo-unnamed-quotes-v1-1-a806e9027adf@linaro.org>

On Fri, Mar 21, 2025 at 12:05:24PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Consider the following output of `gpioinfo`:
>
> gpiochip1 - 2 lines:
>         line   0:       "foo"                   output
>         line   1:       unnamed                 output
>
> Now let's run:
>
>     gpioset --chip=gpiochip1 0=active 1=active
>
> The output of `gpioinfo --unquoted` is correct:
>
> gpiochip1 - 2 lines:
>         line   0:       foo                     output consumer=gpioset
>         line   1:       unnamed                 output consumer=gpioset
>
> However, without the `unquoted` switch, it's inconsistent:
>
> gpiochip1 - 2 lines:
>         line   0:       "foo"                   output consumer="gpioset"
>         line   1:       unnamed                 output consumer=gpioset
>
> This is because gpioinfo drops the quotes for all subsequent attribute
> strings when it encounters an unnamed line. We should instead keep a
> separate instance of the `unquoted` flag just for the line name and pass
> the original value of `unquoted_strings` down to
> print_line_attributes().
>

Oh nuts, originally the consumer was a separate field, so the line name
was the only string in the info.
I didn't consider that when making the consumer an attribute :(.

The fix and test look good to me.

Reviewed-by: Kent Gibson <warthog618@gmail.com>

Cheers,
Kent.

  reply	other threads:[~2025-03-21 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 11:05 [PATCH libgpiod 0/2] tools: don't implicity unquote unnamed lines in gpioinfo Bartosz Golaszewski
2025-03-21 11:05 ` [PATCH libgpiod 1/2] tools: gpioinfo: don't implicity unquote unnamed lines Bartosz Golaszewski
2025-03-21 11:44   ` Kent Gibson [this message]
2025-03-21 11:05 ` [PATCH libgpiod 2/2] tools: tests: add a test case for gpioinfo output consistency Bartosz Golaszewski
2025-03-24  9:42 ` [PATCH libgpiod 0/2] tools: don't implicity unquote unnamed lines in gpioinfo 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=20250321114416.GA150664@rigel \
    --to=warthog618@gmail.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.