diff mbox

[Xen-devel,02/13] xen/arm: vtimer: Switch the read variable in the emulation from int to bool

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

Commit Message

Julien Grall Dec. 7, 2016, 12:33 p.m. UTC
The read variable can only take two values: 1 => read, 0 => write. Use
bool instead to make clear the variable can only take 2 values.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/vtimer.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Stefano Stabellini Dec. 7, 2016, 9:49 p.m. UTC | #1
On Wed, 7 Dec 2016, Julien Grall wrote:
> The read variable can only take two values: 1 => read, 0 => write. Use
> bool instead to make clear the variable can only take 2 values.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

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


>  xen/arch/arm/vtimer.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
> index f8d3295..3fc97b3 100644
> --- a/xen/arch/arm/vtimer.c
> +++ b/xen/arch/arm/vtimer.c
> @@ -164,7 +164,7 @@ int virt_timer_restore(struct vcpu *v)
>      return 0;
>  }
>  
> -static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, int read)
> +static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, bool read)
>  {
>      struct vcpu *v = current;
>  
> @@ -193,7 +193,8 @@ static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, int read)
>      return true;
>  }
>  
> -static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r, int read)
> +static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r,
> +                             bool read)
>  {
>      struct vcpu *v = current;
>      s_time_t now;
> @@ -221,7 +222,8 @@ static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r, int read)
>      return true;
>  }
>  
> -static bool vtimer_cntp_cval(struct cpu_user_regs *regs, uint64_t *r, int read)
> +static bool vtimer_cntp_cval(struct cpu_user_regs *regs, uint64_t *r,
> +                             bool read)
>  {
>      struct vcpu *v = current;
>  
> @@ -320,9 +322,9 @@ static bool vtimer_emulate_cp64(struct cpu_user_regs *regs, union hsr hsr)
>  
>  #ifdef CONFIG_ARM_64
>  typedef bool (*vtimer_sysreg32_fn_t)(struct cpu_user_regs *regs, uint32_t *r,
> -                                     int read);
> +                                     bool read);
>  typedef bool (*vtimer_sysreg64_fn_t)(struct cpu_user_regs *regs, uint64_t *r,
> -                                     int read);
> +                                     bool read);
>  
>  static bool vtimer_emulate_sysreg32(struct cpu_user_regs *regs, union hsr hsr,
>                                      vtimer_sysreg32_fn_t fn)
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index f8d3295..3fc97b3 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -164,7 +164,7 @@  int virt_timer_restore(struct vcpu *v)
     return 0;
 }
 
-static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, int read)
+static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, bool read)
 {
     struct vcpu *v = current;
 
@@ -193,7 +193,8 @@  static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, int read)
     return true;
 }
 
-static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r, int read)
+static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r,
+                             bool read)
 {
     struct vcpu *v = current;
     s_time_t now;
@@ -221,7 +222,8 @@  static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r, int read)
     return true;
 }
 
-static bool vtimer_cntp_cval(struct cpu_user_regs *regs, uint64_t *r, int read)
+static bool vtimer_cntp_cval(struct cpu_user_regs *regs, uint64_t *r,
+                             bool read)
 {
     struct vcpu *v = current;
 
@@ -320,9 +322,9 @@  static bool vtimer_emulate_cp64(struct cpu_user_regs *regs, union hsr hsr)
 
 #ifdef CONFIG_ARM_64
 typedef bool (*vtimer_sysreg32_fn_t)(struct cpu_user_regs *regs, uint32_t *r,
-                                     int read);
+                                     bool read);
 typedef bool (*vtimer_sysreg64_fn_t)(struct cpu_user_regs *regs, uint64_t *r,
-                                     int read);
+                                     bool read);
 
 static bool vtimer_emulate_sysreg32(struct cpu_user_regs *regs, union hsr hsr,
                                     vtimer_sysreg32_fn_t fn)