From nobody Thu May 16 16:07:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1689953539135862.6446221008677; Fri, 21 Jul 2023 08:32:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.567624.886907 (Exim 4.92) (envelope-from ) id 1qMs6h-0005Dj-FS; Fri, 21 Jul 2023 15:31:51 +0000 Received: by outflank-mailman (output) from mailman id 567624.886907; Fri, 21 Jul 2023 15:31:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMs6h-0005Dc-Ck; Fri, 21 Jul 2023 15:31:51 +0000 Received: by outflank-mailman (input) for mailman id 567624; Fri, 21 Jul 2023 15:31:49 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMs6f-0005DW-Tc for xen-devel@lists.xenproject.org; Fri, 21 Jul 2023 15:31:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b552cbbb-27db-11ee-b23a-6b7b168915f2; Fri, 21 Jul 2023 17:31:49 +0200 (CEST) Received: from nico.bugseng.com (unknown [37.162.18.33]) by support.bugseng.com (Postfix) with ESMTPSA id C77BA4EE0C89; Fri, 21 Jul 2023 17:31:46 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b552cbbb-27db-11ee-b23a-6b7b168915f2 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , George Dunlap , Dario Faggioli , Andrew Cooper , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH] xen/sched: mechanical renaming to address MISRA C:2012 Rule 5.3 Date: Fri, 21 Jul 2023 17:31:36 +0200 Message-Id: <9945fd23b0bb88f3e0c6054a7f992cfa642d3f9f.1689953420.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1689953539958100001 Content-Type: text/plain; charset="utf-8" Rule 5.3 has the following headline: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope" The renaming s/sched_id/scheduler_id of the function defined in 'xen/common/sched/core.c' prevents any hiding of that function by the many instances of omonymous function parameters. Similarly, the renames - s/ops/operations - s/do_softirq/exec_softirq - s/loop/it are introduced for parameter names, to avoid any conflict with the homonymous variable or function defined in an enclosing scope. Signed-off-by: Nicola Vetrini --- xen/common/sched/core.c | 18 +++++++++--------- xen/common/sched/credit2.c | 4 ++-- xen/common/sysctl.c | 2 +- xen/include/xen/sched.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 022f548652..e74b1208bd 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -99,13 +99,13 @@ static void sched_set_affinity( struct sched_unit *unit, const cpumask_t *hard, const cpumask_t *soft); =20 static struct sched_resource *cf_check -sched_idle_res_pick(const struct scheduler *ops, const struct sched_unit *= unit) +sched_idle_res_pick(const struct scheduler *operations, const struct sched= _unit *unit) { return unit->res; } =20 static void *cf_check -sched_idle_alloc_udata(const struct scheduler *ops, struct sched_unit *uni= t, +sched_idle_alloc_udata(const struct scheduler *operations, struct sched_un= it *unit, void *dd) { /* Any non-NULL pointer is fine here. */ @@ -113,12 +113,12 @@ sched_idle_alloc_udata(const struct scheduler *ops, s= truct sched_unit *unit, } =20 static void cf_check -sched_idle_free_udata(const struct scheduler *ops, void *priv) +sched_idle_free_udata(const struct scheduler *operations, void *priv) { } =20 static void cf_check sched_idle_schedule( - const struct scheduler *ops, struct sched_unit *unit, s_time_t now, + const struct scheduler *operations, struct sched_unit *unit, s_time_t = now, bool tasklet_work_scheduled) { const unsigned int cpu =3D smp_processor_id(); @@ -2040,8 +2040,8 @@ long do_set_timer_op(s_time_t timeout) return 0; } =20 -/* sched_id - fetch ID of current scheduler */ -int sched_id(void) +/* scheduler_id - fetch ID of current scheduler */ +int scheduler_id(void) { return ops.sched_id; } @@ -2579,7 +2579,7 @@ static void cf_check sched_slave(void) struct sched_unit *prev =3D vprev->sched_unit, *next; s_time_t now; spinlock_t *lock; - bool do_softirq =3D false; + bool exec_softirq =3D false; unsigned int cpu =3D smp_processor_id(); =20 ASSERT_NOT_IN_ATOMIC(); @@ -2604,7 +2604,7 @@ static void cf_check sched_slave(void) return; } =20 - do_softirq =3D true; + exec_softirq =3D true; } =20 if ( !prev->rendezvous_in_cnt ) @@ -2614,7 +2614,7 @@ static void cf_check sched_slave(void) rcu_read_unlock(&sched_res_rculock); =20 /* Check for failed forced context switch. */ - if ( do_softirq ) + if ( exec_softirq ) raise_softirq(SCHEDULE_SOFTIRQ); =20 return; diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 87a1e31ee9..aba51a7963 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -3884,7 +3884,7 @@ csched2_dump(const struct scheduler *ops) list_for_each_entry ( rqd, &prv->rql, rql ) { struct list_head *iter, *runq =3D &rqd->runq; - int loop =3D 0; + int it =3D 0; =20 /* We need the lock to scan the runqueue. */ spin_lock(&rqd->lock); @@ -3901,7 +3901,7 @@ csched2_dump(const struct scheduler *ops) =20 if ( svc ) { - printk("\t%3d: ", loop++); + printk("\t%3d: ", it++); csched2_dump_unit(prv, svc); } } diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 0cbfe8bd44..7cabfb0230 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -71,7 +71,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sys= ctl) break; =20 case XEN_SYSCTL_sched_id: - op->u.sched_id.sched_id =3D sched_id(); + op->u.sched_id.sched_id =3D scheduler_id(); break; =20 case XEN_SYSCTL_getdomaininfolist: diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 854f3e32c0..bfe714d2e2 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -791,7 +791,7 @@ int sched_init_domain(struct domain *d, unsigned int p= oolid); 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 *); -int sched_id(void); +int scheduler_id(void); =20 /* * sched_get_id_by_name - retrieves a scheduler id given a scheduler name --=20 2.34.1