diff mbox series

[XEN] xen/sched: address violations of MISRA C:2012 Rules 8.2 and 8.3

Message ID 072d163857101f4cdaf61b6336b2d8f2e65d7360.1690800014.git.federico.serafini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series [XEN] xen/sched: address violations of MISRA C:2012 Rules 8.2 and 8.3 | expand

Commit Message

Federico Serafini July 31, 2023, 12:03 p.m. UTC
Give a name to unnamed parameters to address violations of
MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
named parameters").
Keep consistency between parameter names and types used in function
declarations and the ones used in the corresponding function
definitions, thus addressing violations of MISRA C:2012 Rule 8.3
("All declarations of an object or function shall use the same names
and type qualifiers").

No functional changes.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/common/sched/compat.c  |  2 +-
 xen/common/sched/credit2.c |  3 ++-
 xen/common/sched/private.h |  2 +-
 xen/include/xen/sched.h    | 10 +++++-----
 4 files changed, 9 insertions(+), 8 deletions(-)

Comments

Stefano Stabellini July 31, 2023, 9:24 p.m. UTC | #1
On Mon, 31 Jul 2023, Federico Serafini wrote:
> Give a name to unnamed parameters to address violations of
> MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
> named parameters").
> Keep consistency between parameter names and types used in function
> declarations and the ones used in the corresponding function
> definitions, thus addressing violations of MISRA C:2012 Rule 8.3
> ("All declarations of an object or function shall use the same names
> and type qualifiers").
> 
> No functional changes.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

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


> ---
>  xen/common/sched/compat.c  |  2 +-
>  xen/common/sched/credit2.c |  3 ++-
>  xen/common/sched/private.h |  2 +-
>  xen/include/xen/sched.h    | 10 +++++-----
>  4 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/common/sched/compat.c b/xen/common/sched/compat.c
> index 040b4caca2..a596e3a226 100644
> --- a/xen/common/sched/compat.c
> +++ b/xen/common/sched/compat.c
> @@ -39,7 +39,7 @@ static int compat_poll(struct compat_sched_poll *compat)
>  
>  #include "core.c"
>  
> -int compat_set_timer_op(u32 lo, s32 hi)
> +int compat_set_timer_op(uint32_t lo, int32_t hi)
>  {
>      return do_set_timer_op(((s64)hi << 32) | lo);
>  }
> diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
> index 87a1e31ee9..7e23fabebb 100644
> --- a/xen/common/sched/credit2.c
> +++ b/xen/common/sched/credit2.c
> @@ -1480,7 +1480,8 @@ static inline void runq_remove(struct csched2_unit *svc)
>      list_del_init(&svc->runq_elem);
>  }
>  
> -void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *, s_time_t);
> +void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *svc,
> +                  s_time_t now);
>  
>  static inline void
>  tickle_cpu(unsigned int cpu, struct csched2_runqueue_data *rqd)
> diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h
> index 0527a8c70d..c516976c37 100644
> --- a/xen/common/sched/private.h
> +++ b/xen/common/sched/private.h
> @@ -629,7 +629,7 @@ int cpu_disable_scheduler(unsigned int cpu);
>  int schedule_cpu_add(unsigned int cpu, struct cpupool *c);
>  struct cpu_rm_data *alloc_cpu_rm_data(unsigned int cpu, bool aff_alloc);
>  void free_cpu_rm_data(struct cpu_rm_data *mem, unsigned int cpu);
> -int schedule_cpu_rm(unsigned int cpu, struct cpu_rm_data *mem);
> +int schedule_cpu_rm(unsigned int cpu, struct cpu_rm_data *data);
>  int sched_move_domain(struct domain *d, struct cpupool *c);
>  void sched_migrate_timers(unsigned int cpu);
>  struct cpupool *cpupool_get_by_id(unsigned int poolid);
> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
> index 854f3e32c0..5be61bb252 100644
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -789,8 +789,8 @@ int  sched_init_vcpu(struct vcpu *v);
>  void sched_destroy_vcpu(struct vcpu *v);
>  int  sched_init_domain(struct domain *d, unsigned int poolid);
>  void sched_destroy_domain(struct domain *d);
> -long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
> -long sched_adjust_global(struct xen_sysctl_scheduler_op *);
> +long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op);
> +long sched_adjust_global(struct xen_sysctl_scheduler_op *op);
>  int  sched_id(void);
>  
>  /*
> @@ -831,11 +831,11 @@ void context_switch(
>  
>  /*
>   * As described above, context_switch() must call this function when the
> - * local CPU is no longer running in @prev's context, and @prev's context is
> + * local CPU is no longer running in @vprev's context, and @vprev's context is
>   * saved to memory. Alternatively, if implementing lazy context switching,
> - * ensure that invoking sync_vcpu_execstate() will switch and commit @prev.
> + * ensure that invoking sync_vcpu_execstate() will switch and commit @vprev.
>   */
> -void sched_context_switched(struct vcpu *prev, struct vcpu *vnext);
> +void sched_context_switched(struct vcpu *vprev, struct vcpu *vnext);
>  
>  /* Called by the scheduler to continue running the current VCPU. */
>  void continue_running(
> -- 
> 2.34.1
>
Dario Faggioli Aug. 5, 2023, 12:47 a.m. UTC | #2
On Mon, 2023-07-31 at 14:24 -0700, Stefano Stabellini wrote:
> On Mon, 31 Jul 2023, Federico Serafini wrote:
> > Give a name to unnamed parameters to address violations of
> > MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form
> > with
> > named parameters").
> > Keep consistency between parameter names and types used in function
> > declarations and the ones used in the corresponding function
> > definitions, thus addressing violations of MISRA C:2012 Rule 8.3
> > ("All declarations of an object or function shall use the same
> > names
> > and type qualifiers").
> > 
> > No functional changes.
> > 
> > Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
Acked-by: Dario Faggioli <dfaggioli@suse.com>

Thanks and Regards
diff mbox series

Patch

diff --git a/xen/common/sched/compat.c b/xen/common/sched/compat.c
index 040b4caca2..a596e3a226 100644
--- a/xen/common/sched/compat.c
+++ b/xen/common/sched/compat.c
@@ -39,7 +39,7 @@  static int compat_poll(struct compat_sched_poll *compat)
 
 #include "core.c"
 
-int compat_set_timer_op(u32 lo, s32 hi)
+int compat_set_timer_op(uint32_t lo, int32_t hi)
 {
     return do_set_timer_op(((s64)hi << 32) | lo);
 }
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 87a1e31ee9..7e23fabebb 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -1480,7 +1480,8 @@  static inline void runq_remove(struct csched2_unit *svc)
     list_del_init(&svc->runq_elem);
 }
 
-void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *, s_time_t);
+void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *svc,
+                  s_time_t now);
 
 static inline void
 tickle_cpu(unsigned int cpu, struct csched2_runqueue_data *rqd)
diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h
index 0527a8c70d..c516976c37 100644
--- a/xen/common/sched/private.h
+++ b/xen/common/sched/private.h
@@ -629,7 +629,7 @@  int cpu_disable_scheduler(unsigned int cpu);
 int schedule_cpu_add(unsigned int cpu, struct cpupool *c);
 struct cpu_rm_data *alloc_cpu_rm_data(unsigned int cpu, bool aff_alloc);
 void free_cpu_rm_data(struct cpu_rm_data *mem, unsigned int cpu);
-int schedule_cpu_rm(unsigned int cpu, struct cpu_rm_data *mem);
+int schedule_cpu_rm(unsigned int cpu, struct cpu_rm_data *data);
 int sched_move_domain(struct domain *d, struct cpupool *c);
 void sched_migrate_timers(unsigned int cpu);
 struct cpupool *cpupool_get_by_id(unsigned int poolid);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 854f3e32c0..5be61bb252 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -789,8 +789,8 @@  int  sched_init_vcpu(struct vcpu *v);
 void sched_destroy_vcpu(struct vcpu *v);
 int  sched_init_domain(struct domain *d, unsigned int poolid);
 void sched_destroy_domain(struct domain *d);
-long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
-long sched_adjust_global(struct xen_sysctl_scheduler_op *);
+long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op);
+long sched_adjust_global(struct xen_sysctl_scheduler_op *op);
 int  sched_id(void);
 
 /*
@@ -831,11 +831,11 @@  void context_switch(
 
 /*
  * As described above, context_switch() must call this function when the
- * local CPU is no longer running in @prev's context, and @prev's context is
+ * local CPU is no longer running in @vprev's context, and @vprev's context is
  * saved to memory. Alternatively, if implementing lazy context switching,
- * ensure that invoking sync_vcpu_execstate() will switch and commit @prev.
+ * ensure that invoking sync_vcpu_execstate() will switch and commit @vprev.
  */
-void sched_context_switched(struct vcpu *prev, struct vcpu *vnext);
+void sched_context_switched(struct vcpu *vprev, struct vcpu *vnext);
 
 /* Called by the scheduler to continue running the current VCPU. */
 void continue_running(