All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] cmd: fdt: Add support for reading stringlist property values
Date: Wed, 13 Jul 2022 17:30:21 +0200	[thread overview]
Message-ID: <dc4d0b85-b905-e2cc-74df-57db8c1995cf@denx.de> (raw)
In-Reply-To: <CAPnjgZ0rAY+f3Bt33UTPWRoCaqWa9hXovJz5ndvCG-zEKwmb5Q@mail.gmail.com>

On 7/13/22 17:28, Simon Glass wrote:
> Hi Marek,
> 
> On Tue, 12 Jul 2022 at 05:47, Marek Vasut <marex@denx.de> wrote:
>>
>> On 7/12/22 12:58, Simon Glass wrote:
>>> Hi Marek,
>>>
>>> On Fri, 8 Jul 2022 at 15:50, Marek Vasut <marex@denx.de> wrote:
>>>>
>>>> The fdt command currently handles stringlists as strings in 'fdt get value'
>>>> subcommand. Since strings in FDT stringlists are separated by '\0', only
>>>> the first value gets inserted into the environment variable passed to the
>>>> 'fdt get value' command.
>>>>
>>>> Example, consider the following DT snippet:
>>>>
>>>> / { compatible = "foo", "bar" };
>>>>
>>>> The following command only reports the first string in stringlist:
>>>> => fdt get value var / compatible ; print var
>>>> foo
>>>>
>>>> It is not possible to assign list of null-terminated strings into U-Boot
>>>> environment variable. Add optional 'index' parameter to the subcommand
>>>> 'fdt get value <var> <path> <prop> [<index>]' which lets user specify which
>>>> string within the stringlist should be assigned into the 'var' variable.
>>>> The default value of 'index' is 0 in case it is not present. This way the
>>>> 'fdt' command API does not change and existing scripts are not broken.
>>>>
>>>> The following command now reports the Nth string in stringlist, counting
>>>> from zero:
>>>> => fdt get value var / compatible 1 ; print var
>>>> bar
>>>>
>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>> Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>>>> Cc: Simon Glass <sjg@chromium.org>
>>>> Cc: Tom Rini <trini@konsulko.com>
>>>> ---
>>>>    cmd/fdt.c | 34 ++++++++++++++++++++++++++++------
>>>>    1 file changed, 28 insertions(+), 6 deletions(-)
>>>
>>> Can you please add docs and a test?
>>
>> I was expecting this kind of question ... there is no test for the FDT
>> command.
>>
>>> I am happy to do a starting point for a test if you like.
>>
>> You can implement the test for this while at it.
> 
> I sent a starting point for you, both docs and test.

Thank you.

Do I understand your remark correctly that you're blocking this 
particular patch from going in until there is a test ?

  reply	other threads:[~2022-07-13 15:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 21:50 [PATCH] cmd: fdt: Add support for reading stringlist property values Marek Vasut
2022-07-12 10:58 ` Simon Glass
2022-07-12 11:47   ` Marek Vasut
2022-07-13 15:28     ` Simon Glass
2022-07-13 15:30       ` Marek Vasut [this message]
2022-07-13 15:45         ` Simon Glass
2022-07-17  8:12           ` Simon Glass
2022-09-19 15:41             ` Marek Vasut
2022-09-21  9:50               ` Simon Glass
2022-09-21  9:50                 ` Simon Glass
2022-09-23 15:17                   ` Marek Vasut
2022-09-24 14:01                     ` Simon Glass

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=dc4d0b85-b905-e2cc-74df-57db8c1995cf@denx.de \
    --to=marex@denx.de \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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.