Re: [PATCH] of: Fix constantness of of_n_size_cells
From: Geoff Levand <hidden>
Date: 2014-08-29 19:26:50
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 [off-list ref] wrote:quoted
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 <redacted>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