[PATCH] powerpc/xmon: Deindent the SLB dumping logic
Rashmica Gupta
rashmica.g at gmail.com
Mon Apr 24 14:54:18 AEST 2017
On 24/04/17 10:35, Michael Ellerman wrote:
> Currently the code that dumps SLB entries uses a double-nested if. This
> means the actual dumping logic is a bit squashed. Deindent it by using
> continue.
>
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
Reviewed-by: Rashmica Gupta <rashmica.g at gmail.com>
> ---
> arch/powerpc/xmon/xmon.c | 39 ++++++++++++++++++++++-----------------
> 1 file changed, 22 insertions(+), 17 deletions(-)
>
> Found lying around in an old tree of mine :}
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 16321ad9e70c..199ba2663f21 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -3070,23 +3070,28 @@ void dump_segments(void)
> for (i = 0; i < mmu_slb_size; i++) {
> asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i));
> asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i));
> - if (esid || vsid) {
> - printf("%02d %016lx %016lx", i, esid, vsid);
> - if (esid & SLB_ESID_V) {
> - llp = vsid & SLB_VSID_LLP;
> - if (vsid & SLB_VSID_B_1T) {
> - printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
> - GET_ESID_1T(esid),
> - (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
> - llp);
> - } else {
> - printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
> - GET_ESID(esid),
> - (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
> - llp);
> - }
> - } else
> - printf("\n");
> +
> + if (!esid && !vsid)
> + continue;
> +
> + printf("%02d %016lx %016lx", i, esid, vsid);
> +
> + if (!(esid & SLB_ESID_V)) {
> + printf("\n");
> + continue;
> + }
> +
> + llp = vsid & SLB_VSID_LLP;
> + if (vsid & SLB_VSID_B_1T) {
> + printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
> + GET_ESID_1T(esid),
> + (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
> + llp);
> + } else {
> + printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
> + GET_ESID(esid),
> + (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
> + llp);
> }
> }
> }
More information about the Linuxppc-dev
mailing list