[RFC PATCH 2/3] arm64: cpufeature: constify arm64_ftr_regs array
Suzuki K Poulose
Suzuki.Poulose at arm.com
Tue Aug 30 03:15:42 PDT 2016
On 26/08/16 18:15, Ard Biesheuvel wrote:
> Constify the arm64_ftr_regs array, by moving the mutable arm64_ftr_reg
> fields out of the array itself. This also streamlines the bsearch, since
> the entire array can be covered by fewer cachelines. Moving the payload
> out of the array also allows us to have special explicitly defined
> struct instance in case other code needs to refer to it directly.
>
> Note that this replaces the runtime sorting of the array with a runtime
> BUG() check whether the array is sorted correctly in the code.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Ard,
Thanks a lot for the nice, quick cleanup !
> + int i;
> +
> + /* Check that the array is sorted so that we can do the binary search */
> + for (i = 1; i < ARRAY_SIZE(arm64_ftr_regs); i++)
> + if (arm64_ftr_regs[i].sys_id < arm64_ftr_regs[i - 1].sys_id)
> + BUG();
minor nit: We could do :
for (i = 1; i < ARRAY_SIZE(arm64_ftr_regs); i++)
BUG_ON(!(arm64_ftr_regs[i].sys_id < arm64_ftr_regs[i - 1].sys_id));
The entire series looks good to me. For the series :
Reviewed-by: Suzuki K Poulose <suzuki.poulose at arm.com>
Suzuki
More information about the linux-arm-kernel
mailing list