[XEN PATCH] common/sched: address a violation of MISRA C Rule 8.8

victorm.lira@amd.com posted 1 patch 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/5b6dfc7571bd76b5546d3881bd660a4e7a745409.1718928467.git.victorm.lira@amd.com
There is a newer version of this series
xen/common/sched/credit2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[XEN PATCH] common/sched: address a violation of MISRA C Rule 8.8
Posted by victorm.lira@amd.com 5 months ago
From: Victor Lira <victorm.lira@amd.com>

Rule 8.8: "The static storage class specifier shall be used in all
declarations of objects and functions that have internal linkage"

This patch fixes this by adding the static specifier.
No functional changes.

Reported-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
Signed-off-by: Victor Lira <victorm.lira@amd.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Dario Faggioli <dfaggioli@suse.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org
---
 xen/common/sched/credit2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 685929c290..10a32bd160 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -1476,7 +1476,7 @@ 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 *svc,
+static void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *svc,
                   s_time_t now);
 
 static inline void
@@ -1855,7 +1855,7 @@ static void reset_credit(int cpu, s_time_t now, struct csched2_unit *snext)
     /* No need to resort runqueue, as everyone's order should be the same. */
 }
 
-void burn_credits(struct csched2_runqueue_data *rqd,
+static void burn_credits(struct csched2_runqueue_data *rqd,
                   struct csched2_unit *svc, s_time_t now)
 {
     s_time_t delta;
-- 
2.37.6
Re: [XEN PATCH] common/sched: address a violation of MISRA C Rule 8.8
Posted by George Dunlap 5 months ago
On Fri, Jun 21, 2024 at 1:21 AM <victorm.lira@amd.com> wrote:
>
> From: Victor Lira <victorm.lira@amd.com>
>
> Rule 8.8: "The static storage class specifier shall be used in all
> declarations of objects and functions that have internal linkage"
>
> This patch fixes this by adding the static specifier.
> No functional changes.
>
> Reported-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> Signed-off-by: Victor Lira <victorm.lira@amd.com>

With the changes noted already:

Acked-by: George Dunlap <george.dunlap@cloud.com>
Re: [XEN PATCH] common/sched: address a violation of MISRA C Rule 8.8
Posted by Jan Beulich 5 months ago
On 21.06.2024 02:20, victorm.lira@amd.com wrote:
> --- a/xen/common/sched/credit2.c
> +++ b/xen/common/sched/credit2.c
> @@ -1476,7 +1476,7 @@ 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 *svc,
> +static void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *svc,
>                    s_time_t now);

On top of Andrew's comment, please also obey to line length restrictions.
This thus needs re-wrapping, to either

static void burn_credits(struct csched2_runqueue_data *rqd,
                         struct csched2_unit *svc, s_time_t now);

(then matching the function definition) or

static void burn_credits(
    struct csched2_runqueue_data *rqd,
    struct csched2_unit *svc,
    s_time_t now);

Jan
Re: [XEN PATCH] common/sched: address a violation of MISRA C Rule 8.8
Posted by Andrew Cooper 5 months ago
On 21/06/2024 1:20 am, victorm.lira@amd.com wrote:
> diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
> index 685929c290..10a32bd160 100644
> --- a/xen/common/sched/credit2.c
> +++ b/xen/common/sched/credit2.c
> @@ -1476,7 +1476,7 @@ 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 *svc,
> +static void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_unit *svc,
>                    s_time_t now);
>  
>  static inline void
> @@ -1855,7 +1855,7 @@ static void reset_credit(int cpu, s_time_t now, struct csched2_unit *snext)
>      /* No need to resort runqueue, as everyone's order should be the same. */
>  }
>  
> -void burn_credits(struct csched2_runqueue_data *rqd,
> +static void burn_credits(struct csched2_runqueue_data *rqd,
>                    struct csched2_unit *svc, s_time_t now)

Thankyou for the patch.  By and large it's fine, but for both of these
examples, please re-indent the following line too, so the parameter list
remains aligned in the eventual code.

~Andrew