diff mbox series

[XEN,2/5] x86: change parameter names of nestedhvm_vcpu_iomap_get() definition

Message ID 7392b1adc50c77855bec846f1a14e30f6a8ae1d6.1688049495.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 29, 2023, 3:55 p.m. UTC
Change parameter names of nestedhvm_vcpu_iomap_get() definition to
those used in the function declaration in order to:
1) improve readability;
2) fix violations of MISRA C:2012 Rule 8.3.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/arch/x86/hvm/nestedhvm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Stefano Stabellini June 29, 2023, 7:25 p.m. UTC | #1
On Thu, 29 Jun 2023, Federico Serafini wrote:
> Change parameter names of nestedhvm_vcpu_iomap_get() definition to
> those used in the function declaration in order to:
> 1) improve readability;
> 2) fix violations of MISRA C:2012 Rule 8.3.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

The title would be better as:
x86/nestedhvm: change parameter names of nestedhvm_vcpu_iomap_get() definition

could be done on commit


> ---
>  xen/arch/x86/hvm/nestedhvm.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
> index ec68551127..64d7eec9a1 100644
> --- a/xen/arch/x86/hvm/nestedhvm.c
> +++ b/xen/arch/x86/hvm/nestedhvm.c
> @@ -155,19 +155,19 @@ static int __init cf_check nestedhvm_setup(void)
>  __initcall(nestedhvm_setup);
>  
>  unsigned long *
> -nestedhvm_vcpu_iomap_get(bool_t port_80, bool_t port_ed)
> +nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed)
>  {
>      int i;
>  
>      if (!hvm_port80_allowed)
> -        port_80 = 1;
> +        ioport_80 = 1;
>  
> -    if (port_80 == 0) {
> -        if (port_ed == 0)
> +    if (ioport_80 == 0) {
> +        if (ioport_ed == 0)
>              return hvm_io_bitmap;
>          i = 0;
>      } else {
> -        if (port_ed == 0)
> +        if (ioport_ed == 0)
>              i = 1;
>          else
>              i = 2;
> -- 
> 2.34.1
>
Jan Beulich July 4, 2023, 1:53 p.m. UTC | #2
On 29.06.2023 21:25, Stefano Stabellini wrote:
> On Thu, 29 Jun 2023, Federico Serafini wrote:
>> Change parameter names of nestedhvm_vcpu_iomap_get() definition to
>> those used in the function declaration in order to:
>> 1) improve readability;

I see this was committed already, so ftaod no request to revert or what
not, but I disagree with this: Longer names are generally hampering
readability. What would have helped readability is if coding style was
fixed at least for all the line which were touched anyway.

Jan

>> 2) fix violations of MISRA C:2012 Rule 8.3.
>>
>> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> The title would be better as:
> x86/nestedhvm: change parameter names of nestedhvm_vcpu_iomap_get() definition
> 
> could be done on commit
> 
> 
>> ---
>>  xen/arch/x86/hvm/nestedhvm.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
>> index ec68551127..64d7eec9a1 100644
>> --- a/xen/arch/x86/hvm/nestedhvm.c
>> +++ b/xen/arch/x86/hvm/nestedhvm.c
>> @@ -155,19 +155,19 @@ static int __init cf_check nestedhvm_setup(void)
>>  __initcall(nestedhvm_setup);
>>  
>>  unsigned long *
>> -nestedhvm_vcpu_iomap_get(bool_t port_80, bool_t port_ed)
>> +nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed)
>>  {
>>      int i;
>>  
>>      if (!hvm_port80_allowed)
>> -        port_80 = 1;
>> +        ioport_80 = 1;
>>  
>> -    if (port_80 == 0) {
>> -        if (port_ed == 0)
>> +    if (ioport_80 == 0) {
>> +        if (ioport_ed == 0)
>>              return hvm_io_bitmap;
>>          i = 0;
>>      } else {
>> -        if (port_ed == 0)
>> +        if (ioport_ed == 0)
>>              i = 1;
>>          else
>>              i = 2;
>> -- 
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index ec68551127..64d7eec9a1 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -155,19 +155,19 @@  static int __init cf_check nestedhvm_setup(void)
 __initcall(nestedhvm_setup);
 
 unsigned long *
-nestedhvm_vcpu_iomap_get(bool_t port_80, bool_t port_ed)
+nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed)
 {
     int i;
 
     if (!hvm_port80_allowed)
-        port_80 = 1;
+        ioport_80 = 1;
 
-    if (port_80 == 0) {
-        if (port_ed == 0)
+    if (ioport_80 == 0) {
+        if (ioport_ed == 0)
             return hvm_io_bitmap;
         i = 0;
     } else {
-        if (port_ed == 0)
+        if (ioport_ed == 0)
             i = 1;
         else
             i = 2;