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@xxxxxxxxxx> > Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> > --- > 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@xxxxxxxxxx> static inline bool __maybe_unused \ ____is_##reg##_##name(const struct kvm_mmu_role_regs *regs) \ { \ return !!(regs->reg & flag); \ }