devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 3/6] checks: add string list check for *-names properties
Date: Wed, 13 Dec 2017 20:28:49 +1100	[thread overview]
Message-ID: <20171213092849.GV2226@umbus.fritz.box> (raw)
In-Reply-To: <20171212224629.28738-3-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

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

On Tue, Dec 12, 2017 at 04:46:26PM -0600, Rob Herring wrote:
> Add a string list check for common properties ending in "-names" such as
> reg-names or interrupt-names.
> 
> Signed-off-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Applied, thanks.

> ---
> v2:
> - Ensure "-names" is at end of the prop name.
> - Add tests
> 
>  checks.c                   | 18 +++++++++++++++++-
>  tests/bad-string-props.dts |  1 +
>  tests/run_tests.sh         |  2 +-
>  3 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/checks.c b/checks.c
> index cf670ddc4a5c..e4f5cb9fd317 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -620,6 +620,22 @@ WARNING_IF_NOT_STRING(label_is_string, "label");
>  
>  WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible");
>  
> +static void check_names_is_string_list(struct check *c, struct dt_info *dti,
> +				       struct node *node)
> +{
> +	struct property *prop;
> +
> +	for_each_property(node, prop) {
> +		const char *s = strrchr(prop->name, '-');
> +		if (!s || !streq(s, "-names"))
> +			continue;
> +
> +		c->data = prop->name;
> +		check_is_string_list(c, dti, node);
> +	}
> +}
> +WARNING(names_is_string_list, check_names_is_string_list, NULL);
> +
>  static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
>  				  struct node *node)
>  {
> @@ -1271,7 +1287,7 @@ static struct check *check_table[] = {
>  	&device_type_is_string, &model_is_string, &status_is_string,
>  	&label_is_string,
>  
> -	&compatible_is_string_list,
> +	&compatible_is_string_list, &names_is_string_list,
>  
>  	&property_name_chars_strict,
>  	&node_name_chars_strict,
> diff --git a/tests/bad-string-props.dts b/tests/bad-string-props.dts
> index 9362ee815965..6694704a5fc2 100644
> --- a/tests/bad-string-props.dts
> +++ b/tests/bad-string-props.dts
> @@ -6,6 +6,7 @@
>  	status = <0xdeadbeef>;
>  	label = <0xdeadbeef>;
>  
> +	foobar-names = "foo", <1>;
>  
>  	node {
>  		compatible = "good", <0xdeadbeef>;
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index 910a71cafe16..d36dffbc4ef9 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -546,7 +546,7 @@ dtc_tests () {
>      check_tests bad-name-property.dts name_properties
>  
>      check_tests bad-ncells.dts address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell
> -    check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string label_is_string compatible_is_string_list
> +    check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string label_is_string compatible_is_string_list names_is_string_list
>      check_tests bad-reg-ranges.dts reg_format ranges_format
>      check_tests bad-empty-ranges.dts ranges_format
>      check_tests reg-ranges-root.dts reg_format ranges_format

-- 
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 --]

  parent reply	other threads:[~2017-12-13  9:28 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 [this message]
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
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=20171213092849.GV2226@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).