]> git.karo-electronics.de Git - linux-beck.git/commitdiff
s390/cpumf: simplify psw generation
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 14 Nov 2016 06:46:06 +0000 (07:46 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 23 Nov 2016 15:02:22 +0000 (16:02 +0100)
Use the psw_bits macro and simplify the code. The generated code is
also better since it doesn't contain any conditional branches anymore.

Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/perf_cpum_sf.c

index fcc634c1479a1ed1d7cd05592d2b8c0ae59a408d..4e7ee8647b8b8e74d38848038f54082e11ed3b65 100644 (file)
@@ -995,27 +995,11 @@ static int perf_push_sample(struct perf_event *event, struct sf_raw_sample *sfr)
        regs.int_parm = CPU_MF_INT_SF_PRA;
        sde_regs = (struct perf_sf_sde_regs *) &regs.int_parm_long;
 
-       regs.psw.addr = sfr->basic.ia;
-       if (sfr->basic.T)
-               regs.psw.mask |= PSW_MASK_DAT;
-       if (sfr->basic.W)
-               regs.psw.mask |= PSW_MASK_WAIT;
-       if (sfr->basic.P)
-               regs.psw.mask |= PSW_MASK_PSTATE;
-       switch (sfr->basic.AS) {
-       case 0x0:
-               regs.psw.mask |= PSW_ASC_PRIMARY;
-               break;
-       case 0x1:
-               regs.psw.mask |= PSW_ASC_ACCREG;
-               break;
-       case 0x2:
-               regs.psw.mask |= PSW_ASC_SECONDARY;
-               break;
-       case 0x3:
-               regs.psw.mask |= PSW_ASC_HOME;
-               break;
-       }
+       psw_bits(regs.psw).ia = sfr->basic.ia;
+       psw_bits(regs.psw).t  = sfr->basic.T;
+       psw_bits(regs.psw).w  = sfr->basic.W;
+       psw_bits(regs.psw).p  = sfr->basic.P;
+       psw_bits(regs.psw).as = sfr->basic.AS;
 
        /*
         * A non-zero guest program parameter indicates a guest