]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
arm64/sve: Fix a couple of magic numbers for the Z-reg count
authorDave Martin <Dave.Martin@arm.com>
Wed, 12 Jun 2019 16:00:34 +0000 (17:00 +0100)
committerWill Deacon <will@kernel.org>
Mon, 22 Jul 2019 10:49:03 +0000 (11:49 +0100)
There are some hand-written instances of "32" to express the number
of SVE Z-registers.

Since this code was written a #define was added for this, so
convert trivial instances of this magic number as appropriate.

No functional change.

Reviewed-by: Julien Grall <julien.grall@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/fpsimd.c

index 386d848e6b4281d4617ccb9d018114637688bf60..37d3912cfe06fc99678d9c85a18cca111357f499 100644 (file)
@@ -412,7 +412,7 @@ static void __fpsimd_to_sve(void *sst, struct user_fpsimd_state const *fst,
        unsigned int i;
        __uint128_t *p;
 
-       for (i = 0; i < 32; ++i) {
+       for (i = 0; i < SVE_NUM_ZREGS; ++i) {
                p = (__uint128_t *)ZREG(sst, vq, i);
                *p = arm64_cpu_to_le128(fst->vregs[i]);
        }
@@ -466,7 +466,7 @@ static void sve_to_fpsimd(struct task_struct *task)
                return;
 
        vq = sve_vq_from_vl(task->thread.sve_vl);
-       for (i = 0; i < 32; ++i) {
+       for (i = 0; i < SVE_NUM_ZREGS; ++i) {
                p = (__uint128_t const *)ZREG(sst, vq, i);
                fst->vregs[i] = arm64_le128_to_cpu(*p);
        }