linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Petrigo <vladimir.petrigo@gmail.com>
To: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Stefan Popa <stefan.popa@analog.com>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	Slawomir Stepien <sst@poczta.fm>,
	Nishad Kamdar <nishadkamdar@gmail.com>,
	Renato Lui Geh <renatogeh@gmail.com>,
	devel@driverdev.osuosl.org,
	Vladimir Petrigo <vladimir.petrigo@gmail.com>
Subject: [PATCH 2/3] staging: iio: ad7280a: Add parentheses to macros
Date: Sun, 17 Mar 2019 23:53:11 +0300	[thread overview]
Message-ID: <1552855992-27653-3-git-send-email-vladimir.petrigo@gmail.com> (raw)
In-Reply-To: <1552855992-27653-1-git-send-email-vladimir.petrigo@gmail.com>

Fix CHECK Macro argument 'c' may be better as '(c)' to
avoid precedence issues

Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>

diff --git a/drivers/staging/iio/adc/ad7280a.c
b/drivers/staging/iio/adc/ad7280a.c index d9df126..98cf876
100644 --- a/drivers/staging/iio/adc/ad7280a.c +++
b/drivers/staging/iio/adc/ad7280a.c @@ -97,9 +97,9 @@
 #define AD7280A_NUM_CH (AD7280A_AUX_ADC_6 - \
 					AD7280A_CELL_VOLTAGE_1
+ 1)

-#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d *
AD7280A_CELLS_PER_DEV) + c) -#define
AD7280A_CALC_TEMP_CHAN_NUM(d, c) ((d *
AD7280A_CELLS_PER_DEV) + \ - c - AD7280A_CELLS_PER_DEV)
+#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) (((d) *
AD7280A_CELLS_PER_DEV) + (c)) +#define
AD7280A_CALC_TEMP_CHAN_NUM(d, c) (((d) *
AD7280A_CELLS_PER_DEV) + \ + (c) - AD7280A_CELLS_PER_DEV)

 #define AD7280A_DEVADDR_MASTER 0 define
 #AD7280A_DEVADDR_ALL 0x1F
---
 drivers/staging/iio/adc/ad7280a.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index d9df126..98cf876 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -97,9 +97,9 @@
 #define AD7280A_NUM_CH			(AD7280A_AUX_ADC_6 - \
 					AD7280A_CELL_VOLTAGE_1 + 1)
 
-#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d * AD7280A_CELLS_PER_DEV) + c)
-#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)    ((d * AD7280A_CELLS_PER_DEV) + \
-					     c - AD7280A_CELLS_PER_DEV)
+#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) (((d) * AD7280A_CELLS_PER_DEV) + (c))
+#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)    (((d) * AD7280A_CELLS_PER_DEV) + \
+					     (c) - AD7280A_CELLS_PER_DEV)
 
 #define AD7280A_DEVADDR_MASTER		0
 #define AD7280A_DEVADDR_ALL		0x1F
-- 
2.7.4


  parent reply	other threads:[~2019-03-17 20:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-17 20:53 [PATCH 0/3] Code formatting clean up Vladimir Petrigo
2019-03-17 20:53 ` [PATCH 1/3] staging: iio: ad7192: Fix style issue Vladimir Petrigo
2019-03-18  2:27   ` Phil Reid
2019-03-19  8:14     ` Vladimir Petrigo
2019-03-17 20:53 ` Vladimir Petrigo [this message]
2019-03-20  7:38   ` [PATCH 2/3] staging: iio: ad7280a: Add parentheses to macros Dan Carpenter
2019-03-21 21:14     ` Vladimir Petrigo
2019-03-17 20:53 ` [PATCH 3/3] staging: iio: ad7780: " Vladimir Petrigo
2019-03-20  7:42   ` Dan Carpenter
2019-03-21 21:12     ` Vladimir Petrigo

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=1552855992-27653-3-git-send-email-vladimir.petrigo@gmail.com \
    --to=vladimir.petrigo@gmail.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=nishadkamdar@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=renatogeh@gmail.com \
    --cc=sst@poczta.fm \
    --cc=stefan.popa@analog.com \
    /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;
as well as URLs for NNTP newsgroup(s).