diff mbox series

[4/4] KVM: x86: Change return type of is_long_mode() to bool

Message ID 20230322045824.22970-5-binbin.wu@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Add and use helpers to check bit set in CR0/CR4 | expand

Commit Message

Binbin Wu March 22, 2023, 4:58 a.m. UTC
Change return type of is_long_mode() to bool to avoid implicit cast.

Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
---
 arch/x86/kvm/x86.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kai Huang March 22, 2023, 10:33 p.m. UTC | #1
On Wed, 2023-03-22 at 12:58 +0800, Binbin Wu wrote:
> Change return type of is_long_mode() to bool to avoid implicit cast.
> 
> Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
> ---
>  arch/x86/kvm/x86.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 577b82358529..203fb6640b5b 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -126,12 +126,12 @@ static inline bool is_protmode(struct kvm_vcpu *vcpu)
>  	return kvm_is_cr0_bit_set(vcpu, X86_CR0_PE);
>  }
>  
> -static inline int is_long_mode(struct kvm_vcpu *vcpu)
> +static inline bool is_long_mode(struct kvm_vcpu *vcpu)
>  {
>  #ifdef CONFIG_X86_64
> -	return vcpu->arch.efer & EFER_LMA;
> +	return !!(vcpu->arch.efer & EFER_LMA);
>  #else
> -	return 0;
> +	return false;
>  #endif
>  }
>  

Reviewed-by: Kai Huang <kai.huang@intel.com>
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 577b82358529..203fb6640b5b 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -126,12 +126,12 @@  static inline bool is_protmode(struct kvm_vcpu *vcpu)
 	return kvm_is_cr0_bit_set(vcpu, X86_CR0_PE);
 }
 
-static inline int is_long_mode(struct kvm_vcpu *vcpu)
+static inline bool is_long_mode(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_X86_64
-	return vcpu->arch.efer & EFER_LMA;
+	return !!(vcpu->arch.efer & EFER_LMA);
 #else
-	return 0;
+	return false;
 #endif
 }