summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-03-07 11:37:10 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2018-03-13 23:43:05 +1100
commit5a807e04bd2a704821f7027b06c7025c96e015f9 (patch)
tree9fd5b6ccf8cc5a3e0a325c98d5a3b62c61c70427
parent1753dd1830367709144f68f539554dadd7a7ccba (diff)
downloadlinux-5a807e04bd2a704821f7027b06c7025c96e015f9.tar.bz2
powerpc/mm/slice: tidy lpsizes and hpsizes update loops
Make these loops look the same, and change their form so the important part is not wrapped over so many lines. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/mm/slice.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 7b51f962ce0c..432c328b3e94 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -232,22 +232,24 @@ static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psiz
spin_lock_irqsave(&slice_convert_lock, flags);
lpsizes = mm->context.low_slices_psize;
- for (i = 0; i < SLICE_NUM_LOW; i++)
- if (mask.low_slices & (1u << i)) {
- mask_index = i & 0x1;
- index = i >> 1;
- lpsizes[index] = (lpsizes[index] &
- ~(0xf << (mask_index * 4))) |
+ for (i = 0; i < SLICE_NUM_LOW; i++) {
+ if (!(mask.low_slices & (1u << i)))
+ continue;
+
+ mask_index = i & 0x1;
+ index = i >> 1;
+ lpsizes[index] = (lpsizes[index] & ~(0xf << (mask_index * 4))) |
(((unsigned long)psize) << (mask_index * 4));
- }
+ }
hpsizes = mm->context.high_slices_psize;
for (i = 0; i < GET_HIGH_SLICE_INDEX(mm->context.slb_addr_limit); i++) {
+ if (!test_bit(i, mask.high_slices))
+ continue;
+
mask_index = i & 0x1;
index = i >> 1;
- if (test_bit(i, mask.high_slices))
- hpsizes[index] = (hpsizes[index] &
- ~(0xf << (mask_index * 4))) |
+ hpsizes[index] = (hpsizes[index] & ~(0xf << (mask_index * 4))) |
(((unsigned long)psize) << (mask_index * 4));
}