summaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-09-19 14:06:27 +1000
committerPaul Mackerras <paulus@samba.org>2006-09-20 15:09:48 +1000
commita4dc7ff08915a2035aa6d6decc53fa1deaa410bb (patch)
tree9b28af3a21f915e3fe8ed7ee163be1b1d2bfe8b0 /include/asm-powerpc
parent19e59df4dc2e6f7b46190ee77ce7093769f597a7 (diff)
downloadop-kernel-dev-a4dc7ff08915a2035aa6d6decc53fa1deaa410bb.zip
op-kernel-dev-a4dc7ff08915a2035aa6d6decc53fa1deaa410bb.tar.gz
[POWERPC] Define of_read_ulong helper
There are various places where we want to extract an unsigned long value from a device-tree property that can be 1 or 2 cells in length. This replaces some open-coded calculations, and one place where we assumed without checking that properties were the length we wanted, with a little of_read_ulong() helper. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/prom.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index c15e66a..5246297 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -197,7 +197,7 @@ extern int release_OF_resource(struct device_node* node, int index);
*/
-/* Helper to read a big number */
+/* Helper to read a big number; size is in cells (not bytes) */
static inline u64 of_read_number(const u32 *cell, int size)
{
u64 r = 0;
@@ -206,6 +206,16 @@ static inline u64 of_read_number(const u32 *cell, int size)
return r;
}
+/* Like of_read_number, but we want an unsigned long result */
+#ifdef CONFIG_PPC32
+static inline unsigned long of_read_ulong(const u32 *cell, int size)
+{
+ return cell[size-1];
+}
+#else
+#define of_read_ulong(cell, size) of_read_number(cell, size)
+#endif
+
/* Translate an OF address block into a CPU physical address
*/
#define OF_BAD_ADDR ((u64)-1)
OpenPOWER on IntegriCloud