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 <[email protected]> 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 <[email protected]>
> 
> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to