linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: linux-kernel@vger.kernel.org, Gleb Natapov <gleb@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org
Subject: [PATCH 11/25] x86: Use bool function return values of true/false not 1/0
Date: Mon, 30 Mar 2015 16:46:09 -0700	[thread overview]
Message-ID: <9f593eb2f43b456851cd73f7ed09654ca58fb570.1427759009.git.joe@perches.com> (raw)
In-Reply-To: <cover.1427759009.git.joe@perches.com>

Use the normal return values for bool functions

Signed-off-by: Joe Perches <joe@perches.com>
---
 arch/x86/include/asm/archrandom.h  |  2 +-
 arch/x86/include/asm/dma-mapping.h |  2 +-
 arch/x86/include/asm/kvm_para.h    |  2 +-
 arch/x86/kvm/cpuid.h               |  2 +-
 arch/x86/kvm/vmx.c                 | 72 +++++++++++++++++++-------------------
 5 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h
index 69f1366..7abcd71 100644
--- a/arch/x86/include/asm/archrandom.h
+++ b/arch/x86/include/asm/archrandom.h
@@ -126,7 +126,7 @@ static inline int rdrand_long(unsigned long *v)
 
 static inline bool rdseed_long(unsigned long *v)
 {
-	return 0;
+	return false;
 }
 
 #endif  /* CONFIG_ARCH_RANDOM */
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 808dae6..efac032 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -77,7 +77,7 @@ extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
 	if (!dev->dma_mask)
-		return 0;
+		return false;
 
 	return addr + size - 1 <= *dev->dma_mask;
 }
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index e62cf89..c1adf33 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -115,7 +115,7 @@ static inline void kvm_spinlock_init(void)
 
 static inline bool kvm_para_available(void)
 {
-	return 0;
+	return false;
 }
 
 static inline unsigned int kvm_arch_para_features(void)
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 4452eed..2622846 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -26,7 +26,7 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
 	struct kvm_cpuid_entry2 *best;
 
 	if (!static_cpu_has(X86_FEATURE_XSAVE))
-		return 0;
+		return false;
 
 	best = kvm_find_cpuid_entry(vcpu, 1, 0);
 	return best && (best->ecx & bit(X86_FEATURE_XSAVE));
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ae4f6d3..ab121db 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7318,21 +7318,21 @@ static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu,
 		else if (port < 0x10000)
 			bitmap = vmcs12->io_bitmap_b;
 		else
-			return 1;
+			return true;
 		bitmap += (port & 0x7fff) / 8;
 
 		if (last_bitmap != bitmap)
 			if (kvm_read_guest(vcpu->kvm, bitmap, &b, 1))
-				return 1;
+				return true;
 		if (b & (1 << (port & 7)))
-			return 1;
+			return true;
 
 		port++;
 		size--;
 		last_bitmap = bitmap;
 	}
 
-	return 0;
+	return false;
 }
 
 /*
@@ -7348,7 +7348,7 @@ static bool nested_vmx_exit_handled_msr(struct kvm_vcpu *vcpu,
 	gpa_t bitmap;
 
 	if (!nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS))
-		return 1;
+		return true;
 
 	/*
 	 * The MSR_BITMAP page is divided into four 1024-byte bitmaps,
@@ -7367,10 +7367,10 @@ static bool nested_vmx_exit_handled_msr(struct kvm_vcpu *vcpu,
 	if (msr_index < 1024*8) {
 		unsigned char b;
 		if (kvm_read_guest(vcpu->kvm, bitmap + msr_index/8, &b, 1))
-			return 1;
+			return true;
 		return 1 & (b >> (msr_index & 7));
 	} else
-		return 1; /* let L1 handle the wrong parameter */
+		return true; /* let L1 handle the wrong parameter */
 }
 
 /*
@@ -7392,7 +7392,7 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,
 		case 0:
 			if (vmcs12->cr0_guest_host_mask &
 			    (val ^ vmcs12->cr0_read_shadow))
-				return 1;
+				return true;
 			break;
 		case 3:
 			if ((vmcs12->cr3_target_count >= 1 &&
@@ -7403,37 +7403,37 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,
 					vmcs12->cr3_target_value2 == val) ||
 				(vmcs12->cr3_target_count >= 4 &&
 					vmcs12->cr3_target_value3 == val))
-				return 0;
+				return false;
 			if (nested_cpu_has(vmcs12, CPU_BASED_CR3_LOAD_EXITING))
-				return 1;
+				return true;
 			break;
 		case 4:
 			if (vmcs12->cr4_guest_host_mask &
 			    (vmcs12->cr4_read_shadow ^ val))
-				return 1;
+				return true;
 			break;
 		case 8:
 			if (nested_cpu_has(vmcs12, CPU_BASED_CR8_LOAD_EXITING))
-				return 1;
+				return true;
 			break;
 		}
 		break;
 	case 2: /* clts */
 		if ((vmcs12->cr0_guest_host_mask & X86_CR0_TS) &&
 		    (vmcs12->cr0_read_shadow & X86_CR0_TS))
-			return 1;
+			return true;
 		break;
 	case 1: /* mov from cr */
 		switch (cr) {
 		case 3:
 			if (vmcs12->cpu_based_vm_exec_control &
 			    CPU_BASED_CR3_STORE_EXITING)
-				return 1;
+				return true;
 			break;
 		case 8:
 			if (vmcs12->cpu_based_vm_exec_control &
 			    CPU_BASED_CR8_STORE_EXITING)
-				return 1;
+				return true;
 			break;
 		}
 		break;
@@ -7444,14 +7444,14 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,
 		 */
 		if (vmcs12->cr0_guest_host_mask & 0xe &
 		    (val ^ vmcs12->cr0_read_shadow))
-			return 1;
+			return true;
 		if ((vmcs12->cr0_guest_host_mask & 0x1) &&
 		    !(vmcs12->cr0_read_shadow & 0x1) &&
 		    (val & 0x1))
-			return 1;
+			return true;
 		break;
 	}
-	return 0;
+	return false;
 }
 
 /*
@@ -7474,43 +7474,43 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 				KVM_ISA_VMX);
 
 	if (vmx->nested.nested_run_pending)
-		return 0;
+		return false;
 
 	if (unlikely(vmx->fail)) {
 		pr_info_ratelimited("%s failed vm entry %x\n", __func__,
 				    vmcs_read32(VM_INSTRUCTION_ERROR));
-		return 1;
+		return true;
 	}
 
 	switch (exit_reason) {
 	case EXIT_REASON_EXCEPTION_NMI:
 		if (!is_exception(intr_info))
-			return 0;
+			return false;
 		else if (is_page_fault(intr_info))
 			return enable_ept;
 		else if (is_no_device(intr_info) &&
 			 !(vmcs12->guest_cr0 & X86_CR0_TS))
-			return 0;
+			return false;
 		return vmcs12->exception_bitmap &
 				(1u << (intr_info & INTR_INFO_VECTOR_MASK));
 	case EXIT_REASON_EXTERNAL_INTERRUPT:
-		return 0;
+		return false;
 	case EXIT_REASON_TRIPLE_FAULT:
-		return 1;
+		return true;
 	case EXIT_REASON_PENDING_INTERRUPT:
 		return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_INTR_PENDING);
 	case EXIT_REASON_NMI_WINDOW:
 		return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_NMI_PENDING);
 	case EXIT_REASON_TASK_SWITCH:
-		return 1;
+		return true;
 	case EXIT_REASON_CPUID:
 		if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
-			return 0;
-		return 1;
+			return false;
+		return true;
 	case EXIT_REASON_HLT:
 		return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);
 	case EXIT_REASON_INVD:
-		return 1;
+		return true;
 	case EXIT_REASON_INVLPG:
 		return nested_cpu_has(vmcs12, CPU_BASED_INVLPG_EXITING);
 	case EXIT_REASON_RDPMC:
@@ -7527,7 +7527,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		 * VMX instructions trap unconditionally. This allows L1 to
 		 * emulate them for its L2 guest, i.e., allows 3-level nesting!
 		 */
-		return 1;
+		return true;
 	case EXIT_REASON_CR_ACCESS:
 		return nested_vmx_exit_handled_cr(vcpu, vmcs12);
 	case EXIT_REASON_DR_ACCESS:
@@ -7538,7 +7538,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 	case EXIT_REASON_MSR_WRITE:
 		return nested_vmx_exit_handled_msr(vcpu, vmcs12, exit_reason);
 	case EXIT_REASON_INVALID_STATE:
-		return 1;
+		return true;
 	case EXIT_REASON_MWAIT_INSTRUCTION:
 		return nested_cpu_has(vmcs12, CPU_BASED_MWAIT_EXITING);
 	case EXIT_REASON_MONITOR_INSTRUCTION:
@@ -7548,7 +7548,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 			nested_cpu_has2(vmcs12,
 				SECONDARY_EXEC_PAUSE_LOOP_EXITING);
 	case EXIT_REASON_MCE_DURING_VMENTRY:
-		return 0;
+		return false;
 	case EXIT_REASON_TPR_BELOW_THRESHOLD:
 		return nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW);
 	case EXIT_REASON_APIC_ACCESS:
@@ -7557,7 +7557,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 	case EXIT_REASON_APIC_WRITE:
 	case EXIT_REASON_EOI_INDUCED:
 		/* apic_write and eoi_induced should exit unconditionally. */
-		return 1;
+		return true;
 	case EXIT_REASON_EPT_VIOLATION:
 		/*
 		 * L0 always deals with the EPT violation. If nested EPT is
@@ -7565,7 +7565,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		 * missing in the guest EPT table (EPT12), the EPT violation
 		 * will be injected with nested_ept_inject_page_fault()
 		 */
-		return 0;
+		return false;
 	case EXIT_REASON_EPT_MISCONFIG:
 		/*
 		 * L2 never uses directly L1's EPT, but rather L0's own EPT
@@ -7573,11 +7573,11 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		 * (EPT on EPT). So any problems with the structure of the
 		 * table is L0's fault.
 		 */
-		return 0;
+		return false;
 	case EXIT_REASON_WBINVD:
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_WBINVD_EXITING);
 	case EXIT_REASON_XSETBV:
-		return 1;
+		return true;
 	case EXIT_REASON_XSAVES: case EXIT_REASON_XRSTORS:
 		/*
 		 * This should never happen, since it is not possible to
@@ -7587,7 +7587,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		 */
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	default:
-		return 1;
+		return true;
 	}
 }
 
-- 
2.1.2


  parent reply	other threads:[~2015-03-30 23:47 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 23:45 [PATCH 00/25] treewide: Use bool function return values of true/false not 1/0 Joe Perches
2015-03-30 23:45 ` [PATCH 01/25] arm: " Joe Perches
2015-03-31 15:54   ` Tony Lindgren
2015-03-31 15:58   ` Paolo Bonzini
2015-03-31 16:05     ` Marc Zyngier
2015-03-30 23:46 ` [PATCH 02/25] arm64: " Joe Perches
2015-03-31 15:29   ` Will Deacon
2015-03-30 23:46 ` [PATCH 03/25] hexagon: " Joe Perches
2015-03-30 23:46 ` [PATCH 04/25] ia64: " Joe Perches
2015-03-30 23:46 ` [PATCH 05/25] mips: " Joe Perches
2015-03-30 23:46 ` [PATCH 06/25] powerpc: " Joe Perches
2015-03-31  1:49   ` Benjamin Herrenschmidt
2015-03-31  1:57     ` Joe Perches
2015-03-30 23:46 ` [PATCH 07/25] s390: " Joe Perches
2015-03-31  7:13   ` Heiko Carstens
2015-03-30 23:46 ` [PATCH 08/25] sparc: " Joe Perches
2015-03-30 23:46 ` [PATCH 09/25] tile: " Joe Perches
2015-03-30 23:46 ` [PATCH 10/25] unicore32: " Joe Perches
2015-03-30 23:46 ` Joe Perches [this message]
2015-03-31 16:05   ` [PATCH 11/25] x86: " Paolo Bonzini
2015-03-30 23:46 ` [PATCH 12/25] virtio_console: " Joe Perches
2015-03-31  5:32   ` Amit Shah
2015-03-30 23:46 ` [PATCH 13/25] csiostor: " Joe Perches
2015-03-30 23:46 ` [PATCH 14/25] dcache: " Joe Perches
2015-03-30 23:46 ` [PATCH 15/25] nfsd: nfs4state: " Joe Perches
2015-03-30 23:46 ` [PATCH 16/25] include/linux: " Joe Perches
2015-03-31  7:41   ` Lee Jones
2015-04-06 19:39   ` Sebastian Reichel
2015-03-30 23:46 ` [PATCH 17/25] sound: " Joe Perches
2015-03-31  7:11   ` Mark Brown
2015-03-30 23:46 ` [PATCH 18/25] rcu: tree_plugin: " Joe Perches
2015-03-30 23:46 ` [PATCH 19/25] sched: " Joe Perches
2015-03-31  8:53   ` Peter Zijlstra
2015-03-31  9:03     ` Ingo Molnar
2015-03-31 16:46       ` Joe Perches
2015-04-01  6:58         ` Peter Zijlstra
2015-04-07  9:12         ` about the flood of trivial patches and the Code of Conduct (was: Re: [PATCH 19/25] sched: Use bool function return values of true/false not 1/0) Ingo Molnar
2015-04-07  9:27           ` Ingo Molnar
2015-04-07  9:36           ` about the flood of trivial patches and the Code of Conflict " Ingo Molnar
2015-04-07  9:39             ` Ingo Molnar
2015-04-07 11:00           ` about the flood of trivial patches and the Code of Conduct " Greg Kroah-Hartman
2015-04-07 11:18             ` Ingo Molnar
2015-04-07 11:27               ` Peter Zijlstra
2015-04-07 13:21               ` about the flood of trivial patches and the Code of Conduct Peter Hurley
2015-04-07 11:28             ` about the flood of trivial patches and the Code of Conduct (was: Re: [PATCH 19/25] sched: Use bool function return values of true/false not 1/0) Richard Weinberger
2015-04-07 11:32               ` Peter Zijlstra
2015-04-07 11:50                 ` about the flood of trivial patches and the Code of Conduct Richard Weinberger
2015-04-07 13:21                   ` Steven Rostedt
2015-04-07 13:28                     ` Richard Weinberger
2015-04-07 12:31                 ` about the flood of trivial patches and the Code of Conduct (was: Re: [PATCH 19/25] sched: Use bool function return values of true/false not 1/0) Rafael J. Wysocki
2015-04-07 13:28                   ` Steven Rostedt
2015-04-08 23:37                     ` Rafael J. Wysocki
2015-04-09  0:04                       ` Joe Perches
2015-04-13 12:17                       ` One Thousand Gnomes
2015-04-08  3:22                 ` Theodore Ts'o
2015-04-07 12:35           ` Joe Perches
2015-03-31  9:09     ` [PATCH 19/25] sched: Use bool function return values of true/false not 1/0 Joe Perches
2015-04-01  5:17   ` Jason Low
2015-04-01  5:46     ` [PATCH V2 " Joe Perches
2015-03-30 23:46 ` [PATCH 20/25] ftrace: " Joe Perches
2015-03-30 23:46 ` [PATCH 21/25] slub: " Joe Perches
2015-04-01  3:29   ` David Rientjes
2015-03-30 23:46 ` [PATCH 22/25] bridge: " Joe Perches
2015-03-30 23:46 ` [PATCH 23/25] netfilter: " Joe Perches
2015-03-31 16:58   ` Pablo Neira Ayuso
2015-03-30 23:46 ` [PATCH 24/25] security: " Joe Perches
2015-03-31  6:03   ` John Johansen
2015-03-30 23:46 ` [PATCH 25/25] sound: wm5100-tables: " Joe Perches
2015-04-01 11:54   ` Charles Keepax
2015-03-31  0:07 ` [PATCH 00/25] treewide: " Casey Schaufler
2015-03-31  0:14   ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f593eb2f43b456851cd73f7ed09654ca58fb570.1427759009.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=gleb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).