tree a2f8be762b20849f37b02f1cbc2bfc9519771cde
parent 56e97b71bf55edb69dc8e9715553972ce50b1564
author Michael Ellerman <[EMAIL PROTECTED]> Wed, 03 Aug 2005 20:21:23 +1000
committer Paul Mackerras <[EMAIL PROTECTED]> Mon, 29 Aug 2005 10:53:36 +1000

[PATCH] ppc64: Consolidate some macros

The only caller of chunk_offset() and abs_chunk() is phys_to_abs(), so
fold the former two into the latter.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

 include/asm-ppc64/abs_addr.h |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/include/asm-ppc64/abs_addr.h b/include/asm-ppc64/abs_addr.h
--- a/include/asm-ppc64/abs_addr.h
+++ b/include/asm-ppc64/abs_addr.h
@@ -44,24 +44,17 @@ static inline unsigned long addr_to_chun
        return addr >> MSCHUNKS_CHUNK_SHIFT;
 }
 
-static inline unsigned long chunk_offset(unsigned long addr)
+static inline unsigned long phys_to_abs(unsigned long pa)
 {
-       return addr & MSCHUNKS_OFFSET_MASK;
-}
+       unsigned long chunk;
 
-static inline unsigned long abs_chunk(unsigned long pchunk)
-{
-       if (pchunk >= mschunks_map.num_chunks)
-               return pchunk;
+       chunk = addr_to_chunk(pa);
 
-       return mschunks_map.mapping[pchunk];
-}
+       if (chunk < mschunks_map.num_chunks)
+               chunk = mschunks_map.mapping[chunk];
 
-/* A macro so it can take pointers or unsigned long. */
-#define phys_to_abs(pa)                                                     \
-       ({ unsigned long _pa = (unsigned long)(pa);                          \
-          chunk_to_addr(abs_chunk(addr_to_chunk(_pa))) + chunk_offset(_pa); \
-       })
+       return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK);
+}
 
 static inline unsigned long
 physRpn_to_absRpn(unsigned long rpn)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to