diff mbox series

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

Message ID 5b6dfc7571bd76b5546d3881bd660a4e7a745409.1718928467.git.victorm.lira@amd.com (mailing list archive)
State Superseded
Headers show
Series [XEN] common/sched: address a violation of MISRA C Rule 8.8 | expand

Commit Message

Lira, Victor M June 21, 2024, 12:20 a.m. UTC
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(-)

Comments

Andrew Cooper June 21, 2024, 12:43 a.m. UTC | #1
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
Jan Beulich June 21, 2024, 6:30 a.m. UTC | #2
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
George Dunlap June 21, 2024, 9:02 a.m. UTC | #3
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>
diff mbox series

Patch

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;