public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Harjani Ritesh <riteshh@codeaurora.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Bough Chen <haibo.chen@nxp.com>
Subject: [PATCH] mmc: cqhci: Ensure macro parameters are wrapped in parentheses
Date: Fri,  8 Dec 2017 09:31:06 +0200	[thread overview]
Message-ID: <1512718266-31261-1-git-send-email-adrian.hunter@intel.com> (raw)

Absence of parentheses is not affecting current code, but ensure macro
parameters are wrapped in parentheses.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: adcb39141800 ("mmc: cqhci: support for command queue enabled host")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/cqhci.h | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h
index 2d39d361b322..9e68286a07b4 100644
--- a/drivers/mmc/host/cqhci.h
+++ b/drivers/mmc/host/cqhci.h
@@ -61,9 +61,9 @@
 #define CQHCI_IC_ENABLE			BIT(31)
 #define CQHCI_IC_RESET			BIT(16)
 #define CQHCI_IC_ICCTHWEN		BIT(15)
-#define CQHCI_IC_ICCTH(x)		((x & 0x1F) << 8)
+#define CQHCI_IC_ICCTH(x)		(((x) & 0x1F) << 8)
 #define CQHCI_IC_ICTOVALWEN		BIT(7)
-#define CQHCI_IC_ICTOVAL(x)		(x & 0x7F)
+#define CQHCI_IC_ICTOVAL(x)		((x) & 0x7F)
 
 /* task list base address */
 #define CQHCI_TDLBA			0x20
@@ -119,31 +119,31 @@
 #define CQHCI_IC_DEFAULT_ICTOVAL	1
 
 /* attribute fields */
-#define CQHCI_VALID(x)			((x & 1) << 0)
-#define CQHCI_END(x)			((x & 1) << 1)
-#define CQHCI_INT(x)			((x & 1) << 2)
-#define CQHCI_ACT(x)			((x & 0x7) << 3)
+#define CQHCI_VALID(x)			(((x) & 1) << 0)
+#define CQHCI_END(x)			(((x) & 1) << 1)
+#define CQHCI_INT(x)			(((x) & 1) << 2)
+#define CQHCI_ACT(x)			(((x) & 0x7) << 3)
 
 /* data command task descriptor fields */
-#define CQHCI_FORCED_PROG(x)		((x & 1) << 6)
-#define CQHCI_CONTEXT(x)		((x & 0xF) << 7)
-#define CQHCI_DATA_TAG(x)		((x & 1) << 11)
-#define CQHCI_DATA_DIR(x)		((x & 1) << 12)
-#define CQHCI_PRIORITY(x)		((x & 1) << 13)
-#define CQHCI_QBAR(x)			((x & 1) << 14)
-#define CQHCI_REL_WRITE(x)		((x & 1) << 15)
-#define CQHCI_BLK_COUNT(x)		((x & 0xFFFF) << 16)
-#define CQHCI_BLK_ADDR(x)		((x & 0xFFFFFFFF) << 32)
+#define CQHCI_FORCED_PROG(x)		(((x) & 1) << 6)
+#define CQHCI_CONTEXT(x)		(((x) & 0xF) << 7)
+#define CQHCI_DATA_TAG(x)		(((x) & 1) << 11)
+#define CQHCI_DATA_DIR(x)		(((x) & 1) << 12)
+#define CQHCI_PRIORITY(x)		(((x) & 1) << 13)
+#define CQHCI_QBAR(x)			(((x) & 1) << 14)
+#define CQHCI_REL_WRITE(x)		(((x) & 1) << 15)
+#define CQHCI_BLK_COUNT(x)		(((x) & 0xFFFF) << 16)
+#define CQHCI_BLK_ADDR(x)		(((x) & 0xFFFFFFFF) << 32)
 
 /* direct command task descriptor fields */
-#define CQHCI_CMD_INDEX(x)		((x & 0x3F) << 16)
-#define CQHCI_CMD_TIMING(x)		((x & 1) << 22)
-#define CQHCI_RESP_TYPE(x)		((x & 0x3) << 23)
+#define CQHCI_CMD_INDEX(x)		(((x) & 0x3F) << 16)
+#define CQHCI_CMD_TIMING(x)		(((x) & 1) << 22)
+#define CQHCI_RESP_TYPE(x)		(((x) & 0x3) << 23)
 
 /* transfer descriptor fields */
-#define CQHCI_DAT_LENGTH(x)		((x & 0xFFFF) << 16)
-#define CQHCI_DAT_ADDR_LO(x)		((x & 0xFFFFFFFF) << 32)
-#define CQHCI_DAT_ADDR_HI(x)		((x & 0xFFFFFFFF) << 0)
+#define CQHCI_DAT_LENGTH(x)		(((x) & 0xFFFF) << 16)
+#define CQHCI_DAT_ADDR_LO(x)		(((x) & 0xFFFFFFFF) << 32)
+#define CQHCI_DAT_ADDR_HI(x)		(((x) & 0xFFFFFFFF) << 0)
 
 struct cqhci_host_ops;
 struct mmc_host;
-- 
1.9.1


             reply	other threads:[~2017-12-08  7:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  7:31 Adrian Hunter [this message]
2017-12-11 12:29 ` [PATCH] mmc: cqhci: Ensure macro parameters are wrapped in parentheses Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512718266-31261-1-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=haibo.chen@nxp.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=riteshh@codeaurora.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox