summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2021-06-03 17:49:56 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-04 15:10:02 +0200
commit525dd8a36c3323ebfca54ccbf3aa79f19901f554 (patch)
treec2a427fce40894753e375af75effb8bd45690397
parent9d5f721f8c60bc07acfbad7821cf54db56c362e1 (diff)
staging: vchiq_core: avoid precedence issues
Add () around macro argument to avoid precedence issues Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-8-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 3570132bd3c5..0afac4696185 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -35,14 +35,14 @@
#define VCHIQ_PORT_MAX (VCHIQ_MAX_SERVICES - 1)
#define VCHIQ_PORT_FREE 0x1000
-#define VCHIQ_PORT_IS_VALID(port) (port < VCHIQ_PORT_FREE)
+#define VCHIQ_PORT_IS_VALID(port) ((port) < VCHIQ_PORT_FREE)
#define VCHIQ_MAKE_MSG(type, srcport, dstport) \
- ((type << 24) | (srcport << 12) | (dstport << 0))
-#define VCHIQ_MSG_TYPE(msgid) ((unsigned int)msgid >> 24)
+ (((type) << 24) | ((srcport) << 12) | ((dstport) << 0))
+#define VCHIQ_MSG_TYPE(msgid) ((unsigned int)(msgid) >> 24)
#define VCHIQ_MSG_SRCPORT(msgid) \
- (unsigned short)(((unsigned int)msgid >> 12) & 0xfff)
+ (unsigned short)(((unsigned int)(msgid) >> 12) & 0xfff)
#define VCHIQ_MSG_DSTPORT(msgid) \
- ((unsigned short)msgid & 0xfff)
+ ((unsigned short)(msgid) & 0xfff)
/* Ensure the fields are wide enough */
static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX))
@@ -55,7 +55,7 @@ static_assert((unsigned int)VCHIQ_PORT_MAX <
#define VCHIQ_MSGID_CLAIMED 0x40000000
#define VCHIQ_FOURCC_INVALID 0x00000000
-#define VCHIQ_FOURCC_IS_LEGAL(fourcc) (fourcc != VCHIQ_FOURCC_INVALID)
+#define VCHIQ_FOURCC_IS_LEGAL(fourcc) ((fourcc) != VCHIQ_FOURCC_INVALID)
#define VCHIQ_BULK_ACTUAL_ABORTED -1
@@ -84,7 +84,7 @@ static_assert((unsigned int)VCHIQ_PORT_MAX <
#define SLOT_QUEUE_INDEX_FROM_POS_MASKED(pos) \
(SLOT_QUEUE_INDEX_FROM_POS(pos) & VCHIQ_SLOT_QUEUE_MASK)
-#define BULK_INDEX(x) (x & (VCHIQ_NUM_SERVICE_BULKS - 1))
+#define BULK_INDEX(x) ((x) & (VCHIQ_NUM_SERVICE_BULKS - 1))
#define SRVTRACE_LEVEL(srv) \
(((srv) && (srv)->trace) ? VCHIQ_LOG_TRACE : vchiq_core_msg_log_level)