Commit ce21795275ab469b97384faa36462350af17eca0
Committed by
Paul Mackerras
1 parent
56e97b71bf
Exists in
master
and in
4 other branches
[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 <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Showing 1 changed file with 7 additions and 14 deletions Side-by-side Diff
include/asm-ppc64/abs_addr.h
| ... | ... | @@ -44,24 +44,17 @@ |
| 44 | 44 | return addr >> MSCHUNKS_CHUNK_SHIFT; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -static inline unsigned long chunk_offset(unsigned long addr) | |
| 47 | +static inline unsigned long phys_to_abs(unsigned long pa) | |
| 48 | 48 | { |
| 49 | - return addr & MSCHUNKS_OFFSET_MASK; | |
| 50 | -} | |
| 49 | + unsigned long chunk; | |
| 51 | 50 | |
| 52 | -static inline unsigned long abs_chunk(unsigned long pchunk) | |
| 53 | -{ | |
| 54 | - if (pchunk >= mschunks_map.num_chunks) | |
| 55 | - return pchunk; | |
| 51 | + chunk = addr_to_chunk(pa); | |
| 56 | 52 | |
| 57 | - return mschunks_map.mapping[pchunk]; | |
| 58 | -} | |
| 53 | + if (chunk < mschunks_map.num_chunks) | |
| 54 | + chunk = mschunks_map.mapping[chunk]; | |
| 59 | 55 | |
| 60 | -/* A macro so it can take pointers or unsigned long. */ | |
| 61 | -#define phys_to_abs(pa) \ | |
| 62 | - ({ unsigned long _pa = (unsigned long)(pa); \ | |
| 63 | - chunk_to_addr(abs_chunk(addr_to_chunk(_pa))) + chunk_offset(_pa); \ | |
| 64 | - }) | |
| 56 | + return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK); | |
| 57 | +} | |
| 65 | 58 | |
| 66 | 59 | static inline unsigned long |
| 67 | 60 | physRpn_to_absRpn(unsigned long rpn) |