devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Tomasz Figa <t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Benoit Cousson <bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 1/3] dtc: Keep type information from DTS
Date: Wed, 22 Jan 2014 15:49:45 +1100	[thread overview]
Message-ID: <20140122044945.GF21650@voom.redhat.com> (raw)
In-Reply-To: <20140121120606.A2E7CC4054E-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2585 bytes --]

On Tue, Jan 21, 2014 at 12:06:06PM +0000, Grant Likely wrote:
> On Mon, 16 Dec 2013 11:08:33 -0700, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> > On 12/13/2013 09:49 AM, Tomasz Figa wrote:
> > > Currently dtc loses information about data types when parsing DTS,
> > > because it flattens all the parsed property data into a flat stream of
> > > bytes. The only saved metadata is for references to other nodes inside
> > > cell arrays. This makes it impossible to do any checks on data types on
> > > livetree representation.
> > > 
> > > This patch makes dtc store type information inside data struct by using
> > > marker infrastructure. A new type of marker is introduced that holds
> > > type enum as its ref member. Such markers are then inserted wherever
> > > data of given type starts, so information about type of each property
> > > data section is preserved.
> > 
> > > diff --git a/dtc-parser.y b/dtc-parser.y
> > 
> > >  	| propdataprefix DT_REF
> > >  		{
> > > -			$$ = data_add_marker($1, REF_PATH, $2);
> > > +			struct data d;
> > > +			d = data_add_marker($1, TYPE, (char *)TYPE_STRING);
> > > +			$$ = data_add_marker(d, REF_PATH, $2);
> > >  		}
> > 
> > I guess here, the lexer does give us a string that's the target of the
> > reference, so this is correct. However, I wonder if semantically we
> > shouldn't call this a TYPE_REFERENCE, so we can distinguish between
> > references and regular strings?
> > 
> > > diff --git a/livetree.c b/livetree.c
> > 
> > > @@ -530,16 +530,24 @@ cell_t get_node_phandle(struct node *root, struct node *node)
> > >  	node->phandle = phandle;
> > >  
> > >  	if (!get_property(node, "linux,phandle")
> > > -	    && (phandle_format & PHANDLE_LEGACY))
> > > +	    && (phandle_format & PHANDLE_LEGACY)) {
> > > +		struct data d;
> > > +
> > > +		d = data_add_marker(empty_data, TYPE, (char *)TYPE_ARRAY_INT32);
> > 
> > Similarly here, can we encode as e.g. TYPE_PHANDLE or something like
> > that, so we keep the semantic information?
> 
> I think both those are reasonable and useful extensions also. On the
> whole I think the patch is the right thing to do. Feel free to add my
> acked by:
> 
> Acked-by: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Still a NACK from me, I think this is fundamentally the wrong
approach.

-- 
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 #2: Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-01-22  4:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 16:49 [PATCH 0/3] Extend dtc with data type handling Tomasz Figa
     [not found] ` < 1386953352-25402-2-git-send-email-t.figa@samsung.com>
     [not found] ` <1386953352-25402-1-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-13 16:49   ` [PATCH 1/3] dtc: Keep type information from DTS Tomasz Figa
     [not found]     ` <1386953352-25402-2-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-16 18:08       ` Stephen Warren
     [not found]         ` <52AF41A1.3000508-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-23 19:16           ` Tomasz Figa
2014-01-21 12:06           ` Grant Likely
     [not found]             ` <20140121120606.A2E7CC4054E-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-01-22  4:49               ` David Gibson [this message]
2013-12-13 16:49   ` [PATCH 2/3] dtc: Inject guessed type information in case of flat and fs trees Tomasz Figa
2013-12-13 16:49   ` [PATCH 3/3] dtc: Use type information when printing tree source Tomasz Figa
2013-12-23 12:08   ` [PATCH 0/3] Extend dtc with data type handling David Gibson
     [not found]     ` <20131223120814.GE12407-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2013-12-23 19:00       ` Tomasz Figa
2013-12-24 11:57         ` David Gibson

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=20140122044945.GF21650@voom.redhat.com \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.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).