Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/sysinfo: Cleanup stsi() inline assembly

Merge stsi() and __stsi() and cleanup the inline assembly. This involves
making use of the flag output constraint. Semantically the result is
identical to before.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Heiko Carstens and committed by
Vasily Gorbik
a130b6d6 9b065000

+15 -26
+15 -26
arch/s390/kernel/sysinfo.c
··· 22 22 #include <asm/cpcmd.h> 23 23 #include <asm/topology.h> 24 24 #include <asm/fpu.h> 25 + #include <asm/asm.h> 25 26 26 27 int topology_max_mnest; 27 - 28 - static inline int __stsi(void *sysinfo, int fc, int sel1, int sel2, int *lvl) 29 - { 30 - int r0 = (fc << 28) | sel1; 31 - int rc = 0; 32 - 33 - asm volatile( 34 - " lr 0,%[r0]\n" 35 - " lr 1,%[r1]\n" 36 - " stsi 0(%[sysinfo])\n" 37 - " jz 0f\n" 38 - " lhi %[rc],%[retval]\n" 39 - "0: lr %[r0],0\n" 40 - : [r0] "+d" (r0), [rc] "+d" (rc) 41 - : [r1] "d" (sel2), 42 - [sysinfo] "a" (sysinfo), 43 - [retval] "K" (-EOPNOTSUPP) 44 - : "cc", "0", "1", "memory"); 45 - *lvl = ((unsigned int) r0) >> 28; 46 - return rc; 47 - } 48 28 49 29 /* 50 30 * stsi - store system information ··· 34 54 */ 35 55 int stsi(void *sysinfo, int fc, int sel1, int sel2) 36 56 { 37 - int lvl, rc; 57 + int r0 = (fc << 28) | sel1; 58 + int cc; 38 59 39 - rc = __stsi(sysinfo, fc, sel1, sel2, &lvl); 40 - if (rc) 41 - return rc; 42 - return fc ? 0 : lvl; 60 + asm volatile( 61 + " lr %%r0,%[r0]\n" 62 + " lr %%r1,%[r1]\n" 63 + " stsi %[sysinfo]\n" 64 + " lr %[r0],%%r0\n" 65 + CC_IPM(cc) 66 + : CC_OUT(cc, cc), [r0] "+d" (r0), [sysinfo] "=Q" (*(char *)sysinfo) 67 + : [r1] "d" (sel2) 68 + : CC_CLOBBER_LIST("0", "1", "memory")); 69 + if (cc == 3) 70 + return -EOPNOTSUPP; 71 + return fc ? 0 : (unsigned int)r0 >> 28; 43 72 } 44 73 EXPORT_SYMBOL(stsi); 45 74