* [PATCH v2 0/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule violations
@ 2022-07-27 17:18 Xenia Ragiadakou
2022-07-27 17:18 ` [PATCH v2 1/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation Xenia Ragiadakou
0 siblings, 1 reply; 3+ messages in thread
From: Xenia Ragiadakou @ 2022-07-27 17:18 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Volodymyr Babchuk
This patch series fixes violations of rule 20.7 found in
xen/arch/arm/include/asm/atomic.h.
Changes in v2:
- removed redundant parentheses in patch 1/2
- dropped patch 2/2 that removes unused atomic_xchg() because changes Xen's
atomic API, and such a change cannot be justified since compliance to
MISRA C Rule 2.5 is advisory. If at some point it is decided to remove the
relevant macro, this will be done for both arm and x86 with a separate patch.
Xenia Ragiadakou (1):
xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation
xen/arch/arm/include/asm/atomic.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation
2022-07-27 17:18 [PATCH v2 0/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule violations Xenia Ragiadakou
@ 2022-07-27 17:18 ` Xenia Ragiadakou
2022-07-28 1:26 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Xenia Ragiadakou @ 2022-07-27 17:18 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Volodymyr Babchuk
The macro parameter 'p' is used as an expression and needs to be enclosed in
parentheses.
Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
Changes in v2:
- remove parentheses in the cases that p is not used as an expression that is
when it is used as a function argument
xen/arch/arm/include/asm/atomic.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/include/asm/atomic.h b/xen/arch/arm/include/asm/atomic.h
index ac2798d095..1f60c28b1b 100644
--- a/xen/arch/arm/include/asm/atomic.h
+++ b/xen/arch/arm/include/asm/atomic.h
@@ -123,15 +123,15 @@ static always_inline void write_atomic_size(volatile void *p,
}
#define read_atomic(p) ({ \
- union { typeof(*p) val; char c[0]; } x_; \
- read_atomic_size(p, x_.c, sizeof(*p)); \
+ union { typeof(*(p)) val; char c[0]; } x_; \
+ read_atomic_size(p, x_.c, sizeof(*(p))); \
x_.val; \
})
#define write_atomic(p, x) \
do { \
- typeof(*p) x_ = (x); \
- write_atomic_size(p, &x_, sizeof(*p)); \
+ typeof(*(p)) x_ = (x); \
+ write_atomic_size(p, &x_, sizeof(*(p))); \
} while ( false )
#define add_sized(p, x) ({ \
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation
2022-07-27 17:18 ` [PATCH v2 1/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation Xenia Ragiadakou
@ 2022-07-28 1:26 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2022-07-28 1:26 UTC (permalink / raw)
To: Xenia Ragiadakou
Cc: xen-devel, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk
On Wed, 27 Jul 2022, Xenia Ragiadakou wrote:
> The macro parameter 'p' is used as an expression and needs to be enclosed in
> parentheses.
>
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
>
> Changes in v2:
> - remove parentheses in the cases that p is not used as an expression that is
> when it is used as a function argument
>
> xen/arch/arm/include/asm/atomic.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/arm/include/asm/atomic.h b/xen/arch/arm/include/asm/atomic.h
> index ac2798d095..1f60c28b1b 100644
> --- a/xen/arch/arm/include/asm/atomic.h
> +++ b/xen/arch/arm/include/asm/atomic.h
> @@ -123,15 +123,15 @@ static always_inline void write_atomic_size(volatile void *p,
> }
>
> #define read_atomic(p) ({ \
> - union { typeof(*p) val; char c[0]; } x_; \
> - read_atomic_size(p, x_.c, sizeof(*p)); \
> + union { typeof(*(p)) val; char c[0]; } x_; \
> + read_atomic_size(p, x_.c, sizeof(*(p))); \
> x_.val; \
> })
>
> #define write_atomic(p, x) \
> do { \
> - typeof(*p) x_ = (x); \
> - write_atomic_size(p, &x_, sizeof(*p)); \
> + typeof(*(p)) x_ = (x); \
> + write_atomic_size(p, &x_, sizeof(*(p))); \
> } while ( false )
>
> #define add_sized(p, x) ({ \
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-28 1:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 17:18 [PATCH v2 0/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule violations Xenia Ragiadakou
2022-07-27 17:18 ` [PATCH v2 1/1] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation Xenia Ragiadakou
2022-07-28 1:26 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.