diff mbox

[v2,3/3] x86/mtrr: convert use_intel_if u32 to bool

Message ID b2b98c2e65e401b89c5ad87cf27e9eac9bf1943b.1484803037.git-series.cardoe@cardoe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Douglas Goldstein Jan. 19, 2017, 5:24 a.m. UTC
This field is always only 1 currently but may allow 0 in the future so
convert it to a bool to provide proper range checking by the compiler.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 xen/arch/x86/cpu/mtrr/generic.c | 2 +-
 xen/arch/x86/cpu/mtrr/mtrr.h    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Jan Beulich Jan. 19, 2017, 9:17 a.m. UTC | #1
>>> On 19.01.17 at 06:24, <cardoe@cardoe.com> wrote:
> @@ -39,7 +39,7 @@ extern u64 size_or_mask, size_and_mask;
>  extern const struct mtrr_ops *mtrr_if;
>  
>  #define is_cpu(vnd)	(mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
> -#define use_intel()	(mtrr_if && mtrr_if->use_intel_if == 1)
> +#define use_intel()	(mtrr_if && mtrr_if->use_intel_if == true)

With the "== true" here dropped (which can be done while
committing)
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 8d4537a..104baf9 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -560,7 +560,7 @@  static int generic_have_wrcomb(void)
 /* generic structure...
  */
 const struct mtrr_ops generic_mtrr_ops = {
-	.use_intel_if      = 1,
+	.use_intel_if      = true,
 	.set_all	   = generic_set_all,
 	.get               = generic_get_mtrr,
 	.get_free_region   = generic_get_free_region,
diff --git a/xen/arch/x86/cpu/mtrr/mtrr.h b/xen/arch/x86/cpu/mtrr/mtrr.h
index bb57def..ae4aad9 100644
--- a/xen/arch/x86/cpu/mtrr/mtrr.h
+++ b/xen/arch/x86/cpu/mtrr/mtrr.h
@@ -9,7 +9,7 @@ 
 
 struct mtrr_ops {
 	u32	vendor;
-	u32	use_intel_if;
+	bool	use_intel_if;
 //	void	(*init)(void);
 	void	(*set)(unsigned int reg, unsigned long base,
 		       unsigned long size, mtrr_type type);
@@ -39,7 +39,7 @@  extern u64 size_or_mask, size_and_mask;
 extern const struct mtrr_ops *mtrr_if;
 
 #define is_cpu(vnd)	(mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
-#define use_intel()	(mtrr_if && mtrr_if->use_intel_if == 1)
+#define use_intel()	(mtrr_if && mtrr_if->use_intel_if == true)
 
 extern unsigned int num_var_ranges;