diff mbox series

[XEN,v3,6/6] xen/arm: change parameter names in replace_grant_host_mapping().

Message ID 2c2b9b3c53e556945baab3dd387bf029e12434b6.1687771796.git.federico.serafini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series fix violations of MISRA C:2012 Rule 8.3 on parameter names. | expand

Commit Message

Federico Serafini June 26, 2023, 9:52 a.m. UTC
In the current version of replace_grant_host_mapping() function, the
declaration (correctly) uses the parameter names 'gpaddr' and
'new_gpaddr', while the definition uses the parameter names 'addr' and
'new_addr'.
Change the parameter names of the definition to 'gpaddr' and
'new_gpaddr' so that it is clear what type of address is expected and
violations of MISRA C:2012 Rule 8.3 are fixed.

In both declaration and definition of function
replace_grant_host_mapping() change the parameter name 'mfn' to 'frame',
thus improving readability and keeping consistency with name used in
create_grant_host_mapping().

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/arch/arm/include/asm/grant_table.h |  2 +-
 xen/arch/arm/mm.c                      | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Julien Grall June 26, 2023, 2:17 p.m. UTC | #1
Hi,

On 26/06/2023 10:52, Federico Serafini wrote:
> In the current version of replace_grant_host_mapping() function, the
> declaration (correctly) uses the parameter names 'gpaddr' and
> 'new_gpaddr', while the definition uses the parameter names 'addr' and
> 'new_addr'.
> Change the parameter names of the definition to 'gpaddr' and
> 'new_gpaddr' so that it is clear what type of address is expected and
> violations of MISRA C:2012 Rule 8.3 are fixed.
> 
> In both declaration and definition of function
> replace_grant_host_mapping() change the parameter name 'mfn' to 'frame',
> thus improving readability and keeping consistency with name used in
> create_grant_host_mapping().
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/asm/grant_table.h
index 265e598e56..f2d115b97d 100644
--- a/xen/arch/arm/include/asm/grant_table.h
+++ b/xen/arch/arm/include/asm/grant_table.h
@@ -38,7 +38,7 @@  static inline bool gnttab_release_host_mappings(const struct domain *d)
 
 int create_grant_host_mapping(unsigned long gpaddr, mfn_t frame,
                               unsigned int flags, unsigned int cache_flags);
-int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
+int replace_grant_host_mapping(unsigned long gpaddr, mfn_t frame,
                                unsigned long new_gpaddr, unsigned int flags);
 
 /*
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 2e9860a754..0a3e1f3b64 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1600,17 +1600,17 @@  int create_grant_host_mapping(unsigned long gpaddr, mfn_t frame,
         return GNTST_okay;
 }
 
-int replace_grant_host_mapping(unsigned long addr, mfn_t mfn,
-                               unsigned long new_addr, unsigned int flags)
+int replace_grant_host_mapping(unsigned long gpaddr, mfn_t frame,
+                               unsigned long new_gpaddr, unsigned int flags)
 {
-    gfn_t gfn = gaddr_to_gfn(addr);
+    gfn_t gfn = gaddr_to_gfn(gpaddr);
     struct domain *d = current->domain;
     int rc;
 
-    if ( new_addr != 0 || (flags & GNTMAP_contains_pte) )
+    if ( new_gpaddr != 0 || (flags & GNTMAP_contains_pte) )
         return GNTST_general_error;
 
-    rc = guest_physmap_remove_page(d, gfn, mfn, 0);
+    rc = guest_physmap_remove_page(d, gfn, frame, 0);
 
     return rc ? GNTST_general_error : GNTST_okay;
 }