From: David Gibson <david@gibson.dropbear.id.au>
To: Frank Rowand <frowand.list@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
u-boot@lists.denx.de,
Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
Tom Rini <trini@konsulko.com>,
Alexander Kaplan <alex@nextthing.co>,
devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH v3 10/12] libfdt: Add overlay application function
Date: Thu, 30 Jun 2016 15:08:57 +1000 [thread overview]
Message-ID: <20160630050857.GR8885@voom.fritz.box> (raw)
In-Reply-To: <5774854E.2020008@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1975 bytes --]
On Wed, Jun 29, 2016 at 07:34:54PM -0700, Frank Rowand wrote:
> On 06/27/16 20:12, David Gibson wrote:
> > On Mon, Jun 27, 2016 at 01:40:00PM +0200, Maxime Ripard wrote:
> >> Hi David,
> >>
> >> On Mon, Jun 27, 2016 at 03:26:07PM +1000, David Gibson wrote:
> >>>> +static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
> >>>> +{
> >>>> + const uint32_t *val;
> >>>> + int len;
> >>>> +
> >>>> + val = fdt_getprop(fdto, fragment, "target", &len);
> >>>> + if (!val || (*val == 0xffffffff) || (len != sizeof(*val)))
> >>>> + return 0;
> >>>
> >>> This doesn't distinguish between a missing property (which may
> >>> indicate a valid overlay using a target-path or some other method)
> >>> and a badly formatted 'target' property, which is definitely an error
> >>> in the overlay.
> >>>
> >>> I think those should be treated differently.
> >>
> >> AFAIK, phandles can have any 32 bits values but 0xffffffff. In order
> >> to cover the two cases, we would need to have some error code, but
> >> that doesn't really work with returning a uint32_t.
> >
> > Actually phandles can have any value except 0xffffffff *or* 0. So you
> > can use 0 for "couldn't find" and -1 for "badly formatted".
>
> < snip >
>
> Hi David,
>
> I would like to capture this for the specification.
>
> It seems like I could say that a value of 0 in the FDT is not allowed.
>
> Then thinking of what Pantelis is doing with overlays, it seems like a
> value of 0xffffffff is allowed in the FDT, but it means not a valid
> phandle, so do not try to de-reference it.
>
> Does that sound good?
That should be ok. Basically both 0 and -1 are invalid phandle
values, so it's up to us if we want to assign them specific "error"
meanings.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 134 bytes --]
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
next prev parent reply other threads:[~2016-06-30 5:08 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 14:27 [PATCH v3 00/12] cmd: fdt: Add device tree overlays support Maxime Ripard
[not found] ` <20160624142757.32735-1-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-24 14:27 ` [PATCH v3 01/12] cmd: fdt: Narrow the check for fdt addr Maxime Ripard
2016-06-24 14:27 ` [PATCH v3 02/12] scripts: Makefile.lib: Sanitize DTB names Maxime Ripard
2016-06-24 14:27 ` [PATCH v3 03/12] vsprintf: Include stdarg for va_list Maxime Ripard
2016-06-24 14:27 ` [PATCH v3 04/12] libfdt: Add new headers and defines Maxime Ripard
[not found] ` <20160624142757.32735-5-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
2016-06-26 15:39 ` David Gibson
[not found] ` <20160626153906.GQ15625-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-27 7:25 ` Maxime Ripard
2016-06-28 3:02 ` David Gibson
2016-06-24 14:27 ` [PATCH v3 05/12] libfdt: Add iterator over properties Maxime Ripard
[not found] ` <20160624142757.32735-6-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
2016-06-24 14:27 ` [PATCH v3 06/12] libfdt: Add max phandle retrieval function Maxime Ripard
[not found] ` <20160624142757.32735-7-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
2016-06-24 14:27 ` [PATCH v3 07/12] libfdt: Add fdt_setprop_inplace_by_index Maxime Ripard
[not found] ` <20160624142757.32735-8-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
[not found] ` <CAPnjgZ2iperwdKGa=+BF8ypH+yRJ8NnP24Fti-PbXDs5bfg3dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-26 8:09 ` Maxime Ripard
2016-06-26 15:45 ` David Gibson
[not found] ` <20160626154510.GR15625-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-27 9:16 ` Maxime Ripard
2016-06-28 3:05 ` David Gibson
2016-06-24 14:27 ` [PATCH v3 08/12] libfdt: Add fdt_path_offset_namelen Maxime Ripard
[not found] ` <20160624142757.32735-9-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
2016-06-26 8:10 ` Maxime Ripard
2016-06-29 3:27 ` Simon Glass
2016-06-26 15:47 ` David Gibson
2016-06-24 14:27 ` [PATCH v3 09/12] libfdt: Add fdt_getprop_namelen_w Maxime Ripard
[not found] ` <20160624142757.32735-10-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
[not found] ` <CAPnjgZ32sm6PHXYHmqrb59XM1NiNeF5+4V-V35hn=YSmLjNMtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-26 8:11 ` Maxime Ripard
2016-06-26 15:49 ` David Gibson
[not found] ` <20160626154929.GT15625-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-27 7:29 ` Maxime Ripard
2016-06-24 14:27 ` [PATCH v3 10/12] libfdt: Add overlay application function Maxime Ripard
[not found] ` <20160624142757.32735-11-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-26 2:53 ` Simon Glass
[not found] ` <CAPnjgZ0dg-CX0XAxCirB-xLO2Jf_Q9T7rc5vu2qznDkYwA54ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-27 7:13 ` Maxime Ripard
2016-06-27 5:26 ` David Gibson
[not found] ` <20160627052607.GK4242-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-27 11:40 ` Maxime Ripard
2016-06-28 3:12 ` David Gibson
[not found] ` <20160628031252.GZ4242-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-30 2:34 ` Frank Rowand
2016-06-30 5:08 ` David Gibson [this message]
2016-06-24 14:27 ` [PATCH v3 11/12] cmd: fdt: add fdt overlay application subcommand Maxime Ripard
2016-06-24 14:27 ` [PATCH v3 12/12] tests: Introduce DT overlay tests Maxime Ripard
[not found] ` <20160624142757.32735-13-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-27 5:26 ` David Gibson
[not found] ` <20160627052658.GL4242-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-27 6:30 ` Maxime Ripard
2016-06-27 6:47 ` David Gibson
2016-06-26 15:37 ` [PATCH v3 00/12] cmd: fdt: Add device tree overlays support David Gibson
[not found] ` <20160626153719.GP15625-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-27 6:29 ` Maxime Ripard
2016-06-29 3:28 ` 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=20160630050857.GR8885@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=alex@nextthing.co \
--cc=devicetree-compiler@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=pantelis.antoniou@konsulko.com \
--cc=thomas.petazzoni@free-electrons.com \
--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 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).