Re: [PATCH] of: Fix constantness of of_n_size_cells

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux