diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2009-11-23 22:16:46 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-11-23 22:16:46 -0500 |
commit | 2be09cb993826b52c9fc1d44747c20dd43a50038 (patch) | |
tree | 7a407af6425942c2010f091a508c141494f9ee03 | |
parent | 02af11b03fce3ddb264d7873d7a2e295e697938c (diff) |
of: remove special case definition of of_read_ulong()
Special case of of_read_ulong() was defined for PPC32 to toss away
all but the last 32 bits when a large number value was read, and the
'normal' version for ppc64 just #defined of_read_ulong to of_read_number
which causes compiler warnings on MicroBlaze and other 32 bit
architectures because it returns a u64 instead of a ulong.
This patch fixes the problem by defining a common implementation of
of_read_ulong() that works everywhere.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
-rw-r--r-- | include/linux/of.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index bec215792c4f..d4c014a35ea5 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -113,14 +113,11 @@ static inline u64 of_read_number(const u32 *cell, int size) | |||
113 | } | 113 | } |
114 | 114 | ||
115 | /* Like of_read_number, but we want an unsigned long result */ | 115 | /* Like of_read_number, but we want an unsigned long result */ |
116 | #ifdef CONFIG_PPC32 | ||
117 | static inline unsigned long of_read_ulong(const u32 *cell, int size) | 116 | static inline unsigned long of_read_ulong(const u32 *cell, int size) |
118 | { | 117 | { |
119 | return cell[size-1]; | 118 | /* toss away upper bits if unsigned long is smaller than u64 */ |
119 | return of_read_number(cell, size); | ||
120 | } | 120 | } |
121 | #else | ||
122 | #define of_read_ulong(cell, size) of_read_number(cell, size) | ||
123 | #endif | ||
124 | 121 | ||
125 | #include <asm/prom.h> | 122 | #include <asm/prom.h> |
126 | 123 | ||