From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 4/6] checks: check for #{size,address}-cells without child nodes
Date: Wed, 13 Dec 2017 21:06:26 +1100 [thread overview]
Message-ID: <20171213100626.GW2226@umbus.fritz.box> (raw)
In-Reply-To: <20171212224629.28738-4-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]
On Tue, Dec 12, 2017 at 04:46:27PM -0600, Rob Herring wrote:
> Add a check for unnecessary "#{size,address}-cells" when there's neither
> a 'ranges' property nor child nodes with a 'reg' property.
>
> An exception may be an overlay that adds nodes, but this case would need
> "#{size,address}-cells" in the overlay to properly compile already.
>
> Signed-off-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
I do worry slightly about the case of a bridge which has some special
subnodes with no reg, plus normal subnodes with reg, but where there
aren't any normal subnodes in the base tree.
Still, that's a fairly corner case, so I've applied the patch.
> ---
> v2:
> - fix commit msg
>
> checks.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/checks.c b/checks.c
> index e4f5cb9fd317..e0ec67be1b7a 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -981,6 +981,31 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,
> WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
> &addr_size_cells);
>
> +static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *dti,
> + struct node *node)
> +{
> + struct property *prop;
> + struct node *child;
> + bool has_reg = false;
> +
> + if (!node->parent || node->addr_cells < 0 || node->size_cells < 0)
> + return;
> +
> + if (get_property(node, "ranges") || !node->children)
> + return;
> +
> + for_each_child(node, child) {
> + prop = get_property(child, "reg");
> + if (prop)
> + has_reg = true;
> + }
> +
> + if (!has_reg)
> + FAIL(c, dti, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property in %s",
> + node->fullpath);
> +}
> +WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);
> +
> static void check_obsolete_chosen_interrupt_controller(struct check *c,
> struct dt_info *dti,
> struct node *node)
> @@ -1305,6 +1330,7 @@ static struct check *check_table[] = {
> &simple_bus_reg,
>
> &avoid_default_addr_size,
> + &avoid_unnecessary_addr_size,
> &obsolete_chosen_interrupt_controller,
>
> &clocks_property,
--
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: 833 bytes --]
next prev parent reply other threads:[~2017-12-13 10:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 22:46 [PATCH v2 1/6] checks: add a string check for 'label' property Rob Herring
[not found] ` <20171212224629.28738-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-12 22:46 ` [PATCH v2 2/6] checks: add string list check Rob Herring
[not found] ` <20171212224629.28738-2-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13 9:24 ` David Gibson
2017-12-12 22:46 ` [PATCH v2 3/6] checks: add string list check for *-names properties Rob Herring
[not found] ` <20171212224629.28738-3-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13 9:28 ` David Gibson
2017-12-12 22:46 ` [PATCH v2 4/6] checks: check for #{size,address}-cells without child nodes Rob Herring
[not found] ` <20171212224629.28738-4-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13 10:06 ` David Gibson [this message]
2017-12-12 22:46 ` [PATCH v2 5/6] checks: add aliases node checks Rob Herring
2017-12-12 22:46 ` [PATCH v2 6/6] checks: add a chosen node check Rob Herring
[not found] ` <20171212224629.28738-6-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13 10:39 ` David Gibson
2017-12-13 9:20 ` [PATCH v2 1/6] checks: add a string check for 'label' property 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=20171213100626.GW2226@umbus.fritz.box \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh-DgEjT+Ai2ygdnm+yROfE0A@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).