From nobody Sat May 18 07:31:17 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 169081055751157.31232680934238; Mon, 31 Jul 2023 06:35:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.573058.897377 (Exim 4.92) (envelope-from ) id 1qQT3l-00005Q-AI; Mon, 31 Jul 2023 13:35:41 +0000 Received: by outflank-mailman (output) from mailman id 573058.897377; Mon, 31 Jul 2023 13:35:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3l-000058-7a; Mon, 31 Jul 2023 13:35:41 +0000 Received: by outflank-mailman (input) for mailman id 573058; Mon, 31 Jul 2023 13:35:40 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3k-0008Hl-2y for xen-devel@lists.xenproject.org; Mon, 31 Jul 2023 13:35:40 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 22baf4b5-2fa7-11ee-8613-37d641c3527e; Mon, 31 Jul 2023 15:35:38 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 288E84EE0740; Mon, 31 Jul 2023 15:35:37 +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: 22baf4b5-2fa7-11ee-8613-37d641c3527e 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 , Jan Beulich , Paul Durrant , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH 1/4] xen/pci: rename local variable to address MISRA C:2012 Rule 5.3 Date: Mon, 31 Jul 2023 15:34:59 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690810558770100003 Content-Type: text/plain; charset="utf-8" The rename s/pdev_type/pci_dev_type/ is done to avoid shadowing the homonymous function declaration. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/drivers/passthrough/pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 95846e84f2..1dc519d1b6 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -650,12 +650,12 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, struct pci_seg *pseg; struct pci_dev *pdev; unsigned int slot =3D PCI_SLOT(devfn), func =3D PCI_FUNC(devfn); - const char *pdev_type; + const char *pci_dev_type; int ret; bool pf_is_extfn =3D false; =20 if ( !info ) - pdev_type =3D "device"; + pci_dev_type =3D "device"; else if ( info->is_virtfn ) { pcidevs_lock(); @@ -668,12 +668,12 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, if ( !pdev ) pci_add_device(seg, info->physfn.bus, info->physfn.devfn, NULL, node); - pdev_type =3D "virtual function"; + pci_dev_type =3D "virtual function"; } else if ( info->is_extfn ) - pdev_type =3D "extended function"; + pci_dev_type =3D "extended function"; else - pdev_type =3D "device"; + pci_dev_type =3D "device"; =20 ret =3D xsm_resource_plug_pci(XSM_PRIV, (seg << 16) | (bus << 8) | dev= fn); if ( ret ) @@ -780,7 +780,7 @@ out: pcidevs_unlock(); if ( !ret ) { - printk(XENLOG_DEBUG "PCI add %s %pp\n", pdev_type, &pdev->sbdf); + printk(XENLOG_DEBUG "PCI add %s %pp\n", pci_dev_type, &pdev->sbdf= ); while ( pdev->phantom_stride ) { func +=3D pdev->phantom_stride; --=20 2.34.1 From nobody Sat May 18 07:31:17 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 1690810559269959.8689895699749; Mon, 31 Jul 2023 06:35:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.573059.897388 (Exim 4.92) (envelope-from ) id 1qQT3m-0000MJ-HE; Mon, 31 Jul 2023 13:35:42 +0000 Received: by outflank-mailman (output) from mailman id 573059.897388; Mon, 31 Jul 2023 13:35:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3m-0000MA-E9; Mon, 31 Jul 2023 13:35:42 +0000 Received: by outflank-mailman (input) for mailman id 573059; Mon, 31 Jul 2023 13:35:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3l-0008Hl-9w for xen-devel@lists.xenproject.org; Mon, 31 Jul 2023 13:35:41 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 23708b65-2fa7-11ee-8613-37d641c3527e; Mon, 31 Jul 2023 15:35:39 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 6C4024EE0741; Mon, 31 Jul 2023 15:35:38 +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: 23708b65-2fa7-11ee-8613-37d641c3527e 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 , Jan Beulich , Andrew Cooper Subject: [XEN PATCH 2/4] amd/iommu: rename functions to address MISRA C:2012 Rule 5.3 Date: Mon, 31 Jul 2023 15:35:00 +0200 Message-Id: <838e606bfe8b83578970ce73a1ac7d71ccefcd2b.1690810346.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690810560088100005 Content-Type: text/plain; charset="utf-8" The functions 'machine_bfd' and 'guest_bfd' have gained the prefix 'get_' to avoid the mutual shadowing with the homonymous parameters in these functions. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich Reviewed-by: Stefano Stabellini --- xen/drivers/passthrough/amd/iommu_guest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passth= rough/amd/iommu_guest.c index 80a331f546..47a912126a 100644 --- a/xen/drivers/passthrough/amd/iommu_guest.c +++ b/xen/drivers/passthrough/amd/iommu_guest.c @@ -38,12 +38,12 @@ (reg)->hi =3D (val) >> 32; \ } while (0) =20 -static unsigned int machine_bdf(struct domain *d, uint16_t guest_bdf) +static unsigned int get_machine_bdf(struct domain *d, uint16_t guest_bdf) { return guest_bdf; } =20 -static uint16_t guest_bdf(struct domain *d, uint16_t machine_bdf) +static uint16_t get_guest_bdf(struct domain *d, uint16_t machine_bdf) { return machine_bdf; } @@ -195,7 +195,7 @@ void guest_iommu_add_ppr_log(struct domain *d, u32 entr= y[]) log =3D map_domain_page(_mfn(mfn)) + (tail & ~PAGE_MASK); =20 /* Convert physical device id back into virtual device id */ - gdev_id =3D guest_bdf(d, iommu_get_devid_from_cmd(entry[0])); + gdev_id =3D get_guest_bdf(d, iommu_get_devid_from_cmd(entry[0])); iommu_set_devid_to_cmd(&entry[0], gdev_id); =20 memcpy(log, entry, sizeof(ppr_entry_t)); @@ -245,7 +245,7 @@ void guest_iommu_add_event_log(struct domain *d, u32 en= try[]) log =3D map_domain_page(_mfn(mfn)) + (tail & ~PAGE_MASK); =20 /* re-write physical device id into virtual device id */ - dev_id =3D guest_bdf(d, iommu_get_devid_from_cmd(entry[0])); + dev_id =3D get_guest_bdf(d, iommu_get_devid_from_cmd(entry[0])); iommu_set_devid_to_cmd(&entry[0], dev_id); memcpy(log, entry, sizeof(event_entry_t)); =20 @@ -268,7 +268,7 @@ static int do_complete_ppr_request(struct domain *d, cm= d_entry_t *cmd) uint16_t dev_id; struct amd_iommu *iommu; =20 - dev_id =3D machine_bdf(d, iommu_get_devid_from_cmd(cmd->data[0])); + dev_id =3D get_machine_bdf(d, iommu_get_devid_from_cmd(cmd->data[0])); iommu =3D find_iommu_for_device(0, dev_id); =20 if ( !iommu ) @@ -320,7 +320,7 @@ static int do_invalidate_iotlb_pages(struct domain *d, = cmd_entry_t *cmd) struct amd_iommu *iommu; uint16_t dev_id; =20 - dev_id =3D machine_bdf(d, iommu_get_devid_from_cmd(cmd->data[0])); + dev_id =3D get_machine_bdf(d, iommu_get_devid_from_cmd(cmd->data[0])); =20 iommu =3D find_iommu_for_device(0, dev_id); if ( !iommu ) @@ -396,7 +396,7 @@ static int do_invalidate_dte(struct domain *d, cmd_entr= y_t *cmd) =20 g_iommu =3D domain_iommu(d); gbdf =3D iommu_get_devid_from_cmd(cmd->data[0]); - mbdf =3D machine_bdf(d, gbdf); + mbdf =3D get_machine_bdf(d, gbdf); =20 /* Guest can only update DTEs for its passthru devices */ if ( mbdf =3D=3D 0 || gbdf =3D=3D 0 ) --=20 2.34.1 From nobody Sat May 18 07:31:17 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 1690810562691499.28348707649263; Mon, 31 Jul 2023 06:36:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.573060.897398 (Exim 4.92) (envelope-from ) id 1qQT3n-0000cW-Oe; Mon, 31 Jul 2023 13:35:43 +0000 Received: by outflank-mailman (output) from mailman id 573060.897398; Mon, 31 Jul 2023 13:35:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3n-0000cP-L3; Mon, 31 Jul 2023 13:35:43 +0000 Received: by outflank-mailman (input) for mailman id 573060; Mon, 31 Jul 2023 13:35:42 +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 1qQT3l-0000Co-VQ for xen-devel@lists.xenproject.org; Mon, 31 Jul 2023 13:35:41 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 240bf8d7-2fa7-11ee-b255-6b7b168915f2; Mon, 31 Jul 2023 15:35:40 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id AFD544EE0742; Mon, 31 Jul 2023 15:35:39 +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: 240bf8d7-2fa7-11ee-b255-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 , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 3/4] xen: rename variables and parameters to address MISRA C:2012 Rule 5.3 Date: Mon, 31 Jul 2023 15:35:01 +0200 Message-Id: <8aebc67a150cb4116affdd6da755a8e82c827ffa.1690810346.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690810563694100001 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" Local variables have been suitably renamed to address some violations of this rule: - s/cmp/c/ because it shadows the union declared at line 87. - s/nodes/numa_nodes/ shadows the static variable declared at line 18. - s/ctrl/controller/ because the homonymous function parameter is later read. - s/baud/baud_rate/ to avoid shadowing the enum constant defined at line 1391. No functional change. Signed-off-by: Nicola Vetrini --- xen/common/compat/memory.c | 6 +++--- xen/common/numa.c | 36 ++++++++++++++++++------------------ xen/drivers/char/ehci-dbgp.c | 4 ++-- xen/drivers/char/ns16550.c | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 8ca63ceda6..3cf0a37d00 100644 --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -321,12 +321,12 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HAND= LE_PARAM(void) compat) =20 case XENMEM_remove_from_physmap: { - struct compat_remove_from_physmap cmp; + struct compat_remove_from_physmap c; =20 - if ( copy_from_guest(&cmp, compat, 1) ) + if ( copy_from_guest(&c, compat, 1) ) return -EFAULT; =20 - XLAT_remove_from_physmap(nat.xrfp, &cmp); + XLAT_remove_from_physmap(nat.xrfp, &c); =20 break; } diff --git a/xen/common/numa.c b/xen/common/numa.c index fc1f7f665b..301f2cf374 100644 --- a/xen/common/numa.c +++ b/xen/common/numa.c @@ -382,7 +382,7 @@ static bool __init numa_process_nodes(paddr_t start, pa= ddr_t end) * 0 if memnodmap[] too small (or shift too small) * -1 if node overlap or lost ram (shift too big) */ -static int __init populate_memnodemap(const struct node *nodes, +static int __init populate_memnodemap(const struct node *numa_nodes, unsigned int numnodes, unsigned int = shift, const nodeid_t *nodeids) { @@ -393,8 +393,8 @@ static int __init populate_memnodemap(const struct node= *nodes, =20 for ( i =3D 0; i < numnodes; i++ ) { - unsigned long spdx =3D paddr_to_pdx(nodes[i].start); - unsigned long epdx =3D paddr_to_pdx(nodes[i].end - 1); + unsigned long spdx =3D paddr_to_pdx(numa_nodes[i].start); + unsigned long epdx =3D paddr_to_pdx(numa_nodes[i].end - 1); =20 if ( spdx > epdx ) continue; @@ -440,7 +440,7 @@ static int __init allocate_cachealigned_memnodemap(void) * The LSB of all start addresses in the node map is the value of the * maximum possible shift. */ -static unsigned int __init extract_lsb_from_nodes(const struct node *nodes, +static unsigned int __init extract_lsb_from_nodes(const struct node *numa_= nodes, nodeid_t numnodes, const nodeid_t *nodeids) { @@ -449,8 +449,8 @@ static unsigned int __init extract_lsb_from_nodes(const= struct node *nodes, =20 for ( i =3D 0; i < numnodes; i++ ) { - unsigned long spdx =3D paddr_to_pdx(nodes[i].start); - unsigned long epdx =3D paddr_to_pdx(nodes[i].end - 1) + 1; + unsigned long spdx =3D paddr_to_pdx(numa_nodes[i].start); + unsigned long epdx =3D paddr_to_pdx(numa_nodes[i].end - 1) + 1; =20 if ( spdx >=3D epdx ) continue; @@ -475,10 +475,10 @@ static unsigned int __init extract_lsb_from_nodes(con= st struct node *nodes, return i; } =20 -int __init compute_hash_shift(const struct node *nodes, +int __init compute_hash_shift(const struct node *numa_nodes, unsigned int numnodes, const nodeid_t *nodei= ds) { - unsigned int shift =3D extract_lsb_from_nodes(nodes, numnodes, nodeids= ); + unsigned int shift =3D extract_lsb_from_nodes(numa_nodes, numnodes, no= deids); =20 if ( memnodemapsize <=3D ARRAY_SIZE(_memnodemap) ) memnodemap =3D _memnodemap; @@ -487,7 +487,7 @@ int __init compute_hash_shift(const struct node *nodes, =20 printk(KERN_DEBUG "NUMA: Using %u for the hash shift\n", shift); =20 - if ( populate_memnodemap(nodes, numnodes, shift, nodeids) !=3D 1 ) + if ( populate_memnodemap(numa_nodes, numnodes, shift, nodeids) !=3D 1 ) { printk(KERN_INFO "Your memory is not aligned you need to " "rebuild your hypervisor with a bigger NODEMAPSIZE " @@ -541,7 +541,7 @@ static int __init numa_emulation(unsigned long start_pf= n, { int ret; unsigned int i; - struct node nodes[MAX_NUMNODES]; + struct node numa_nodes[MAX_NUMNODES]; uint64_t sz =3D pfn_to_paddr(end_pfn - start_pfn) / numa_fake; =20 /* Kludge needed for the hash function */ @@ -556,22 +556,22 @@ static int __init numa_emulation(unsigned long start_= pfn, sz =3D x; } =20 - memset(&nodes, 0, sizeof(nodes)); + memset(&numa_nodes, 0, sizeof(numa_nodes)); for ( i =3D 0; i < numa_fake; i++ ) { - nodes[i].start =3D pfn_to_paddr(start_pfn) + i * sz; + numa_nodes[i].start =3D pfn_to_paddr(start_pfn) + i * sz; =20 if ( i =3D=3D numa_fake - 1 ) - sz =3D pfn_to_paddr(end_pfn) - nodes[i].start; + sz =3D pfn_to_paddr(end_pfn) - numa_nodes[i].start; =20 - nodes[i].end =3D nodes[i].start + sz; + numa_nodes[i].end =3D numa_nodes[i].start + sz; printk(KERN_INFO "Faking node %u at %"PRIx64"-%"PRIx64" (%"PRIu64"= MB)\n", - i, nodes[i].start, nodes[i].end, - (nodes[i].end - nodes[i].start) >> 20); + i, numa_nodes[i].start, numa_nodes[i].end, + (numa_nodes[i].end - numa_nodes[i].start) >> 20); node_set_online(i); } =20 - ret =3D compute_hash_shift(nodes, numa_fake, NULL); + ret =3D compute_hash_shift(numa_nodes, numa_fake, NULL); if ( ret < 0 ) { printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\= n"); @@ -580,7 +580,7 @@ static int __init numa_emulation(unsigned long start_pf= n, memnode_shift =3D ret; =20 for_each_online_node ( i ) - setup_node_bootmem(i, nodes[i].start, nodes[i].end); + setup_node_bootmem(i, numa_nodes[i].start, numa_nodes[i].end); =20 numa_init_array(); =20 diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c index 4d8d765122..22650663dc 100644 --- a/xen/drivers/char/ehci-dbgp.c +++ b/xen/drivers/char/ehci-dbgp.c @@ -424,9 +424,9 @@ static void dbgp_issue_command(struct ehci_dbgp *dbgp, = u32 ctrl, * checks to see if ACPI or some other initialization also * reset the EHCI debug port. */ - u32 ctrl =3D readl(&dbgp->ehci_debug->control); + u32 controller =3D readl(&dbgp->ehci_debug->control); =20 - if ( ctrl & DBGP_ENABLED ) + if ( controller & DBGP_ENABLED ) { cmd |=3D CMD_RUN; writel(cmd, &dbgp->ehci_regs->command); diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 212a9c49ae..61c7a19c4d 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1473,7 +1473,7 @@ static enum __init serial_param_type get_token(char *= token, char **value) =20 static bool __init parse_positional(struct ns16550 *uart, char **str) { - int baud; + int baud_rate; const char *conf; char *name_val_pos; =20 @@ -1504,7 +1504,7 @@ static bool __init parse_positional(struct ns16550 *u= art, char **str) uart->baud =3D BAUD_AUTO; conf +=3D 4; } - else if ( (baud =3D simple_strtoul(conf, &conf, 10)) !=3D 0 ) + else if ( (baud_rate =3D simple_strtoul(conf, &conf, 10)) !=3D 0 ) uart->baud =3D baud; =20 if ( *conf =3D=3D '/' ) --=20 2.34.1 From nobody Sat May 18 07:31:17 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 1690810565231686.4606117888437; Mon, 31 Jul 2023 06:36:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.573061.897408 (Exim 4.92) (envelope-from ) id 1qQT3p-0000t7-1c; Mon, 31 Jul 2023 13:35:45 +0000 Received: by outflank-mailman (output) from mailman id 573061.897408; Mon, 31 Jul 2023 13:35:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3o-0000su-T7; Mon, 31 Jul 2023 13:35:44 +0000 Received: by outflank-mailman (input) for mailman id 573061; Mon, 31 Jul 2023 13:35:43 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQT3n-0008Hl-C2 for xen-devel@lists.xenproject.org; Mon, 31 Jul 2023 13:35:43 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 247e0a1a-2fa7-11ee-8613-37d641c3527e; Mon, 31 Jul 2023 15:35:41 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 9E1844EE0743; Mon, 31 Jul 2023 15:35:40 +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: 247e0a1a-2fa7-11ee-8613-37d641c3527e 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 , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , "Daniel P. Smith" Subject: [XEN PATCH 4/4] arm/efi: address MISRA C:2012 Rule 5.3 Date: Mon, 31 Jul 2023 15:35:02 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690810567532100001 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 parameter 'fdt' in static function within this file is removed, as they served no purpose and shadowed the homonymous variable. For the same reason the local variable in 'lookup_fdt_config_table' is dropped and the function is now consequently static void. No functional changes. Signed-off-by: Nicola Vetrini --- xen/arch/arm/efi/efi-boot.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 6126a71400..ec328885a3 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -52,7 +52,7 @@ static struct file __initdata dtbfile; static void __initdata *fdt; static void __initdata *memmap; =20 -static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_= cells) +static int __init setup_chosen_node(int *addr_cells, int *size_cells) { int node; const struct fdt_property *prop; @@ -114,7 +114,7 @@ static int __init setup_chosen_node(void *fdt, int *add= r_cells, int *size_cells) * Set a single 'reg' property taking into account the * configured addr and size cell sizes. */ -static int __init fdt_set_reg(void *fdt, int node, int addr_cells, +static int __init fdt_set_reg(int node, int addr_cells, int size_cells, uint64_t addr, uint64_t len) { __be32 val[4]; /* At most 2 64 bit values to be stored */ @@ -138,13 +138,16 @@ static int __init fdt_set_reg(void *fdt, int node, in= t addr_cells, return(fdt_setprop(fdt, node, "reg", val, sizeof(*cellp) * (cellp - va= l))); } =20 -static void __init *lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table) +/* + * Set the variable 'fdt' if a matching guid is found. + */ +static void __init lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table) { static const EFI_GUID __initconst fdt_guid =3D DEVICE_TREE_GUID; EFI_CONFIGURATION_TABLE *tables; - void *fdt =3D NULL; int i; =20 + fdt =3D NULL; tables =3D sys_table->ConfigurationTable; for ( i =3D 0; i < sys_table->NumberOfTableEntries; i++ ) { @@ -154,7 +157,6 @@ static void __init *lookup_fdt_config_table(EFI_SYSTEM_= TABLE *sys_table) break; } } - return fdt; } =20 static bool __init meminfo_add_bank(struct meminfo *mem, @@ -228,7 +230,6 @@ static EFI_STATUS __init efi_process_memory_map_bootinf= o(EFI_MEMORY_DESCRIPTOR * * and memory map information. */ EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, - void *fdt, EFI_MEMORY_DESCRIPTOR *memory_= map, UINTN map_size, UINTN desc_size, @@ -383,7 +384,7 @@ static void __init efi_arch_process_memory_map(EFI_SYST= EM_TABLE *SystemTable, if ( EFI_ERROR(status) ) blexit(L"EFI memory map processing failed"); =20 - status =3D fdt_add_uefi_nodes(SystemTable, fdt, map, map_size, desc_si= ze, + status =3D fdt_add_uefi_nodes(SystemTable, map, map_size, desc_size, desc_ver); if ( EFI_ERROR(status) ) PrintErrMesg(L"Updating FDT failed", status); @@ -542,7 +543,7 @@ static void __init efi_arch_handle_module(const struct = file *file, =20 if ( file =3D=3D &dtbfile ) return; - chosen =3D setup_chosen_node(fdt, &addr_len, &size_len); + chosen =3D setup_chosen_node(&addr_len, &size_len); if ( chosen < 0 ) blexit(L"Unable to setup chosen node"); =20 @@ -557,7 +558,7 @@ static void __init efi_arch_handle_module(const struct = file *file, if ( fdt_setprop(fdt, node, "compatible", ramdisk_compat, sizeof(ramdisk_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, ramdisk.addr, + if ( fdt_set_reg(node, addr_len, size_len, ramdisk.addr, ramdisk.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -572,7 +573,7 @@ static void __init efi_arch_handle_module(const struct = file *file, if ( fdt_setprop(fdt, node, "compatible", xsm_compat, sizeof(xsm_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, xsm.addr, + if ( fdt_set_reg(node, addr_len, size_len, xsm.addr, xsm.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -589,7 +590,7 @@ static void __init efi_arch_handle_module(const struct = file *file, blexit(L"Unable to set compatible property."); if ( options && fdt_setprop_string(fdt, node, "bootargs", options)= < 0 ) blexit(L"Unable to set bootargs property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, kernel.addr, + if ( fdt_set_reg(node, addr_len, size_len, kernel.addr, kernel.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -757,7 +758,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, return ERROR_RENAME_MODULE_NAME; } =20 - if ( fdt_set_reg(fdt, module_node_offset, reg_addr_cells, reg_size_cel= ls, + if ( fdt_set_reg(module_node_offset, reg_addr_cells, reg_size_cells, file->addr, file->size) < 0 ) { PrintMessage(L"Unable to set module reg property."); @@ -862,7 +863,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IM= AGE *loaded_image) EFI_FILE_HANDLE dir_handle =3D NULL; =20 /* Check for the chosen node in the current DTB */ - chosen =3D setup_chosen_node(fdt, &addr_len, &size_len); + chosen =3D setup_chosen_node(&addr_len, &size_len); if ( chosen < 0 ) { PrintMessage(L"Unable to setup chosen node"); @@ -951,7 +952,7 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_= TABLE *SystemTable) * node to decide whether to skip the UEFI Xen configuration file or n= ot. */ =20 - fdt =3D lookup_fdt_config_table(SystemTable); + lookup_fdt_config_table(SystemTable); dtbfile.ptr =3D fdt; dtbfile.need_to_free =3D false; /* Config table memory can't be freed.= */ =20 --=20 2.34.1