Code formatting clean up
Subsystems (4)
cover Code formatting clean up
Introduce small code formatting cleaning up in the staging AD drivers
Vladimir Petrigo (3):
staging: iio: ad7192: Fix style issue
staging: iio: ad7280a: Add parentheses to macros
staging: iio: ad7780: Add parentheses to macros
drivers/staging/iio/adc/ad7192.c | 2 +- drivers/staging/iio/adc/ad7280a.c | 6 +++--- drivers/staging/iio/adc/ad7780.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 staging: iio: ad7192: Fix style issue
--- drivers/staging/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -355,7 +355,7 @@ ad7192_show_scale_available(struct device *dev, } static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available, - in_voltage-voltage_scale_available, + in_voltage - voltage_scale_available, 0444, ad7192_show_scale_available, NULL, 0); static IIO_DEVICE_ATTR(in_voltage_scale_available, 0444,
Signature · 1 line
2.7.4
Re: [PATCH 1/3] staging: iio: ad7192: Fix style issue
Quoted 11 lines · Vladimir Petrigo
Signed-off-by Vladimir Petrigo <[email protected]>--- drivers/staging/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/adc/ad7192.c +0
-0
drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 361
Quoted 8 lines
drivers/staging/iio/adc/ad7192.c +1
-1@@ -355,7 +355,7 @@ ad7192_show_scale_available(struct device *dev, } static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available, - in_voltage-voltage_scale_available, + in_voltage - voltage_scale_available, 0444, ad7192_show_scale_available, NULL, 0); static IIO_DEVICE_ATTR(in_voltage_scale_available, 0444,
G'day Vladimir ,
This is not a mathematical op.
It gets passed to __ATTR() macro and converted to a string.
Signature · 2 lines
Regards Phil
Re: [PATCH 1/3] staging: iio: ad7192: Fix style issue
Quoted 20 lines · Phil Reid
Quoted 10 lines · Vladimir Petrigo
Signed-off-by Vladimir Petrigo <[email protected]>--- drivers/staging/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/adc/ad7192.c +0
-0drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 360
Quoted 7 lines
drivers/staging/iio/adc/ad7192.c +1
-1@@ -355,7 +355,7 @@ ad7192_show_scale_available(struct device *dev, } static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available, - in_voltage-voltage_scale_available, + in_voltage - voltage_scale_available, 0444, ad7192_show_scale_available, NULL, 0); static IIO_DEVICE_ATTR(in_voltage_scale_available, 0444,G'day Vladimir ,
Quoted 7 lines
This is not a mathematical op.
It gets passed to__ATTR()macro and converted to a string.Signature · 2 lines
Regards Phil
Hello Phil,
Thank you for the prompt reply.
Should I remove that changes from the patchset v2 then?
--
Best regards,
Vladimir
PATCH 2/3 staging: iio: ad7280a: Add parentheses to macros
In reply to Vladimir PetrigoFix CHECK Macro argument 'c' may be better as '(c)' to avoid precedence issues
(quoted diff) +0 -0
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(-)
drivers/staging/iio/adc/ad7280a.c +3 -3
@@ -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
Signature · 1 line
2.7.4
Re: [PATCH 2/3] staging: iio: ad7280a: Add parentheses to macros
Quoted 22 lines · Vladimir Petrigo
Fix CHECK Macro argument 'c' may be better as '(c)' to avoid precedence issues
Signed-off-by Vladimir Petrigo <[email protected]>(quoted diff) +0
-0
b/drivers/staging/iio/adc/ad7280a.cindex d9df126..98cf876 100644 ---a/drivers/staging/iio/adc/ad7280a.c+++b/drivers/staging/iio/adc/ad7280a.c@@ -97,9 +97,9 @@
#defineAD7280A_NUM_CH(AD7280A_AUX_ADC_6- \(quoted diff) +1
-1AD7280A_CELL_VOLTAGE_1 + 1) -#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d *
AD7280A_CELLS_PER_DEV) + c) -#defineAD7280A_CALC_TEMP_CHAN_NUM(d, c)((d *AD7280A_CELLS_PER_DEV) + \ - c -AD7280A_CELLS_PER_DEV) +#defineAD7280A_CALC_VOLTAGE_CHAN_NUM(d, c)(((d) *AD7280A_CELLS_PER_DEV) + (c)) +#defineAD7280A_CALC_TEMP_CHAN_NUM(d, c)(((d) *AD7280A_CELLS_PER_DEV) + \ + (c) -AD7280A_CELLS_PER_DEV)
Quoted 2 lines
#define
AD7280A_DEVADDR_MASTER0 define #AD7280A_DEVADDR_ALL0x1F
I don't know how this diff got added to the commit message, but obviously we don't want that.
regards,
dan carpenter
Quoted 28 lines
--- drivers/staging/iio/adc/ad7280a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/iio/adc/ad7280a.c +3
-3@@ -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 0x1FSignature · 6 lines
2.7.4 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] staging: iio: ad7280a: Add parentheses to macros
Quoted 56 lines · Dan Carpenter
Quoted 22 lines · Vladimir Petrigo
Fix CHECK Macro argument 'c' may be better as '(c)' to avoid precedence issues
Signed-off-by Vladimir Petrigo <[email protected]>(quoted diff) +0
-0
b/drivers/staging/iio/adc/ad7280a.cindex d9df126..98cf876 100644 ---a/drivers/staging/iio/adc/ad7280a.c+++b/drivers/staging/iio/adc/ad7280a.c@@ -97,9 +97,9 @@
#defineAD7280A_NUM_CH(AD7280A_AUX_ADC_6- \(quoted diff) +1
-1AD7280A_CELL_VOLTAGE_1 + 1) -#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d *
AD7280A_CELLS_PER_DEV) + c) -#defineAD7280A_CALC_TEMP_CHAN_NUM(d, c)((d *AD7280A_CELLS_PER_DEV) + \ - c -AD7280A_CELLS_PER_DEV) +#defineAD7280A_CALC_VOLTAGE_CHAN_NUM(d, c)(((d) *AD7280A_CELLS_PER_DEV) + (c)) +#defineAD7280A_CALC_TEMP_CHAN_NUM(d, c)(((d) *AD7280A_CELLS_PER_DEV) + \ + (c) -AD7280A_CELLS_PER_DEV)Quoted 2 lines
#define
AD7280A_DEVADDR_MASTER0 define #AD7280A_DEVADDR_ALL0x1FI don't know how this diff got added to the commit message, but obviously we don't want that.
regards,
dan carpenterQuoted 24 lines
--- drivers/staging/iio/adc/ad7280a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/iio/adc/ad7280a.c +3
-3@@ -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 0x1FSignature · 1 line
2.7.4
Quoted 4 lines
Quoted 4 lines
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Yes, something went wrong, will fix that in the v2.
Best regards,
Vladimir Petrigo
PATCH 3/3 staging: iio: ad7780: Add parentheses to macros
In reply to Vladimir Petrigo- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues
- Fix CHECK Macro argument reuse 'bits' - possible side-effects?
--- drivers/staging/iio/adc/ad7780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/ad7780.c +1 -1
@@ -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 ] = {
Signature · 1 line
2.7.4
Re: [PATCH 3/3] staging: iio: ad7780: Add parentheses to macros
Quoted 13 lines · Vladimir Petrigo
- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues
- Fix CHECK Macro argument reuse 'bits' - possible side-effects?Signed-off-by Vladimir Petrigo <[email protected]>--- drivers/staging/iio/adc/ad7780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/adc/ad7780.c +0
-0
drivers/staging/iio/adc/ad7780.c static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { · line 145
Quoted 5 lines
drivers/staging/iio/adc/ad7780.c +1
-1@@ -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)))
^^^^^^
These parentheses are not required.
This doesn't fix the "argument reuse" issue... It's not a reall issue though, and it isn't like this a core macro so it doesn't really matter too much.
regards,
dan carpenter
Re: [PATCH 3/3] staging: iio: ad7780: Add parentheses to macros
Quoted 20 lines · Dan Carpenter
Quoted 13 lines · Vladimir Petrigo
- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues
- Fix CHECK Macro argument reuse 'bits' - possible side-effects?Signed-off-by Vladimir Petrigo <[email protected]>--- drivers/staging/iio/adc/ad7780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/adc/ad7780.c +0
-0drivers/staging/iio/adc/ad7780.c static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { · line 145
Quoted 5 lines
drivers/staging/iio/adc/ad7780.c +1
-1@@ -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)))^^^^^^
Quoted 9 lines
These parentheses are not required.
This doesn't fix the "argument reuse" issue... It's not a reall issue though, and it isn't like this a core macro so it doesn't really matter too much.
regards,
dan carpenter
Thank you for the reply. I'll get rid of that parentheses in the v2
Best regards,
Vladimir Petrigo