From nobody Thu May 16 13:51:18 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 168995300238010.453409037585288; Fri, 21 Jul 2023 08:23:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.567605.886878 (Exim 4.92) (envelope-from ) id 1qMry5-0002YJ-3m; Fri, 21 Jul 2023 15:22:57 +0000 Received: by outflank-mailman (output) from mailman id 567605.886878; Fri, 21 Jul 2023 15:22:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMry5-0002YC-0J; Fri, 21 Jul 2023 15:22:57 +0000 Received: by outflank-mailman (input) for mailman id 567605; Fri, 21 Jul 2023 15:22:56 +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 1qMry4-0002Y6-Bp for xen-devel@lists.xenproject.org; Fri, 21 Jul 2023 15:22:56 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 76ffece1-27da-11ee-b23a-6b7b168915f2; Fri, 21 Jul 2023 17:22:55 +0200 (CEST) Received: from nico.bugseng.com (unknown [37.162.18.33]) by support.bugseng.com (Postfix) with ESMTPSA id 01B564EE0C89; Fri, 21 Jul 2023 17:22:52 +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: 76ffece1-27da-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 , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [XEN PATCH] xen/arm: mechanical renaming to address MISRA C:2012 Rule 5.3 Date: Fri, 21 Jul 2023 17:22:40 +0200 Message-Id: <164303a2b19336a0e5f934a995d2a9c104035fab.1689952914.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: 1689953003248100001 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 function parameters renamed in this patch are hiding a variable defined in an enclosing scope or a function identifier. The following renames have been made: - s/guest_mode/guest_mode_on/ to distinguish from function 'guest_mode' - s/struct module_name/struct module_info to distinguish from the homonymous parameters, since the structure contains more information than just the nam= e. - s/file_name/file_info in 'xen/arch/arm/efi/efi-boot.h' for consistency wi= th the previous renaming. Signed-off-by: Nicola Vetrini Acked-by: Julien Grall --- xen/arch/arm/efi/efi-boot.h | 22 +++++++++++----------- xen/arch/arm/traps.c | 28 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 3daa63a40d..6126a71400 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -13,7 +13,7 @@ typedef struct { unsigned int name_len; EFI_PHYSICAL_ADDRESS addr; UINTN size; -} module_name; +} module_info; =20 /* * Binaries will be translated into bootmodules, the maximum number for th= em is @@ -21,7 +21,7 @@ typedef struct { */ #define MAX_UEFI_MODULES (MAX_MODULES - 2) static struct file __initdata module_binary; -static module_name __initdata modules[MAX_UEFI_MODULES]; +static module_info __initdata modules[MAX_UEFI_MODULES]; static unsigned int __initdata modules_available =3D MAX_UEFI_MODULES; static unsigned int __initdata modules_idx; =20 @@ -622,7 +622,7 @@ static int __init get_module_file_index(const char *nam= e, =20 for ( i =3D 0; i < modules_idx; i++ ) { - module_name *mod =3D &modules[i]; + module_info *mod =3D &modules[i]; if ( (mod->name_len =3D=3D name_len) && (strncmp(mod->name, name, name_len) =3D=3D 0) ) { @@ -648,7 +648,7 @@ static int __init allocate_module_file(const EFI_LOADED= _IMAGE *loaded_image, const char *name, unsigned int name_len) { - module_name *file_name; + module_info *file_info; CHAR16 *fname; union string module_name; int ret; @@ -668,18 +668,18 @@ static int __init allocate_module_file(const EFI_LOAD= ED_IMAGE *loaded_image, ret =3D modules_idx; =20 /* Save at this index the name of this binary */ - file_name =3D &modules[ret]; + file_info =3D &modules[ret]; =20 if ( efi_bs->AllocatePool(EfiLoaderData, (name_len + 1) * sizeof(char), - (void**)&file_name->name) !=3D EFI_SUCCESS ) + (void**)&file_info->name) !=3D EFI_SUCCESS ) { PrintMessage(L"Error allocating memory for module binary name"); return ERROR_ALLOC_MODULE_NAME; } =20 /* Save name and length of the binary in the data structure */ - strlcpy(file_name->name, name, name_len + 1); - file_name->name_len =3D name_len; + strlcpy(file_info->name, name, name_len + 1); + file_info->name_len =3D name_len; =20 /* Get the file system interface. */ if ( !*dir_handle ) @@ -689,8 +689,8 @@ static int __init allocate_module_file(const EFI_LOADED= _IMAGE *loaded_image, read_file(*dir_handle, s2w(&module_name), &module_binary, NULL); =20 /* Save address and size */ - file_name->addr =3D module_binary.addr; - file_name->size =3D module_binary.size; + file_info->addr =3D module_binary.addr; + file_info->size =3D module_binary.size; =20 /* s2w(...) allocates some memory, free it */ efi_bs->FreePool(module_name.w); @@ -716,7 +716,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, const void *uefi_name_prop; char mod_string[24]; /* Placeholder for module@ + a 64-bit number + \0= */ int uefi_name_len, file_idx, module_compat; - module_name *file; + module_info *file; =20 /* Check if the node is a multiboot,module otherwise return */ module_compat =3D fdt_node_check_compatible(fdt, module_node_offset, diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index d1ef787638..05860f063c 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -745,7 +745,7 @@ static const char *mode_string(register_t cpsr) =20 static void show_registers_32(const struct cpu_user_regs *regs, const struct reg_ctxt *ctxt, - bool guest_mode, + bool guest_mode_on, const struct vcpu *v) { =20 @@ -754,7 +754,7 @@ static void show_registers_32(const struct cpu_user_reg= s *regs, printk("PC: %08"PRIx32"\n", regs->pc32); #else printk("PC: %08"PRIx32, regs->pc); - if ( !guest_mode ) + if ( !guest_mode_on ) printk(" %pS", _p(regs->pc)); printk("\n"); #endif @@ -773,7 +773,7 @@ static void show_registers_32(const struct cpu_user_reg= s *regs, #endif regs->r12); =20 - if ( guest_mode ) + if ( guest_mode_on ) { printk("USR: SP: %08"PRIx32" LR: %"PRIregister"\n", regs->sp_usr, regs->lr); @@ -798,7 +798,7 @@ static void show_registers_32(const struct cpu_user_reg= s *regs, #endif printk("\n"); =20 - if ( guest_mode ) + if ( guest_mode_on ) { printk(" SCTLR: %"PRIregister"\n", ctxt->sctlr_el1); printk(" TCR: %"PRIregister"\n", ctxt->tcr_el1); @@ -822,18 +822,18 @@ static void show_registers_32(const struct cpu_user_r= egs *regs, #ifdef CONFIG_ARM_64 static void show_registers_64(const struct cpu_user_regs *regs, const struct reg_ctxt *ctxt, - bool guest_mode, + bool guest_mode_on, const struct vcpu *v) { =20 BUG_ON( (regs->cpsr & PSR_MODE_BIT) ); =20 printk("PC: %016"PRIx64, regs->pc); - if ( !guest_mode ) + if ( !guest_mode_on ) printk(" %pS", _p(regs->pc)); printk("\n"); printk("LR: %016"PRIx64"\n", regs->lr); - if ( guest_mode ) + if ( guest_mode_on ) { printk("SP_EL0: %016"PRIx64"\n", regs->sp_el0); printk("SP_EL1: %016"PRIx64"\n", regs->sp_el1); @@ -866,7 +866,7 @@ static void show_registers_64(const struct cpu_user_reg= s *regs, regs->x27, regs->x28, regs->fp); printk("\n"); =20 - if ( guest_mode ) + if ( guest_mode_on ) { printk(" ELR_EL1: %016"PRIx64"\n", regs->elr_el1); printk(" ESR_EL1: %08"PRIx32"\n", ctxt->esr_el1); @@ -883,28 +883,28 @@ static void show_registers_64(const struct cpu_user_r= egs *regs, =20 static void _show_registers(const struct cpu_user_regs *regs, const struct reg_ctxt *ctxt, - bool guest_mode, + bool guest_mode_on, const struct vcpu *v) { print_xen_info(); =20 printk("CPU: %d\n", smp_processor_id()); =20 - if ( guest_mode ) + if ( guest_mode_on ) { if ( regs_mode_is_32bit(regs) ) - show_registers_32(regs, ctxt, guest_mode, v); + show_registers_32(regs, ctxt, guest_mode_on, v); #ifdef CONFIG_ARM_64 else - show_registers_64(regs, ctxt, guest_mode, v); + show_registers_64(regs, ctxt, guest_mode_on, v); #endif } else { #ifdef CONFIG_ARM_64 - show_registers_64(regs, ctxt, guest_mode, v); + show_registers_64(regs, ctxt, guest_mode_on, v); #else - show_registers_32(regs, ctxt, guest_mode, v); + show_registers_32(regs, ctxt, guest_mode_on, v); #endif } printk(" VTCR_EL2: %"PRIregister"\n", READ_SYSREG(VTCR_EL2)); --=20 2.34.1