diff mbox series

[XEN,v2,6/7] x86/irq: parenthesize negative constants

Message ID 9b7e9135952e51043427e3233305917126c95659.1709896401.git.nicola.vetrini@bugseng.com (mailing list archive)
State Superseded
Headers show
Series address some violations of MISRA C Rule 20.7 | expand

Commit Message

Nicola Vetrini March 8, 2024, 11:21 a.m. UTC
These constants are parenthesized to avoid them from
possibly influencing the semantics of the constructs where it is used,
especially inside macros invocations.

This also resolves some violations of MISRA C Rule 20.7
("Expressions resulting from the expansion of macro parameters shall
be enclosed in parentheses").

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
Changes in v2:
- dropped the controversial GUARD(1) hunk
---
 xen/arch/x86/include/asm/irq.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Stabellini March 9, 2024, 1:54 a.m. UTC | #1
On Fri, 8 Mar 2024, Nicola Vetrini wrote:
> These constants are parenthesized to avoid them from
> possibly influencing the semantics of the constructs where it is used,
> especially inside macros invocations.
> 
> This also resolves some violations of MISRA C Rule 20.7
> ("Expressions resulting from the expansion of macro parameters shall
> be enclosed in parentheses").
> 
> No functional change.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Jan Beulich March 11, 2024, 7:50 a.m. UTC | #2
On 09.03.2024 02:54, Stefano Stabellini wrote:
> On Fri, 8 Mar 2024, Nicola Vetrini wrote:
>> These constants are parenthesized to avoid them from
>> possibly influencing the semantics of the constructs where it is used,
>> especially inside macros invocations.
>>
>> This also resolves some violations of MISRA C Rule 20.7
>> ("Expressions resulting from the expansion of macro parameters shall
>> be enclosed in parentheses").
>>
>> No functional change.
>>
>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 082a3d6bbc6a..7d49f3c1904a 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -172,16 +172,16 @@  void cleanup_domain_irq_mapping(struct domain *d);
     void *__ret = radix_tree_lookup(&(d)->arch.irq_pirq, irq);  \
     __ret ? radix_tree_ptr_to_int(__ret) : 0;                   \
 })
-#define PIRQ_ALLOCATED -1
+#define PIRQ_ALLOCATED (-1)
 #define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq,              \
     arch.hvm.emuirq, IRQ_UNBOUND)
 #define domain_emuirq_to_pirq(d, emuirq) ({                             \
     void *__ret = radix_tree_lookup(&(d)->arch.hvm.emuirq_pirq, emuirq);\
     __ret ? radix_tree_ptr_to_int(__ret) : IRQ_UNBOUND;                 \
 })
-#define IRQ_UNBOUND -1
-#define IRQ_PT -2
-#define IRQ_MSI_EMU -3
+#define IRQ_UNBOUND (-1)
+#define IRQ_PT      (-2)
+#define IRQ_MSI_EMU (-3)
 
 bool cpu_has_pending_apic_eoi(void);