All of lore.kernel.org
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
Date: Mon, 15 Jul 2013 22:59:20 +0400	[thread overview]
Message-ID: <51E44688.3050805@cogentembedded.com> (raw)
In-Reply-To: <1373913629-32179-3-git-send-email-swarren@wwwdotorg.org>

On 07/15/2013 10:40 PM, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>

> This is identical to of_parse_phandle_with_args(), except that the
> number of argument cells is fixed, rather than being parsed out of the
> node referenced by each phandle.

> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>   drivers/of/base.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------
>   include/linux/of.h | 10 ++++++++
>   2 files changed, 68 insertions(+), 9 deletions(-)

> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 23e7073..ad799d9 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
>
>   static int __of_parse_phandle_with_args(const struct device_node *np,
>   					const char *list_name,
> -					const char *cells_name, int index,
> +					const char *cells_name,
> +					int cells_count, int index,

    The correct grammar would be 'cell_name' and 'cell_count' I think.

>   					struct of_phandle_args *out_args)
>   {
>   	const __be32 *list, *list_end;
> @@ -1142,12 +1143,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
>   					 np->full_name);
>   				goto err;
>   			}
> -			if (of_property_read_u32(node, cells_name, &count)) {
> -				pr_err("%s: could not get %s for %s\n",
> -					 np->full_name, cells_name,
> -					 node->full_name);
> -				goto err;
> -			}
> +
> +			if (cells_name) {
> +				if (of_property_read_u32(node, cells_name,
> +							 &count)) {
> +					pr_err("%s: could not get %s for %s\n",
> +						np->full_name, cells_name,
> +						node->full_name);
> +					goto err;
> +				}
> +			} else
> +				count = cells_count;

    According to Documentation/CodingStyle chapter 3, both arms of the 
*if* statment should have {} if oe arm has it.

WBR, Sergei

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Stephen Warren <swarren@nvidia.com>,
	Shiraz Hashim <shiraz.hashim@st.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	linux-gpio@vger.kernel.org,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	Jingchang Lu <b35083@freescale.com>,
	Shawn Guo <shawn.guo@linaro.org>,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
Date: Mon, 15 Jul 2013 22:59:20 +0400	[thread overview]
Message-ID: <51E44688.3050805@cogentembedded.com> (raw)
In-Reply-To: <1373913629-32179-3-git-send-email-swarren@wwwdotorg.org>

On 07/15/2013 10:40 PM, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>

> This is identical to of_parse_phandle_with_args(), except that the
> number of argument cells is fixed, rather than being parsed out of the
> node referenced by each phandle.

> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>   drivers/of/base.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------
>   include/linux/of.h | 10 ++++++++
>   2 files changed, 68 insertions(+), 9 deletions(-)

> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 23e7073..ad799d9 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
>
>   static int __of_parse_phandle_with_args(const struct device_node *np,
>   					const char *list_name,
> -					const char *cells_name, int index,
> +					const char *cells_name,
> +					int cells_count, int index,

    The correct grammar would be 'cell_name' and 'cell_count' I think.

>   					struct of_phandle_args *out_args)
>   {
>   	const __be32 *list, *list_end;
> @@ -1142,12 +1143,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
>   					 np->full_name);
>   				goto err;
>   			}
> -			if (of_property_read_u32(node, cells_name, &count)) {
> -				pr_err("%s: could not get %s for %s\n",
> -					 np->full_name, cells_name,
> -					 node->full_name);
> -				goto err;
> -			}
> +
> +			if (cells_name) {
> +				if (of_property_read_u32(node, cells_name,
> +							 &count)) {
> +					pr_err("%s: could not get %s for %s\n",
> +						np->full_name, cells_name,
> +						node->full_name);
> +					goto err;
> +				}
> +			} else
> +				count = cells_count;

    According to Documentation/CodingStyle chapter 3, both arms of the 
*if* statment should have {} if oe arm has it.

WBR, Sergei

  reply	other threads:[~2013-07-15 18:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 18:40 [PATCH V2 1/5] gpio: clean up gpio-ranges documentation Stephen Warren
2013-07-15 18:40 ` Stephen Warren
2013-07-15 18:40 ` [PATCH V2 2/5] of: move documentation of of_parse_phandle_with_args Stephen Warren
2013-07-15 18:40   ` Stephen Warren
2013-07-15 18:40 ` [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args Stephen Warren
2013-07-15 18:40   ` Stephen Warren
2013-07-15 18:59   ` Sergei Shtylyov [this message]
2013-07-15 18:59     ` Sergei Shtylyov
2013-07-15 23:06     ` Stephen Warren
2013-07-15 23:06       ` Stephen Warren
2013-07-15 18:40 ` [PATCH V2 4/5] gpio: implement gpio-ranges binding document fix Stephen Warren
2013-07-15 18:40   ` Stephen Warren
2013-07-15 18:40 ` [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property Stephen Warren
2013-07-15 18:40   ` Stephen Warren
2013-07-15 19:34   ` Rob Herring
2013-07-15 19:34     ` Rob Herring
2013-07-15 23:02     ` Stephen Warren
2013-07-15 23:02       ` Stephen Warren
2013-07-16 23:30       ` Stephen Warren
2013-07-16 23:30         ` Stephen Warren
2013-07-17  1:50         ` Rob Herring
2013-07-17  1:50           ` Rob Herring
2013-07-17  2:58           ` Stephen Warren
2013-07-17  2:58             ` Stephen Warren
2013-07-18  1:35   ` Laurent Pinchart
2013-07-18  1:35     ` Laurent Pinchart
2013-07-22 22:31 ` [PATCH V2 1/5] gpio: clean up gpio-ranges documentation Linus Walleij
2013-07-22 22:31   ` Linus Walleij
2013-07-23 16:14   ` Stephen Warren
2013-07-23 16:14     ` Stephen Warren

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=51E44688.3050805@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.