devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manjunatha GK <manjugk-l0cyMroinI0@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org\""
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] DT: Use helper function to read u32 values
Date: Fri, 1 Jul 2011 23:14:01 +0530	[thread overview]
Message-ID: <BANLkTimLmh1vCgZD3NA7T+oZ4fX2ZH9hFQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikSnqPYxhrZv0YrhdZmTC=zrNNDRg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1676 bytes --]

Hi Grant,

On 1 July 2011 20:07, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:

> On Fri, Jul 1, 2011 at 7:55 AM, Manjunatha GK <manjugk-l0cyMroinI0@public.gmane.org> wrote:
> > Use helper function of_property_read_u32() in place of of_get_property
> > and be32_to_cpup() api's for code optimization.
> >
> > Compile tested the changes.
> >
> > Signed-off-by: G, Manjunath Kondaiah <manjugk-l0cyMroinI0@public.gmane.org>
> > ---
> >  drivers/of/irq.c     |   37 ++++++++++++++++++++++---------------
> >  drivers/of/of_i2c.c  |    8 +++-----
> >  drivers/of/of_mdio.c |   16 ++++++----------
> >  3 files changed, 31 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > index 9f689f1..13c02e2 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -59,20 +59,20 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
> >  struct device_node *of_irq_find_parent(struct device_node *child)
> >  {
> >      struct device_node *p;
> > -    const __be32 *parp;
> > +    u32 *parp = NULL;
> >
> >      if (!of_node_get(child))
> >          return NULL;
> >
> >      do {
> > -        parp = of_get_property(child, "interrupt-parent", NULL);
> > +        of_property_read_u32(child, "interrupt-parent", parp);
> >          if (parp == NULL)
> >              p = of_get_parent(child);
>
> Hi Manjunatha.
>
> This won't work.  You must pass a valid pointer.  It needs to be done this
> way;
>        u32 parp;
>        if (of_property_read_u32(child, "interrupt-parent", &parp) == 0) {
>                ...
>        } else {
>                ...
>         }
>
Thanks for the quick catch. I will fix it.

-Manjunath

[-- Attachment #1.2: Type: text/html, Size: 2421 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

      parent reply	other threads:[~2011-07-01 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01 13:55 [PATCH] DT: Use helper function to read u32 values Manjunatha GK
     [not found] ` <BANLkTin+WCRrxhOBNoL_AJJAkS-w9ybXqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-01 14:22   ` Rob Herring
2011-07-01 14:37   ` Grant Likely
     [not found]     ` <BANLkTikSnqPYxhrZv0YrhdZmTC=zrNNDRg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-01 17:44       ` Manjunatha GK [this message]

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=BANLkTimLmh1vCgZD3NA7T+oZ4fX2ZH9hFQ@mail.gmail.com \
    --to=manjugk-l0cymroini0@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@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).