[PATCH] xen/arm: gic: Fix MISRA C 2012 Rule 20.7 violation

Xenia Ragiadakou posted 1 patch 1 year, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20220810101539.1909143-1-burzalodowa@gmail.com
Test gitlab-ci passed
xen/arch/arm/include/asm/gic.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] xen/arm: gic: Fix MISRA C 2012 Rule 20.7 violation
Posted by Xenia Ragiadakou 1 year, 8 months ago
In GIC_PRI_TO_GUEST(), add parentheses around the macro parameter 'pri' to
prevent against unintended expansions and realign comment.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/arch/arm/include/asm/gic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index b3c6c67933..3692fae393 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -152,8 +152,8 @@
 #define GIC_PRI_IPI_ALL    ((GIC_PRI_IPI << 24) | (GIC_PRI_IPI << 16) |\
                             (GIC_PRI_IPI << 8) | GIC_PRI_IPI)
 
-#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR only support
-                                            5 bits for guest irq priority */
+#define GIC_PRI_TO_GUEST(pri) ((pri) >> 3) /* GICH_LR and GICH_VMCR only support
+                                              5 bits for guest irq priority */
 
 #define GICH_LR_PENDING         1
 #define GICH_LR_ACTIVE          2
-- 
2.34.1
Re: [PATCH] xen/arm: gic: Fix MISRA C 2012 Rule 20.7 violation
Posted by Stefano Stabellini 1 year, 8 months ago
On Wed, 10 Aug 2022, Xenia Ragiadakou wrote:
> In GIC_PRI_TO_GUEST(), add parentheses around the macro parameter 'pri' to
> prevent against unintended expansions and realign comment.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

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


> ---
>  xen/arch/arm/include/asm/gic.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
> index b3c6c67933..3692fae393 100644
> --- a/xen/arch/arm/include/asm/gic.h
> +++ b/xen/arch/arm/include/asm/gic.h
> @@ -152,8 +152,8 @@
>  #define GIC_PRI_IPI_ALL    ((GIC_PRI_IPI << 24) | (GIC_PRI_IPI << 16) |\
>                              (GIC_PRI_IPI << 8) | GIC_PRI_IPI)
>  
> -#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR only support
> -                                            5 bits for guest irq priority */
> +#define GIC_PRI_TO_GUEST(pri) ((pri) >> 3) /* GICH_LR and GICH_VMCR only support
> +                                              5 bits for guest irq priority */
>  
>  #define GICH_LR_PENDING         1
>  #define GICH_LR_ACTIVE          2
> -- 
> 2.34.1
>
Re: [PATCH] xen/arm: gic: Fix MISRA C 2012 Rule 20.7 violation
Posted by Julien Grall 1 year, 8 months ago
Hi Xenia,

Thank for your effort to make Xen MISRA compliant. Personally, I find 
quite difficult to follow what's going on with dozen of single patches.

It is also makes more difficult for a committer to apply them. For 
instance, tools like 'b4' can easily apply a series. So there are less 
effort required.

So would you be able to try to batch your patches in larger series 
(maybe 10-20 patches)?

Cheers,

On 10/08/2022 11:15, Xenia Ragiadakou wrote:
> In GIC_PRI_TO_GUEST(), add parentheses around the macro parameter 'pri' to
> prevent against unintended expansions and realign comment.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
> ---
>   xen/arch/arm/include/asm/gic.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
> index b3c6c67933..3692fae393 100644
> --- a/xen/arch/arm/include/asm/gic.h
> +++ b/xen/arch/arm/include/asm/gic.h
> @@ -152,8 +152,8 @@
>   #define GIC_PRI_IPI_ALL    ((GIC_PRI_IPI << 24) | (GIC_PRI_IPI << 16) |\
>                               (GIC_PRI_IPI << 8) | GIC_PRI_IPI)
>   
> -#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR only support
> -                                            5 bits for guest irq priority */
> +#define GIC_PRI_TO_GUEST(pri) ((pri) >> 3) /* GICH_LR and GICH_VMCR only support
> +                                              5 bits for guest irq priority */
>   
>   #define GICH_LR_PENDING         1
>   #define GICH_LR_ACTIVE          2

-- 
Julien Grall
Re: [PATCH] xen/arm: gic: Fix MISRA C 2012 Rule 20.7 violation
Posted by Xenia Ragiadakou 1 year, 8 months ago
Hi Julien,

On 8/10/22 13:24, Julien Grall wrote:
> Hi Xenia,
> 
> Thank for your effort to make Xen MISRA compliant. Personally, I find 
> quite difficult to follow what's going on with dozen of single patches.
> 
> It is also makes more difficult for a committer to apply them. For 
> instance, tools like 'b4' can easily apply a series. So there are less 
> effort required.

I understand.

> 
> So would you be able to try to batch your patches in larger series 
> (maybe 10-20 patches)?

Ok. I will group them together and send a patch biweekly.

> 
> Cheers,
> 
> On 10/08/2022 11:15, Xenia Ragiadakou wrote:
>> In GIC_PRI_TO_GUEST(), add parentheses around the macro parameter 
>> 'pri' to
>> prevent against unintended expansions and realign comment.
>>
>> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
>> ---
>>   xen/arch/arm/include/asm/gic.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/include/asm/gic.h 
>> b/xen/arch/arm/include/asm/gic.h
>> index b3c6c67933..3692fae393 100644
>> --- a/xen/arch/arm/include/asm/gic.h
>> +++ b/xen/arch/arm/include/asm/gic.h
>> @@ -152,8 +152,8 @@
>>   #define GIC_PRI_IPI_ALL    ((GIC_PRI_IPI << 24) | (GIC_PRI_IPI << 
>> 16) |\
>>                               (GIC_PRI_IPI << 8) | GIC_PRI_IPI)
>> -#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR 
>> only support
>> -                                            5 bits for guest irq 
>> priority */
>> +#define GIC_PRI_TO_GUEST(pri) ((pri) >> 3) /* GICH_LR and GICH_VMCR 
>> only support
>> +                                              5 bits for guest irq 
>> priority */
>>   #define GICH_LR_PENDING         1
>>   #define GICH_LR_ACTIVE          2
> 

-- 
Xenia