devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geoff Levand <geoff-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] of: Fix constantness of of_n_size_cells
Date: Fri, 29 Aug 2014 12:26:50 -0700	[thread overview]
Message-ID: <1409340410.21254.63.camel@smoke> (raw)
In-Reply-To: <20140827102827.50E15C409CB-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>

Hi Grant,

On Wed, 2014-08-27 at 11:28 +0100, Grant Likely wrote:
> On Fri, 22 Aug 2014 17:43:36 +0000, Geoff Levand <geoff-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> wrote:
> > The of_n_size_cells() routine only does a read-only operation on the device tree
> > passed in, so add the const keyword to that argument so that of_n_size_cells()
> > can be called with read-only data without casting.
> > 
> > Signed-off-by: Geoff Levand <geoff-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
> 
> What is the code that exposed this problem?

For the arm64 kexec support and the arm64 spin-table hot-plug support I
am working on I need to read the cpu hardware id from a device tree.  I
don't need to modify the device tree, just get property values, so in
that code I have it in a pointer to a const.  I can cast off that const
when I do the call to of_n_size_cells() if you don't think it worthwhile
to make this change.  Here's the code:

+	p->hwid = of_read_number(cell, of_n_addr_cells(dn))
+		& MPIDR_HWID_BITMASK;

-Geoff

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2014-08-29 19:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 17:43 [PATCH] of: Fix constantness of of_n_size_cells Geoff Levand
     [not found] ` <cover.1408729200.git.geoff-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-08-27 10:28   ` Grant Likely
     [not found]     ` <20140827102827.50E15C409CB-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-08-29 19:26       ` Geoff Levand [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=1409340410.21254.63.camel@smoke \
    --to=geoff-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=robh+dt-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).