summaryrefslogtreecommitdiff
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2023-09-11 21:39:57 +0200
committerVasily Gorbik <gor@linux.ibm.com>2023-09-19 13:26:56 +0200
commita74e4fc168d284e1e4e7296f8cf4b884035ebd45 (patch)
tree784f4e5d88dd7d7175bd067b0ba049afc5f06892 /arch/s390
parentebe1cd530fb2f6450656758bd904cfb5767f8d33 (diff)
s390/ctlreg: cleanup inline assemblies
Use symbolic names for operands, remove typedefs, and slightly refactor the code. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/ctlreg.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/arch/s390/include/asm/ctlreg.h b/arch/s390/include/asm/ctlreg.h
index 25b955db8998..0b55a1bb3113 100644
--- a/arch/s390/include/asm/ctlreg.h
+++ b/arch/s390/include/asm/ctlreg.h
@@ -36,24 +36,37 @@
#include <linux/bug.h>
#define __ctl_load(array, low, high) do { \
- typedef struct { char _[sizeof(array)]; } addrtype; \
+ struct addrtype { \
+ char _[sizeof(array)]; \
+ }; \
+ int _high = high; \
+ int _low = low; \
+ int _esize; \
\
- BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
+ _esize = (_high - _low + 1) * sizeof(unsigned long); \
+ BUILD_BUG_ON(sizeof(struct addrtype) != _esize); \
asm volatile( \
- " lctlg %1,%2,%0\n" \
+ " lctlg %[_low],%[_high],%[_arr]\n" \
: \
- : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high) \
+ : [_arr] "Q" (*(struct addrtype *)(&array)), \
+ [_low] "i" (low), [_high] "i" (high) \
: "memory"); \
} while (0)
#define __ctl_store(array, low, high) do { \
- typedef struct { char _[sizeof(array)]; } addrtype; \
+ struct addrtype { \
+ char _[sizeof(array)]; \
+ }; \
+ int _high = high; \
+ int _low = low; \
+ int _esize; \
\
- BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
+ _esize = (_high - _low + 1) * sizeof(unsigned long); \
+ BUILD_BUG_ON(sizeof(struct addrtype) != _esize); \
asm volatile( \
- " stctg %1,%2,%0\n" \
- : "=Q" (*(addrtype *)(&array)) \
- : "i" (low), "i" (high)); \
+ " stctg %[_low],%[_high],%[_arr]\n" \
+ : [_arr] "=Q" (*(struct addrtype *)(&array)) \
+ : [_low] "i" (low), [_high] "i" (high)); \
} while (0)
static __always_inline void __ctl_set_bit(unsigned int cr, unsigned int bit)