summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhanghongtao <zhanghongtao22@huawei.com>2022-08-01 15:28:14 +0800
committerzhanghongtao <zhanghongtao22@huawei.com>2022-08-01 15:28:14 +0800
commitf93c0dae5a837404a48ea7f3609c6c5c30691a7b (patch)
treefce4f9eb54600820b00e0b7aad212989eed6af71
parent1fa5d4bdfcc6fea44f9abf353d25f3a5d013f5d7 (diff)
Add parentheses to the macro definition
Signed-off-by: zhanghongtao <zhanghongtao22@huawei.com>
-rw-r--r--src/pci_tools.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pci_tools.h b/src/pci_tools.h
index 3766890..47b121f 100644
--- a/src/pci_tools.h
+++ b/src/pci_tools.h
@@ -165,7 +165,7 @@ typedef struct pcitool_intr_get {
#define PCITOOL_IGET_SIZE(num_devs) \
(sizeof (pcitool_intr_get_t) - \
sizeof (pcitool_intr_dev_t) + \
- (num_devs * sizeof (pcitool_intr_dev_t)))
+ ((num_devs) * sizeof (pcitool_intr_dev_t)))
/*
* Size and endian fields for acc_attr bitmask.
@@ -175,12 +175,12 @@ typedef struct pcitool_intr_get {
#define PCITOOL_ACC_ATTR_SIZE_2 0x1
#define PCITOOL_ACC_ATTR_SIZE_4 0x2
#define PCITOOL_ACC_ATTR_SIZE_8 0x3
-#define PCITOOL_ACC_ATTR_SIZE(x) (1 << (x & PCITOOL_ACC_ATTR_SIZE_MASK))
+#define PCITOOL_ACC_ATTR_SIZE(x) (1 << ((x) & PCITOOL_ACC_ATTR_SIZE_MASK))
#define PCITOOL_ACC_ATTR_ENDN_MASK 0x100
#define PCITOOL_ACC_ATTR_ENDN_LTL 0x0
#define PCITOOL_ACC_ATTR_ENDN_BIG 0x100
-#define PCITOOL_ACC_IS_BIG_ENDIAN(x) (x & PCITOOL_ACC_ATTR_ENDN_BIG)
+#define PCITOOL_ACC_IS_BIG_ENDIAN(x) ((x) & PCITOOL_ACC_ATTR_ENDN_BIG)
/*
* Data structure to read and write to pci device registers.