From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Subject: Re: [PATCH 1/3] dtc: Keep type information from DTS Date: Mon, 16 Dec 2013 11:08:33 -0700 Message-ID: <52AF41A1.3000508@wwwdotorg.org> References: <1386953352-25402-1-git-send-email-t.figa@samsung.com> <1386953352-25402-2-git-send-email-t.figa@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1386953352-25402-2-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Tomasz Figa , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Jason Cooper , Rob Herring , Ian Campbell , Olof Johansson , Grant Likely , Benoit Cousson , David Gibson List-Id: devicetree@vger.kernel.org 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? -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html