[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 1/3] paravirt: use bool for paravirt_enabled() and paravirt_has_feature()



This avoids any possible misuse.

Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxx>
---
 arch/x86/include/asm/paravirt.h       | 6 +++---
 arch/x86/include/asm/paravirt_types.h | 2 +-
 arch/x86/include/asm/processor.h      | 4 ++--
 arch/x86/kernel/kvm.c                 | 2 +-
 arch/x86/kernel/paravirt.c            | 2 +-
 arch/x86/lguest/boot.c                | 2 +-
 arch/x86/xen/enlighten.c              | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index f6192502149e..60a71dfe0c4e 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -14,15 +14,15 @@
 #include <linux/types.h>
 #include <linux/cpumask.h>
 
-static inline int paravirt_enabled(void)
+static inline bool paravirt_enabled(void)
 {
        return pv_info.paravirt_enabled;
 }
 
-static inline int paravirt_has_feature(unsigned int feature)
+static inline bool paravirt_has_feature(unsigned int feature)
 {
        WARN_ON_ONCE(!pv_info.paravirt_enabled);
-       return (pv_info.features & feature);
+       return !!(pv_info.features & feature);
 }
 
 static inline void load_sp0(struct tss_struct *tss,
diff --git a/arch/x86/include/asm/paravirt_types.h 
b/arch/x86/include/asm/paravirt_types.h
index 77db5616a473..de2382b023f2 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -69,7 +69,7 @@ struct pv_info {
        u16 extra_user_64bit_cs;  /* __USER_CS if none */
 #endif
 
-       int paravirt_enabled;
+       bool paravirt_enabled;
        unsigned int features;    /* valid only if paravirt_enabled is set */
        const char *name;
 };
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 491a3d9dbb15..5a8e7a61d5be 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -470,8 +470,8 @@ static inline unsigned long current_top_of_stack(void)
 #include <asm/paravirt.h>
 #else
 #define __cpuid                        native_cpuid
-#define paravirt_enabled()     0
-#define paravirt_has(x)        0
+#define paravirt_enabled()     false
+#define paravirt_has(x)        false
 
 static inline void load_sp0(struct tss_struct *tss,
                            struct thread_struct *thread)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 47190bd399e7..5c717b247e1b 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -290,7 +290,7 @@ static void __init paravirt_ops_setup(void)
         * features, and paravirt_enabled is about features that are
         * missing.
         */
-       pv_info.paravirt_enabled = 0;
+       pv_info.paravirt_enabled = false;
 
        if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY))
                pv_cpu_ops.io_delay = kvm_io_delay;
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index f08ac28b8136..6b1f205a6ac7 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -294,7 +294,7 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
 
 struct pv_info pv_info = {
        .name = "bare hardware",
-       .paravirt_enabled = 0,
+       .paravirt_enabled = false,
        .kernel_rpl = 0,
        .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */
 
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index a9033ae13369..c6f302f6dedb 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1409,7 +1409,7 @@ __init void lguest_init(void)
        /* We're under lguest. */
        pv_info.name = "lguest";
        /* Paravirt is enabled. */
-       pv_info.paravirt_enabled = 1;
+       pv_info.paravirt_enabled = true;
        /* We're running at privilege level 1, not 0 as normal. */
        pv_info.kernel_rpl = 1;
        /* Everyone except Xen runs with this set. */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2c261082eadf..e303e0043881 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1186,7 +1186,7 @@ static unsigned xen_patch(u8 type, u16 clobbers, void 
*insnbuf,
 }
 
 static const struct pv_info xen_info __initconst = {
-       .paravirt_enabled = 1,
+       .paravirt_enabled = true,
        .shared_kernel_pmd = 0,
 
 #ifdef CONFIG_X86_64
-- 
2.7.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.