]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
s390/fpu: various coding style changes
authorHeiko Carstens <hca@linux.ibm.com>
Sat, 3 Feb 2024 10:45:01 +0000 (11:45 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 16 Feb 2024 13:30:14 +0000 (14:30 +0100)
Address various checkpatch warnings, adjust whitespace, and try to increase
readability. This is just preparation, in order to avoid that subsequent
patches contain any distracting drive-by coding style changes.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/fpu/api.h
arch/s390/include/asm/fpu/internal.h
arch/s390/include/asm/fpu/types.h
arch/s390/kernel/fpu.c

index d6ca8bc6ca68b7374145fc5401c1fa05b97da27c..24da55d33129545a5c3c5679821d94946a728cb8 100644 (file)
@@ -81,12 +81,12 @@ static inline void sfpc_safe(u32 fpc)
 #define KERNEL_VXR_V16V23      8
 #define KERNEL_VXR_V24V31      16
 
-#define KERNEL_VXR_LOW         (KERNEL_VXR_V0V7|KERNEL_VXR_V8V15)
-#define KERNEL_VXR_MID         (KERNEL_VXR_V8V15|KERNEL_VXR_V16V23)
-#define KERNEL_VXR_HIGH                (KERNEL_VXR_V16V23|KERNEL_VXR_V24V31)
+#define KERNEL_VXR_LOW         (KERNEL_VXR_V0V7   | KERNEL_VXR_V8V15)
+#define KERNEL_VXR_MID         (KERNEL_VXR_V8V15  | KERNEL_VXR_V16V23)
+#define KERNEL_VXR_HIGH                (KERNEL_VXR_V16V23 | KERNEL_VXR_V24V31)
 
-#define KERNEL_VXR             (KERNEL_VXR_LOW|KERNEL_VXR_HIGH)
-#define KERNEL_FPR             (KERNEL_FPC|KERNEL_VXR_LOW)
+#define KERNEL_VXR             (KERNEL_VXR_LOW    | KERNEL_VXR_HIGH)
+#define KERNEL_FPR             (KERNEL_FPC        | KERNEL_VXR_LOW)
 
 struct kernel_fpu;
 
@@ -100,26 +100,27 @@ struct kernel_fpu;
 void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags);
 void __kernel_fpu_end(struct kernel_fpu *state, u32 flags);
 
-
 static inline void kernel_fpu_begin(struct kernel_fpu *state, u32 flags)
 {
        preempt_disable();
        state->mask = S390_lowcore.fpu_flags;
-       if (!test_cpu_flag(CIF_FPU))
+       if (!test_cpu_flag(CIF_FPU)) {
                /* Save user space FPU state and register contents */
                save_fpu_regs();
-       else if (state->mask & flags)
+       } else if (state->mask & flags) {
                /* Save FPU/vector register in-use by the kernel */
                __kernel_fpu_begin(state, flags);
+       }
        S390_lowcore.fpu_flags |= flags;
 }
 
 static inline void kernel_fpu_end(struct kernel_fpu *state, u32 flags)
 {
        S390_lowcore.fpu_flags = state->mask;
-       if (state->mask & flags)
+       if (state->mask & flags) {
                /* Restore FPU/vector register in-use by the kernel */
                __kernel_fpu_end(state, flags);
+       }
        preempt_enable();
 }
 
index d511c4cf5afb73cd426432b4d9c935faaebdd1d4..d7c0a100a44432680fe23a83a7b0ee5dd66c7777 100644 (file)
@@ -20,11 +20,11 @@ static inline bool cpu_has_vx(void)
 
 static inline void save_vx_regs(__vector128 *vxrs)
 {
-       asm volatile(
+       asm volatile("\n"
                "       la      1,%0\n"
                "       .word   0xe70f,0x1000,0x003e\n" /* vstm 0,15,0(1) */
                "       .word   0xe70f,0x1100,0x0c3e\n" /* vstm 16,31,256(1) */
-               : "=Q" (*(struct vx_array *) vxrs) : : "1");
+               : "=Q" (*(struct vx_array *)vxrs) : : "1");
 }
 
 static inline void convert_vx_to_fp(freg_t *fprs, __vector128 *vxrs)
@@ -50,8 +50,7 @@ static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)
        if (cpu_has_vx())
                convert_vx_to_fp((freg_t *)&fpregs->fprs, fpu->vxrs);
        else
-               memcpy((freg_t *)&fpregs->fprs, fpu->fprs,
-                      sizeof(fpregs->fprs));
+               memcpy((freg_t *)&fpregs->fprs, fpu->fprs, sizeof(fpregs->fprs));
 }
 
 static inline void fpregs_load(_s390_fp_regs *fpregs, struct fpu *fpu)
@@ -60,8 +59,7 @@ static inline void fpregs_load(_s390_fp_regs *fpregs, struct fpu *fpu)
        if (cpu_has_vx())
                convert_fp_to_vx(fpu->vxrs, (freg_t *)&fpregs->fprs);
        else
-               memcpy(fpu->fprs, (freg_t *)&fpregs->fprs,
-                      sizeof(fpregs->fprs));
+               memcpy(fpu->fprs, (freg_t *)&fpregs->fprs, sizeof(fpregs->fprs));
 }
 
 #endif /* _ASM_S390_FPU_INTERNAL_H */
index b1afa13c07b79dd06fe89f87b12caf45f4f69486..1caaf31209fc7b58b06d3aabbbf6168a9f7b01e2 100644 (file)
@@ -23,7 +23,9 @@ struct fpu {
 };
 
 /* VX array structure for address operand constraints in inline assemblies */
-struct vx_array { __vector128 _[__NUM_VXRS]; };
+struct vx_array {
+       __vector128 _[__NUM_VXRS];
+};
 
 /* In-kernel FPU state structure */
 struct kernel_fpu {
index 21c9885cfb211dd091b4384d398b803cb6c2654d..d8e18a74b93dbc1fa8c6d0ce71564c03579abcd9 100644 (file)
@@ -16,14 +16,13 @@ void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags)
 {
        /*
         * Limit the save to the FPU/vector registers already
-        * in use by the previous context
+        * in use by the previous context.
         */
        flags &= state->mask;
-
-       if (flags & KERNEL_FPC)
+       if (flags & KERNEL_FPC) {
                /* Save floating point control */
                asm volatile("stfpc %0" : "=Q" (state->fpc));
-
+       }
        if (!cpu_has_vx()) {
                if (flags & KERNEL_VXR_LOW) {
                        /* Save floating-point registers */
@@ -46,7 +45,6 @@ void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags)
                }
                return;
        }
-
        /* Test and save vector registers */
        asm volatile (
                /*
@@ -97,15 +95,14 @@ void __kernel_fpu_end(struct kernel_fpu *state, u32 flags)
 {
        /*
         * Limit the restore to the FPU/vector registers of the
-        * previous context that have been overwritte by the
-        * current context
+        * previous context that have been overwritten by the
+        * current context.
         */
        flags &= state->mask;
-
-       if (flags & KERNEL_FPC)
+       if (flags & KERNEL_FPC) {
                /* Restore floating-point controls */
                asm volatile("lfpc %0" : : "Q" (state->fpc));
-
+       }
        if (!cpu_has_vx()) {
                if (flags & KERNEL_VXR_LOW) {
                        /* Restore floating-point registers */
@@ -128,7 +125,6 @@ void __kernel_fpu_end(struct kernel_fpu *state, u32 flags)
                }
                return;
        }
-
        /* Test and restore (load) vector registers */
        asm volatile (
                /*