linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: iio: adc: Fix code formatting issues
@ 2019-03-21 21:15 Vladimir Petrigo
  2019-03-21 21:15 ` [PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros Vladimir Petrigo
  2019-03-21 21:15 ` [PATCH v2 2/2] staging: iio: ad7780: " Vladimir Petrigo
  0 siblings, 2 replies; 5+ messages in thread
From: Vladimir Petrigo @ 2019-03-21 21:15 UTC (permalink / raw)
  To: linux-iio
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	devel, Vladimir Petrigo

v1 -> v2
 - remove redundant patch for the ad7192.c
 - fix the issue with diff for the ad7280a.c
 - fix the redundant parentheses in the patch for ad7780.c

Vladimir Petrigo (2):
  staging: iio: ad7280a: Add parentheses to macros
  staging: iio: ad7780: Add parentheses to macros

 drivers/staging/iio/adc/ad7280a.c | 6 +++---
 drivers/staging/iio/adc/ad7780.c  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros
  2019-03-21 21:15 [PATCH v2 0/2] staging: iio: adc: Fix code formatting issues Vladimir Petrigo
@ 2019-03-21 21:15 ` Vladimir Petrigo
  2019-03-24 16:04   ` Jonathan Cameron
  2019-03-21 21:15 ` [PATCH v2 2/2] staging: iio: ad7780: " Vladimir Petrigo
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Petrigo @ 2019-03-21 21:15 UTC (permalink / raw)
  To: linux-iio
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	devel, Vladimir Petrigo

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

Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] staging: iio: ad7780: Add parentheses to macros
  2019-03-21 21:15 [PATCH v2 0/2] staging: iio: adc: Fix code formatting issues Vladimir Petrigo
  2019-03-21 21:15 ` [PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros Vladimir Petrigo
@ 2019-03-21 21:15 ` Vladimir Petrigo
  2019-03-24 16:11   ` Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Petrigo @ 2019-03-21 21:15 UTC (permalink / raw)
  To: linux-iio
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	devel, Vladimir Petrigo

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

Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>
---
 drivers/staging/iio/adc/ad7780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index c4a8578..010fb47 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -142,7 +142,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
 };
 
 #define AD7780_CHANNEL(bits, wordsize) \
-	AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, wordsize - bits)
+	AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, (wordsize) - (bits))
 
 static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
 	[ID_AD7170] = {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros
  2019-03-21 21:15 ` [PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros Vladimir Petrigo
@ 2019-03-24 16:04   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2019-03-24 16:04 UTC (permalink / raw)
  To: Vladimir Petrigo
  Cc: linux-iio, Lars-Peter Clausen, Michael Hennerich, Hartmut Knaack,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, devel

On Fri, 22 Mar 2019 00:15:27 +0300
Vladimir Petrigo <vladimir.petrigo@gmail.com> wrote:

> - Fix CHECK Macro argument 'c' may be better as '(c)' to avoid precedence issues
> - Fix CHECK Macro argument 'd' may be better as '(d)' to avoid precedence issues
> 
> Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>
Sorry, I ended up taking Cristian's patch for the same issue.

No particular reason other than which email I hit first!

Jonathan

> ---
>  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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] staging: iio: ad7780: Add parentheses to macros
  2019-03-21 21:15 ` [PATCH v2 2/2] staging: iio: ad7780: " Vladimir Petrigo
@ 2019-03-24 16:11   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2019-03-24 16:11 UTC (permalink / raw)
  To: Vladimir Petrigo
  Cc: linux-iio, Lars-Peter Clausen, Michael Hennerich, Hartmut Knaack,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, devel

On Fri, 22 Mar 2019 00:15:28 +0300
Vladimir Petrigo <vladimir.petrigo@gmail.com> wrote:

> - Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues
> 
> Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>

Hi Vladimir,

This particular driver has recently moved out of staging and gained support
for some additional parts.  Still the particular issue was there still.

I applied your patch by hand to the moved driver and the additional case
of the same thing that was write next to this.

Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/staging/iio/adc/ad7780.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
> index c4a8578..010fb47 100644
> --- a/drivers/staging/iio/adc/ad7780.c
> +++ b/drivers/staging/iio/adc/ad7780.c
> @@ -142,7 +142,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
>  };
>  
>  #define AD7780_CHANNEL(bits, wordsize) \
> -	AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, wordsize - bits)
> +	AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, (wordsize) - (bits))
>  
>  static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
>  	[ID_AD7170] = {


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-24 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 21:15 [PATCH v2 0/2] staging: iio: adc: Fix code formatting issues Vladimir Petrigo
2019-03-21 21:15 ` [PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros Vladimir Petrigo
2019-03-24 16:04   ` Jonathan Cameron
2019-03-21 21:15 ` [PATCH v2 2/2] staging: iio: ad7780: " Vladimir Petrigo
2019-03-24 16:11   ` Jonathan Cameron

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).