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

s390/vx: use simple assignments to access __vector128 members

Use simple assignments to access __vector128 members instead of hard
to read casts.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+10 -10
+2 -2
arch/s390/include/asm/fpu/internal.h
··· 27 27 int i; 28 28 29 29 for (i = 0; i < __NUM_FPRS; i++) 30 - fprs[i] = *(freg_t *)(vxrs + i); 30 + fprs[i].ui = vxrs[i].high; 31 31 } 32 32 33 33 static inline void convert_fp_to_vx(__vector128 *vxrs, freg_t *fprs) ··· 35 35 int i; 36 36 37 37 for (i = 0; i < __NUM_FPRS; i++) 38 - *(freg_t *)(vxrs + i) = fprs[i]; 38 + vxrs[i].high = fprs[i].ui; 39 39 } 40 40 41 41 static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)
+2 -2
arch/s390/kernel/compat_signal.c
··· 139 139 /* Save vector registers to signal stack */ 140 140 if (MACHINE_HAS_VX) { 141 141 for (i = 0; i < __NUM_VXRS_LOW; i++) 142 - vxrs[i] = *((__u64 *)(current->thread.fpu.vxrs + i) + 1); 142 + vxrs[i] = current->thread.fpu.vxrs[i].low; 143 143 if (__copy_to_user(&sregs_ext->vxrs_low, vxrs, 144 144 sizeof(sregs_ext->vxrs_low)) || 145 145 __copy_to_user(&sregs_ext->vxrs_high, ··· 173 173 sizeof(sregs_ext->vxrs_high))) 174 174 return -EFAULT; 175 175 for (i = 0; i < __NUM_VXRS_LOW; i++) 176 - *((__u64 *)(current->thread.fpu.vxrs + i) + 1) = vxrs[i]; 176 + current->thread.fpu.vxrs[i].low = vxrs[i]; 177 177 } 178 178 return 0; 179 179 }
+1 -1
arch/s390/kernel/crash_dump.c
··· 110 110 111 111 /* Copy lower halves of vector registers 0-15 */ 112 112 for (i = 0; i < 16; i++) 113 - memcpy(&sa->vxrs_low[i], &vxrs[i].u[2], 8); 113 + sa->vxrs_low[i] = vxrs[i].low; 114 114 /* Copy vector registers 16-31 */ 115 115 memcpy(sa->vxrs_high, vxrs + 16, 16 * sizeof(__vector128)); 116 116 }
+3 -3
arch/s390/kernel/ptrace.c
··· 990 990 if (target == current) 991 991 save_fpu_regs(); 992 992 for (i = 0; i < __NUM_VXRS_LOW; i++) 993 - vxrs[i] = *((__u64 *)(target->thread.fpu.vxrs + i) + 1); 993 + vxrs[i] = target->thread.fpu.vxrs[i].low; 994 994 return membuf_write(&to, vxrs, sizeof(vxrs)); 995 995 } 996 996 ··· 1008 1008 save_fpu_regs(); 1009 1009 1010 1010 for (i = 0; i < __NUM_VXRS_LOW; i++) 1011 - vxrs[i] = *((__u64 *)(target->thread.fpu.vxrs + i) + 1); 1011 + vxrs[i] = target->thread.fpu.vxrs[i].low; 1012 1012 1013 1013 rc = user_regset_copyin(&pos, &count, &kbuf, &ubuf, vxrs, 0, -1); 1014 1014 if (rc == 0) 1015 1015 for (i = 0; i < __NUM_VXRS_LOW; i++) 1016 - *((__u64 *)(target->thread.fpu.vxrs + i) + 1) = vxrs[i]; 1016 + target->thread.fpu.vxrs[i].low = vxrs[i]; 1017 1017 1018 1018 return rc; 1019 1019 }
+2 -2
arch/s390/kernel/signal.c
··· 184 184 /* Save vector registers to signal stack */ 185 185 if (MACHINE_HAS_VX) { 186 186 for (i = 0; i < __NUM_VXRS_LOW; i++) 187 - vxrs[i] = *((__u64 *)(current->thread.fpu.vxrs + i) + 1); 187 + vxrs[i] = current->thread.fpu.vxrs[i].low; 188 188 if (__copy_to_user(&sregs_ext->vxrs_low, vxrs, 189 189 sizeof(sregs_ext->vxrs_low)) || 190 190 __copy_to_user(&sregs_ext->vxrs_high, ··· 210 210 sizeof(sregs_ext->vxrs_high))) 211 211 return -EFAULT; 212 212 for (i = 0; i < __NUM_VXRS_LOW; i++) 213 - *((__u64 *)(current->thread.fpu.vxrs + i) + 1) = vxrs[i]; 213 + current->thread.fpu.vxrs[i].low = vxrs[i]; 214 214 } 215 215 return 0; 216 216 }