lkml.org 
[lkml]   [2022]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2 03/25] KVM: x86/mmu: constify uses of struct kvm_mmu_role_regs
    On Mon, Feb 21, 2022, Paolo Bonzini wrote:
    > struct kvm_mmu_role_regs is computed just once and then accessed. Use
    > const to make this clearer, even though the const fields of struct
    > kvm_mmu_role_regs already prevent modifications to the contents of the
    > struct, or rather make them harder.
    >
    > Reviewed-by: David Matlack <dmatlack@google.com>
    > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    > ---
    > arch/x86/kvm/mmu/mmu.c | 25 ++++++++++++++-----------
    > 1 file changed, 14 insertions(+), 11 deletions(-)
    >
    > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
    > index 4f9bbd02fb8b..97566ac539e3 100644
    > --- a/arch/x86/kvm/mmu/mmu.c
    > +++ b/arch/x86/kvm/mmu/mmu.c
    > @@ -197,7 +197,7 @@ struct kvm_mmu_role_regs {
    > * the single source of truth for the MMU's state.
    > */
    > #define BUILD_MMU_ROLE_REGS_ACCESSOR(reg, name, flag) \
    > -static inline bool __maybe_unused ____is_##reg##_##name(struct kvm_mmu_role_regs *regs)\
    > +static inline bool __maybe_unused ____is_##reg##_##name(const struct kvm_mmu_role_regs *regs)\

    This is one of the very rare times I think it's worth splitting the prototype,
    it's not like the function name is grep-friendly anyways. Either way,

    Reviewed-by: Sean Christopherson <seanjc@google.com>

    static inline bool __maybe_unused \
    ____is_##reg##_##name(const struct kvm_mmu_role_regs *regs) \
    { \
    return !!(regs->reg & flag); \
    }

    \
     
     \ /
      Last update: 2022-03-08 17:23    [W:4.470 / U:0.388 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site