• Mark Rutland's avatar
    arm64: vdso: simplify arch_vdso_type ifdeffery · 3ee16ff3
    Mark Rutland authored
    Currently we have some ifdeffery to determine the number of elements in
    enum arch_vdso_type as VDSO_TYPES, rather that the usual pattern of
    having the enum define this:
    
    | enum foo_type {
    |         FOO_TYPE_A,
    |         FOO_TYPE_B,
    | #ifdef CONFIG_C
    |         FOO_TYPE_C,
    | #endif
    |         NR_FOO_TYPES
    | }
    
    ... however, given we only use this number to size the vdso_lookup[]
    array, this is redundant anyway as the compiler can automatically size
    the array to fit all defined elements.
    
    So let's remove the VDSO_TYPES to simplify the code.
    
    At the same time, let's use designated initializers for the array
    elements so that these are guarnateed to be at the expected indices,
    regardless of how we modify the structure. For clariy the redundant
    explicit initialization of the enum elements is dropped.
    
    There should be no functional change as a result of this patch.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20200428164921.41641-3-mark.rutland@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    3ee16ff3
vdso.c 9.29 KB