From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Pantelis Antoniou
<pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
Cc: Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org>,
Grant Likely <glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Frank Rowand
<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Jan Luebbe <jlu-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Phil Elwell <phil-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>,
Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Boris Brezillon
<boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Antoine Tenart
<antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Stephen Boyd
<stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Devicetree Compiler
<devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v9 1/4] checks: Pass boot_info to the check methods
Date: Fri, 25 Nov 2016 09:58:35 +1100 [thread overview]
Message-ID: <20161124225835.GI23872@umbus.fritz.box> (raw)
In-Reply-To: <1479990693-14260-2-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 13552 bytes --]
On Thu, Nov 24, 2016 at 02:31:30PM +0200, Pantelis Antoniou wrote:
> As preparation for overlay support we need to pass boot info
> as an extra boot_info parameter to each check method.
>
> No other functional changes are made.
>
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
You don't really need to pass both bi and dt, since bi->dt will get
you the same thing.
> ---
> checks.c | 113 +++++++++++++++++++++++++++++++++------------------------------
> 1 file changed, 59 insertions(+), 54 deletions(-)
>
> diff --git a/checks.c b/checks.c
> index 0381c98..609975a 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -40,7 +40,8 @@ enum checkstatus {
>
> struct check;
>
> -typedef void (*check_fn)(struct check *c, struct node *dt, struct node *node);
> +typedef void (*check_fn)(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node);
>
> struct check {
> const char *name;
> @@ -97,19 +98,20 @@ static inline void check_msg(struct check *c, const char *fmt, ...)
> check_msg((c), __VA_ARGS__); \
> } while (0)
>
> -static void check_nodes_props(struct check *c, struct node *dt, struct node *node)
> +static void check_nodes_props(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct node *child;
>
> TRACE(c, "%s", node->fullpath);
> if (c->fn)
> - c->fn(c, dt, node);
> + c->fn(c, bi, dt, node);
>
> for_each_child(node, child)
> - check_nodes_props(c, dt, child);
> + check_nodes_props(c, bi, dt, child);
> }
>
> -static bool run_check(struct check *c, struct node *dt)
> +static bool run_check(struct check *c, struct boot_info *bi, struct node *dt)
> {
> bool error = false;
> int i;
> @@ -123,7 +125,7 @@ static bool run_check(struct check *c, struct node *dt)
>
> for (i = 0; i < c->num_prereqs; i++) {
> struct check *prq = c->prereq[i];
> - error = error || run_check(prq, dt);
> + error = error || run_check(prq, bi, dt);
> if (prq->status != PASSED) {
> c->status = PREREQ;
> check_msg(c, "Failed prerequisite '%s'",
> @@ -134,7 +136,7 @@ static bool run_check(struct check *c, struct node *dt)
> if (c->status != UNCHECKED)
> goto out;
>
> - check_nodes_props(c, dt, dt);
> + check_nodes_props(c, bi, dt, dt);
>
> if (c->status == UNCHECKED)
> c->status = PASSED;
> @@ -153,15 +155,15 @@ out:
> */
>
> /* A check which always fails, for testing purposes only */
> -static inline void check_always_fail(struct check *c, struct node *dt,
> - struct node *node)
> +static inline void check_always_fail(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> FAIL(c, "always_fail check");
> }
> CHECK(always_fail, check_always_fail, NULL);
>
> -static void check_is_string(struct check *c, struct node *root,
> - struct node *node)
> +static void check_is_string(struct check *c, struct boot_info *bi,
> + struct node *root, struct node *node)
> {
> struct property *prop;
> char *propname = c->data;
> @@ -179,8 +181,8 @@ static void check_is_string(struct check *c, struct node *root,
> #define ERROR_IF_NOT_STRING(nm, propname) \
> ERROR(nm, check_is_string, (propname))
>
> -static void check_is_cell(struct check *c, struct node *root,
> - struct node *node)
> +static void check_is_cell(struct check *c, struct boot_info *bi,
> + struct node *root, struct node *node)
> {
> struct property *prop;
> char *propname = c->data;
> @@ -202,8 +204,8 @@ static void check_is_cell(struct check *c, struct node *root,
> * Structural check functions
> */
>
> -static void check_duplicate_node_names(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_duplicate_node_names(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct node *child, *child2;
>
> @@ -217,8 +219,8 @@ static void check_duplicate_node_names(struct check *c, struct node *dt,
> }
> ERROR(duplicate_node_names, check_duplicate_node_names, NULL);
>
> -static void check_duplicate_property_names(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_duplicate_property_names(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop, *prop2;
>
> @@ -239,8 +241,8 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL);
> #define DIGITS "0123456789"
> #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
>
> -static void check_node_name_chars(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_node_name_chars(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> int n = strspn(node->name, c->data);
>
> @@ -250,8 +252,8 @@ static void check_node_name_chars(struct check *c, struct node *dt,
> }
> ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@");
>
> -static void check_node_name_format(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_node_name_format(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> if (strchr(get_unitname(node), '@'))
> FAIL(c, "Node %s has multiple '@' characters in name",
> @@ -259,8 +261,8 @@ static void check_node_name_format(struct check *c, struct node *dt,
> }
> ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
>
> -static void check_unit_address_vs_reg(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_unit_address_vs_reg(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> const char *unitname = get_unitname(node);
> struct property *prop = get_property(node, "reg");
> @@ -283,8 +285,8 @@ static void check_unit_address_vs_reg(struct check *c, struct node *dt,
> }
> WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL);
>
> -static void check_property_name_chars(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_property_name_chars(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop;
>
> @@ -305,9 +307,10 @@ ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS);
> ((prop) ? (prop)->name : ""), \
> ((prop) ? "' in " : ""), (node)->fullpath
>
> -static void check_duplicate_label(struct check *c, struct node *dt,
> - const char *label, struct node *node,
> - struct property *prop, struct marker *mark)
> +static void check_duplicate_label(struct check *c, struct boot_info *bi,
> + struct node *dt, const char *label,
> + struct node *node, struct property *prop,
> + struct marker *mark)
> {
> struct node *othernode = NULL;
> struct property *otherprop = NULL;
> @@ -331,29 +334,30 @@ static void check_duplicate_label(struct check *c, struct node *dt,
> DESCLABEL_ARGS(othernode, otherprop, othermark));
> }
>
> -static void check_duplicate_label_node(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_duplicate_label_node(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct label *l;
> struct property *prop;
>
> for_each_label(node->labels, l)
> - check_duplicate_label(c, dt, l->label, node, NULL, NULL);
> + check_duplicate_label(c, bi, dt, l->label, node, NULL, NULL);
>
> for_each_property(node, prop) {
> struct marker *m = prop->val.markers;
>
> for_each_label(prop->labels, l)
> - check_duplicate_label(c, dt, l->label, node, prop, NULL);
> + check_duplicate_label(c, bi, dt, l->label, node, prop, NULL);
>
> for_each_marker_of_type(m, LABEL)
> - check_duplicate_label(c, dt, m->ref, node, prop, m);
> + check_duplicate_label(c, bi, dt, m->ref, node, prop, m);
> }
> }
> ERROR(duplicate_label, check_duplicate_label_node, NULL);
>
> -static cell_t check_phandle_prop(struct check *c, struct node *root,
> - struct node *node, const char *propname)
> +static cell_t check_phandle_prop(struct check *c, struct boot_info *bi,
> + struct node *root, struct node *node,
> + const char *propname)
> {
> struct property *prop;
> struct marker *m;
> @@ -398,8 +402,8 @@ static cell_t check_phandle_prop(struct check *c, struct node *root,
> return phandle;
> }
>
> -static void check_explicit_phandles(struct check *c, struct node *root,
> - struct node *node)
> +static void check_explicit_phandles(struct check *c, struct boot_info *bi,
> + struct node *root, struct node *node)
> {
> struct node *other;
> cell_t phandle, linux_phandle;
> @@ -407,9 +411,9 @@ static void check_explicit_phandles(struct check *c, struct node *root,
> /* Nothing should have assigned phandles yet */
> assert(!node->phandle);
>
> - phandle = check_phandle_prop(c, root, node, "phandle");
> + phandle = check_phandle_prop(c, bi, root, node, "phandle");
>
> - linux_phandle = check_phandle_prop(c, root, node, "linux,phandle");
> + linux_phandle = check_phandle_prop(c, bi, root, node, "linux,phandle");
>
> if (!phandle && !linux_phandle)
> /* No valid phandles; nothing further to check */
> @@ -433,8 +437,8 @@ static void check_explicit_phandles(struct check *c, struct node *root,
> }
> ERROR(explicit_phandles, check_explicit_phandles, NULL);
>
> -static void check_name_properties(struct check *c, struct node *root,
> - struct node *node)
> +static void check_name_properties(struct check *c, struct boot_info *bi,
> + struct node *root, struct node *node)
> {
> struct property **pp, *prop = NULL;
>
> @@ -467,8 +471,8 @@ ERROR(name_properties, check_name_properties, NULL, &name_is_string);
> * Reference fixup functions
> */
>
> -static void fixup_phandle_references(struct check *c, struct node *dt,
> - struct node *node)
> +static void fixup_phandle_references(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop;
>
> @@ -495,8 +499,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
> ERROR(phandle_references, fixup_phandle_references, NULL,
> &duplicate_node_names, &explicit_phandles);
>
> -static void fixup_path_references(struct check *c, struct node *dt,
> - struct node *node)
> +static void fixup_path_references(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop;
>
> @@ -534,8 +538,8 @@ WARNING_IF_NOT_STRING(device_type_is_string, "device_type");
> WARNING_IF_NOT_STRING(model_is_string, "model");
> WARNING_IF_NOT_STRING(status_is_string, "status");
>
> -static void fixup_addr_size_cells(struct check *c, struct node *dt,
> - struct node *node)
> +static void fixup_addr_size_cells(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop;
>
> @@ -558,8 +562,8 @@ WARNING(addr_size_cells, fixup_addr_size_cells, NULL,
> #define node_size_cells(n) \
> (((n)->size_cells == -1) ? 1 : (n)->size_cells)
>
> -static void check_reg_format(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_reg_format(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop;
> int addr_cells, size_cells, entrylen;
> @@ -587,8 +591,8 @@ static void check_reg_format(struct check *c, struct node *dt,
> }
> WARNING(reg_format, check_reg_format, NULL, &addr_size_cells);
>
> -static void check_ranges_format(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_ranges_format(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *prop;
> int c_addr_cells, p_addr_cells, c_size_cells, p_size_cells, entrylen;
> @@ -631,8 +635,8 @@ WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
> /*
> * Style checks
> */
> -static void check_avoid_default_addr_size(struct check *c, struct node *dt,
> - struct node *node)
> +static void check_avoid_default_addr_size(struct check *c, struct boot_info *bi,
> + struct node *dt, struct node *node)
> {
> struct property *reg, *ranges;
>
> @@ -657,6 +661,7 @@ WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
> &addr_size_cells);
>
> static void check_obsolete_chosen_interrupt_controller(struct check *c,
> + struct boot_info *bi,
> struct node *dt,
> struct node *node)
> {
> @@ -773,7 +778,7 @@ void process_checks(bool force, struct boot_info *bi)
> struct check *c = check_table[i];
>
> if (c->warn || c->error)
> - error = error || run_check(c, dt);
> + error = error || run_check(c, bi, dt);
> }
>
> if (error) {
--
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: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-11-24 22:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 12:31 [PATCH v9 0/4] dtc: Dynamic DT support Pantelis Antoniou
[not found] ` <1479990693-14260-1-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-24 12:31 ` [PATCH v9 1/4] checks: Pass boot_info to the check methods Pantelis Antoniou
[not found] ` <1479990693-14260-2-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-24 22:58 ` David Gibson [this message]
2016-11-24 12:31 ` [PATCH v9 2/4] dtc: Document the dynamic plugin internals Pantelis Antoniou
2016-11-24 12:31 ` [PATCH v9 3/4] dtc: Plugin and fixup support Pantelis Antoniou
[not found] ` <1479990693-14260-4-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-24 13:49 ` Phil Elwell
[not found] ` <dab7f38a-89c3-adbc-07a5-8ef8669ded42-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
2016-11-24 13:58 ` Pantelis Antoniou
[not found] ` <B341AF38-45C5-4954-B1E4-B89DED923929-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-24 14:14 ` Phil Elwell
[not found] ` <2ad2929c-6e6a-4e31-0cca-cea2f11b14b1-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
2016-11-24 14:23 ` Pantelis Antoniou
[not found] ` <6FE2D679-BD31-4366-B23C-2F95B0706CE0-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-24 14:54 ` Phil Elwell
2016-11-25 4:11 ` David Gibson
[not found] ` <20161125041124.GB12287-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2016-11-25 10:55 ` Pantelis Antoniou
[not found] ` <B39EF108-E592-4345-A5A7-951883AA099B-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-25 11:26 ` David Gibson
[not found] ` <20161125112613.GK12287-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2016-11-25 12:44 ` Pantelis Antoniou
[not found] ` <AB914E20-1F16-441B-9D7C-5A7298E963A6-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-11-28 2:32 ` David Gibson
[not found] ` <20161128023252.GH30927-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2016-11-28 11:55 ` Pantelis Antoniou
2016-11-24 12:31 ` [PATCH v9 4/4] tests: Add overlay tests Pantelis Antoniou
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=20161124225835.GI23872@umbus.fritz.box \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=jdl-CYoMK+44s/E@public.gmane.org \
--cc=jlu-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
--cc=phil-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org \
--cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@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).