[Xen-devel,06/13] xen/arm: vgic: Switch emulate_sysreg return from int to bool

Message ID 1481114033-11024-7-git-send-email-julien.grall@arm.com
State New
Headers show

Commit Message

Julien Grall Dec. 7, 2016, 12:33 p.m.
emulate_sysreg callback can only return 2 values: 0 or 1. Use bool
instead to make clear only two possible values exist.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/vgic-v3.c     | 6 +++---
 xen/arch/arm/vgic.c        | 2 +-
 xen/include/asm-arm/vgic.h | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Stefano Stabellini Dec. 7, 2016, 10:02 p.m. | #1
On Wed, 7 Dec 2016, Julien Grall wrote:
> emulate_sysreg callback can only return 2 values: 0 or 1. Use bool
> instead to make clear only two possible values exist.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


>  xen/arch/arm/vgic-v3.c     | 6 +++---
>  xen/arch/arm/vgic.c        | 2 +-
>  xen/include/asm-arm/vgic.h | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
> index 17c3000..e54df0b 100644
> --- a/xen/arch/arm/vgic-v3.c
> +++ b/xen/arch/arm/vgic-v3.c
> @@ -1300,7 +1300,7 @@ static bool vgic_v3_to_sgi(struct vcpu *v, register_t sgir)
>      return vgic_to_sgi(v, sgir, sgi_mode, virq, &target);
>  }
>  
> -static int vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
> +static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
>  {
>      struct vcpu *v = current;
>      struct hsr_sysreg sysreg = hsr.sysreg;
> @@ -1321,10 +1321,10 @@ static int vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
>          else
>          {
>              gprintk(XENLOG_WARNING, "Reading SGI1R_EL1 - WO register\n");
> -            return 0;
> +            return false;
>          }
>      default:
> -        return 0;
> +        return false;
>      }
>  }
>  
> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> index 3e1774d..196e86b 100644
> --- a/xen/arch/arm/vgic.c
> +++ b/xen/arch/arm/vgic.c
> @@ -546,7 +546,7 @@ void arch_evtchn_inject(struct vcpu *v)
>      vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq);
>  }
>  
> -int vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
> +bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
>  {
>      struct vcpu *v = current;
>  
> diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
> index 83843fa..fadb1e1 100644
> --- a/xen/include/asm-arm/vgic.h
> +++ b/xen/include/asm-arm/vgic.h
> @@ -131,7 +131,7 @@ struct vgic_ops {
>      /* Release resources that were allocated by domain_init */
>      void (*domain_free)(struct domain *d);
>      /* vGIC sysreg emulation */
> -    int (*emulate_sysreg)(struct cpu_user_regs *regs, union hsr hsr);
> +    bool (*emulate_sysreg)(struct cpu_user_regs *regs, union hsr hsr);
>      /* Maximum number of vCPU supported */
>      const unsigned int max_vcpus;
>  };
> @@ -300,7 +300,7 @@ extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq);
>  extern struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq);
>  extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int s);
>  extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq);
> -extern int vgic_emulate(struct cpu_user_regs *regs, union hsr hsr);
> +extern bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr);
>  extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n);
>  extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n);
>  extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops);
> -- 
> 1.9.1
>

Patch hide | download patch | download mbox

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 17c3000..e54df0b 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1300,7 +1300,7 @@  static bool vgic_v3_to_sgi(struct vcpu *v, register_t sgir)
     return vgic_to_sgi(v, sgir, sgi_mode, virq, &target);
 }
 
-static int vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
+static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
 {
     struct vcpu *v = current;
     struct hsr_sysreg sysreg = hsr.sysreg;
@@ -1321,10 +1321,10 @@  static int vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
         else
         {
             gprintk(XENLOG_WARNING, "Reading SGI1R_EL1 - WO register\n");
-            return 0;
+            return false;
         }
     default:
-        return 0;
+        return false;
     }
 }
 
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 3e1774d..196e86b 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -546,7 +546,7 @@  void arch_evtchn_inject(struct vcpu *v)
     vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq);
 }
 
-int vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
+bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
 {
     struct vcpu *v = current;
 
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index 83843fa..fadb1e1 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -131,7 +131,7 @@  struct vgic_ops {
     /* Release resources that were allocated by domain_init */
     void (*domain_free)(struct domain *d);
     /* vGIC sysreg emulation */
-    int (*emulate_sysreg)(struct cpu_user_regs *regs, union hsr hsr);
+    bool (*emulate_sysreg)(struct cpu_user_regs *regs, union hsr hsr);
     /* Maximum number of vCPU supported */
     const unsigned int max_vcpus;
 };
@@ -300,7 +300,7 @@  extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq);
 extern struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq);
 extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int s);
 extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq);
-extern int vgic_emulate(struct cpu_user_regs *regs, union hsr hsr);
+extern bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr);
 extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n);
 extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n);
 extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops);