Skip to contentSkip to conversation

staging: iio: adc: General code reformatting / cleanup patchset

PATCH Superseded Deepak R Varma 7 participants 28 messages Mar 18, 2020 – Mar 22, 2020

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover staging: iio: adc: General code reformatting / cleanup patchset

Address code formatting warnings and check messages flagged by checkpatch script. Changes intended to improve readability of code.

Deepak R Varma (2):
staging: iio: adc: ad7192: Reformat lines crossing 80 columns
staging: iio: adc: ad7280a: Add spaces around operators

 drivers/staging/iio/adc/ad7192.c  | 15 ++++++++-------
 drivers/staging/iio/adc/ad7280a.c |  4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 staging: iio: adc: ad7192: Reformat lines crossing 80 columns

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +8 -7
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
 };
 
 struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
 }
 
 static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)
+					     int *freq)
 {
 	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
 	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);
+	fadc = DIV_ROUND_CLOSEST(st->fclk, sync4_filter);
 	freq[0] = DIV_ROUND_CLOSEST(fadc * 240, 1024);
 
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC3_FILTER * AD7192_MODE_RATE(st->mode));
+	sync3_filter = AD7192_SYNC3_FILTER * AD7192_MODE_RATE(st->mode);
+	fadc = DIV_ROUND_CLOSEST(st->fclk, sync3_filter);
 	freq[1] = DIV_ROUND_CLOSEST(fadc * 240, 1024);
 
 	fadc = DIV_ROUND_CLOSEST(st->fclk, AD7192_MODE_RATE(st->mode));
Signature · 1 line
2.17.1
#12 lore raw

PATCH 2/2 staging: iio: adc: ad7280a: Add spaces around operators

In reply to Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +2 -2
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,
 			     0644,
 			     ad7280_read_channel_config,
 			     ad7280_write_channel_config,
 			     AD7280A_CELL_UNDERVOLTAGE);
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
 			     0644,
 			     ad7280_read_channel_config,
 			     ad7280_write_channel_config,
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Deepak R Varma
Quoted 6 lines · Deepak R Varma

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

When you say "also" in a changelog description, that's a huge hint the patch needs to be broken up.

And that is what needs to happen here.

Quoted 11 lines
---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index bf3e2a9cc07f..0265f6607d75 100644

drivers/staging/iio/adc/ad7192.c line 160

Quoted 7 lines
drivers/staging/iio/adc/ad7192.c +2 -2
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,

Because this has nothing to do with the subject, please make it a separate patch.

thanks,

greg k-h

maintainer
#13 lore raw

Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Deepak R Varma
Quoted 19 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,
 			     0644,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 838

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
 			     ad7280_read_channel_config,
 			     ad7280_write_channel_config,
 			     AD7280A_CELL_UNDERVOLTAGE);
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
 			     0644,
 			     ad7280_read_channel_config,
 			     ad7280_write_channel_config,

Did you try building this code?

It catches everyone...

greg k-h

#5 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Deepak R Varma
Quoted 31 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +2 -2
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
 };
 
 struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
 }
 
 static void ad7192_get_available_filter_freq(struct ad7192_state *st,

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 486

Quoted 10 lines
drivers/staging/iio/adc/ad7192.c +3 -3
-						    int *freq)
+					     int *freq)
 {
 	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
 	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Signature · 1 line
Stefano
#14 lore raw

Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Greg KH
Quoted 33 lines · Greg KH
Quoted 19 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,
 			     0644,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 838

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
 			     ad7280_read_channel_config,
 			     ad7280_write_channel_config,
 			     AD7280A_CELL_UNDERVOLTAGE);
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
 			     0644,
 			     ad7280_read_channel_config,
 			     ad7280_write_channel_config,

Did you try building this code?

Quoted 1 line

It catches everyone...

yes sir, I did. See this:

  CC [M]  drivers/staging/fbtft/fbtft.mod.o
  CC [M]  drivers/staging/iio/adc/ad7192.mod.o
  LD [M]  drivers/staging/iio/adc/ad7280a.ko
  LD [M]  drivers/staging/media/ipu3/ipu3-imgu.ko
  LD [M]  drivers/staging/fbtft/fbtft.ko
  LD [M]  drivers/staging/iio/adc/ad7192.ko

Let me know if I missed something.

Thank you,
Deepak.

Quoted 2 lines

greg k-h

#15 lore raw

Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Greg KH
Quoted 33 lines · Greg KH
Quoted 19 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
  }
 
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,
  			     0644,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 838

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
 
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

- Lars

#3 lore raw

Re: [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Greg KH
Quoted 26 lines · Greg KH
Quoted 6 lines · Deepak R Varma

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

When you say "also" in a changelog description, that's a huge hint the patch needs to be broken up.

And that is what needs to happen here.

Quoted 13 lines
---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
Quoted 9 lines

drivers/staging/iio/adc/ad7192.c line 160

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +2 -2
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,

Because this has nothing to do with the subject, please make it a separate patch.

Okay. Got your point. I was thinking since this is a clean up patch I can include both the changes for the same file in a single patch. No problem; I will correct and send in a v2.

Thank you,
Deepak.

Quoted 3 lines

thanks,

greg k-h

maintainer
#4 lore raw

Re: [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

Quoted 37 lines · DEEPAK VARMA
Quoted 26 lines · Greg KH
Quoted 6 lines · Deepak R Varma

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

When you say "also" in a changelog description, that's a huge hint the patch needs to be broken up.

And that is what needs to happen here.

Quoted 13 lines
---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
Quoted 9 lines

drivers/staging/iio/adc/ad7192.c line 160

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +2 -2
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,

Because this has nothing to do with the subject, please make it a separate patch.

Quoted 3 lines

Okay. Got your point. I was thinking since this is a clean up patch I can include both the changes for the same file in a single patch. No problem; I will correct and send in a v2.

From my patch bot which would have normally triggered on this patch had it not been part of the outrechy project:

- Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause.

maintainer
#16 lore raw

Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Lars-Peter Clausen
Quoted 32 lines · Lars-Peter Clausen
Quoted 31 lines · Greg KH
Quoted 17 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 836

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

thanks,

greg k-h

#6 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Stefano Brivio
Quoted 40 lines · Stefano Brivio
Quoted 37 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +4 -3
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
 };
 
 struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
 }
 
 static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)
+					     int *freq)
 {
 	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
Quoted 8 lines

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 486

Quoted 4 lines
drivers/staging/iio/adc/ad7192.c +1 -2
 	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Sorry, I am not sure what you are referring to. Can you please elaborate or point me to where the data sheet is located?

Deepak.

Quoted 3 lines
Signature · 1 line
Stefano
#7 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

Quoted 50 lines · DEEPAK VARMA
Quoted 40 lines · Stefano Brivio
Quoted 37 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +4 -3
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
 };
 
 struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
 }
 
 static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)
+					     int *freq)
 {
 	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
Quoted 8 lines

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 486

Quoted 4 lines
drivers/staging/iio/adc/ad7192.c +1 -2
 	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Quoted 4 lines

Sorry, I am not sure what you are referring to. Can you please elaborate or point me to where the data sheet is located?

Deepak.

Hey Deepak,
You can find the datasheet for ad7192 here https://pdf1.alldatasheet.com/datasheet-pdf/view/988287/AD/AD7192.html

Thanks,
Rohit

#17 lore raw

Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Greg KH
Quoted 33 lines · Greg KH
Quoted 32 lines · Lars-Peter Clausen
Quoted 31 lines · Greg KH
Quoted 17 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 836

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

maintainer
#18 lore raw

Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

Quoted 39 lines · DEEPAK VARMA
Quoted 38 lines · Greg KH
Quoted 36 lines · Lars-Peter Clausen
Quoted 31 lines · Greg KH
Quoted 17 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 836

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Quoted 6 lines
Quoted 3 lines

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

That field is a string, not variables that are being subtracted.

thanks,

greg k-h

#19 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to DEEPAK VARMA
Quoted 39 lines · DEEPAK VARMA
Quoted 38 lines · Greg KH
Quoted 36 lines · Lars-Peter Clausen
Quoted 31 lines · Greg KH
Quoted 17 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 836

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Quoted 6 lines
Quoted 3 lines

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

The code involves a macro, as indicated by the capital letters. You will see the issue when you look at the definition of the macro.

julia

Quoted 12 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu.

#8 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Rohit Sarkar
Quoted 51 lines · Rohit Sarkar
Quoted 50 lines · DEEPAK VARMA
Quoted 48 lines · Stefano Brivio
Quoted 31 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +2 -2
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
 };
 
 struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
 }
 
 static void ad7192_get_available_filter_freq(struct ad7192_state *st,

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 486

Quoted 10 lines
drivers/staging/iio/adc/ad7192.c +3 -3
-						    int *freq)
+					     int *freq)
 {
 	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
 	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Quoted 8 lines
Quoted 4 lines

Sorry, I am not sure what you are referring to. Can you please elaborate or point me to where the data sheet is located?

Deepak.

Hey Deepak,
You can find the datasheet for ad7192 here https://pdf1.alldatasheet.com/datasheet-pdf/view/988287/AD/AD7192.html

Thank you Rohit. I got it. I understand Stefano's comments now. I named the variables with a 'y' to keep it similar to the macro AD7192_SYNCn_FILTER. Let me know if the variable name looks odd and I should rename it to sinc4_filter instead.

Thanks,
Deepak.

Quoted 2 lines

Thanks,
Rohit

#9 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

Quoted 57 lines · DEEPAK VARMA
Quoted 56 lines · Rohit Sarkar
Quoted 54 lines · DEEPAK VARMA
Quoted 40 lines · Stefano Brivio
Quoted 37 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
  drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +4 -3
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
   */
 
  enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
  };
 
  struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
  }
 
  static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)
+					     int *freq)
  {
  	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
Quoted 8 lines

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 486

Quoted 4 lines
drivers/staging/iio/adc/ad7192.c +1 -2
  	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Sorry, I am not sure what you are referring to. Can you please elaborate or point me to where the data sheet is located?

Deepak.

Quoted 8 lines
Quoted 3 lines

Hey Deepak,
You can find the datasheet for ad7192 here https://pdf1.alldatasheet.com/datasheet-pdf/view/988287/AD/AD7192.html

Thank you Rohit. I got it. I understand Stefano's comments now. I named the variables with a 'y' to keep it similar to the macro AD7192_SYNCn_FILTER. Let me know if the variable name looks odd and I should rename it to sinc4_filter instead.

Hi,

Please send a patch to rename the macro to SINC as well. This is a typo in the macro.

Thanks,
- Lars

#20 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Julia Lawall
Quoted 46 lines · Julia Lawall
Quoted 42 lines · DEEPAK VARMA
Quoted 41 lines · Greg KH
Quoted 32 lines · Lars-Peter Clausen
Quoted 31 lines · Greg KH
Quoted 17 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 836

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Quoted 8 lines
Quoted 3 lines

Yes, it did build. I am sorry but I am not following you fully. Can you please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

The code involves a macro, as indicated by the capital letters. You will see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

Deepak.

Quoted 13 lines
Quoted 13 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu.

#10 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Lars-Peter Clausen
Quoted 63 lines · Lars-Peter Clausen
Quoted 53 lines · DEEPAK VARMA
Quoted 52 lines · Rohit Sarkar
Quoted 50 lines · DEEPAK VARMA
Quoted 35 lines · Stefano Brivio
Quoted 32 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
  drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +3 -3
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
   */
  enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
  };
  struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
  }
  static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)
+					     int *freq)
  {
  	unsigned int fadc;
Quoted 9 lines

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 486

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +2 -2
+	unsigned int sync3_filter, sync4_filter;
  	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Sorry, I am not sure what you are referring to. Can you please elaborate or point me to where the data sheet is located?

Deepak.

Quoted 8 lines
Quoted 3 lines

Hey Deepak,
You can find the datasheet for ad7192 here https://pdf1.alldatasheet.com/datasheet-pdf/view/988287/AD/AD7192.html

Thank you Rohit. I got it. I understand Stefano's comments now. I named the variables with a 'y' to keep it similar to the macro AD7192_SYNCn_FILTER. Let me know if the variable name looks odd and I should rename it to sinc4_filter instead.

Quoted 7 lines

Hi,

Please send a patch to rename the macro to SINC as well. This is a typo in the macro.

Thanks,
- Lars

Sure. Will send a separate patch for the macro name correction in the same pathset.

Deepak.

#21 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to DEEPAK VARMA
Quoted 54 lines · DEEPAK VARMA

[External]

Quoted 51 lines · Julia Lawall
Quoted 47 lines · DEEPAK VARMA
Quoted 35 lines · Greg KH
Quoted 34 lines · Lars-Peter Clausen
Quoted 33 lines · Greg KH
Quoted 19 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int
 irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int · line 837

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Quoted 7 lines
Quoted 4 lines

The code involves a macro, as indicated by the capital letters. You will see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

I'll try to make some time to address this somehow, so that checkpatch doesn't bump into this.

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for various Analog drivers].
So, don't feel too bad.

Quoted 17 lines

Deepak.

Quoted 15 lines
Quoted 15 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu
.

#22 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

Quoted 63 lines · Alexandru
Quoted 54 lines · DEEPAK VARMA

[External]

Quoted 51 lines · Julia Lawall
Quoted 47 lines · DEEPAK VARMA
Quoted 35 lines · Greg KH
Quoted 34 lines · Lars-Peter Clausen
Quoted 33 lines · Greg KH
Quoted 19 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +1 -1
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t ad7280_event_handler(int
 irq, void *private)
  }
  static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-			     in_voltage-voltage_thresh_low_value,
+			     in_voltage - voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int · line 837

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,
  			     AD7280A_CELL_UNDERVOLTAGE);
  static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-			     in_voltage-voltage_thresh_high_value,
+			     in_voltage - voltage_thresh_high_value,
  			     0644,
  			     ad7280_read_channel_config,
  			     ad7280_write_channel_config,

Did you try building this code?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Quoted 7 lines
Quoted 4 lines

The code involves a macro, as indicated by the capital letters. You will see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

Quoted 6 lines

I'll try to make some time to address this somehow, so that checkpatch doesn't bump into this.

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for various Analog drivers].
So, don't feel too bad.

Maybe a comment?

julia

Quoted 20 lines
Quoted 19 lines

Deepak.

Quoted 15 lines
Quoted 15 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu
.

#11 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

In reply to Rohit Sarkar
Quoted 54 lines · Rohit Sarkar
Quoted 53 lines · DEEPAK VARMA
Quoted 51 lines · Stefano Brivio
Quoted 34 lines · On Wed, 18 Mar 2020 09:56:59 +0530 Deepak R Varma <[email protected]> wrote:

Macro arguments are computed at the time of macro invocation. This makes the lines cross 80 column width. Add variables to perform the calculations before hand and use these new variable in the macro calls instead.

Also re-indent enum members to address checkpatch warning / check messages.

---
 drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +2 -3
index bf3e2a9cc07f..0265f6607d75 100644
@@ -156,8 +156,8 @@
  */
 
 enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
 };
 
 struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
 }
 
 static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)

drivers/staging/iio/adc/ad7192.c static ssize_t ad7192_set(struct device *dev, · line 487

Quoted 10 lines
drivers/staging/iio/adc/ad7192.c +3 -2
+					     int *freq)
 {
 	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
 
 	/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER *
 AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called sync4_filter, with a 'y'?

Quoted 8 lines
Quoted 4 lines

Sorry, I am not sure what you are referring to. Can you please elaborate or point me to where the data sheet is located?

Deepak.

Hey Deepak,
You can find the datasheet for ad7192 here
https://pdf1.alldatasheet.com/datasheet-pdf/view/988287/AD/AD7192.html

Most Analog datasheets can be found directly on the official website.

https://www.analog.com/media/en/technical-documentation/data-sheets/AD7192.pdf

The simplest way is to open a browser, type: analog.com/<part-name> [in this case analog.com/ad7192], that opens-up the part page, scroll down and there's a link to the datasheet [in this case, the link above].

Particularly for Analog parts, this is a bit simpler than searching on Google. Though Google will find the official datasheets quicker, after you visit the analog.com site a few times.

Quoted 3 lines

Thanks,
Rohit

#23 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to Julia Lawall
Quoted 80 lines · Julia Lawall

[External]

Quoted 74 lines · Alexandru
Quoted 60 lines · DEEPAK VARMA

[External]

Quoted 57 lines · Julia Lawall
Quoted 54 lines · DEEPAK VARMA
Quoted 41 lines · Greg KH
Quoted 40 lines · Lars-Peter Clausen
Quoted 39 lines · Greg KH
Quoted 31 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning
flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +0 -0
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t

ad7280_event_handler(int
irq, void *private)
}
static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -

voltage_thresh_low_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config, AD7280A_CELL_UNDERVOLTAGE);
static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -
Quoted 4 lines

voltage_thresh_high_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config,

Did you try building this code?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you
please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Quoted 8 lines
Quoted 5 lines

The code involves a macro, as indicated by the capital letters. You will
see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

I'll try to make some time to address this somehow, so that checkpatch doesn't
bump into this.

Quoted 5 lines
Quoted 3 lines

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for various Analog drivers].
So, don't feel too bad.

Maybe a comment?

Comment works for now.
Anybody wants to do a patch for that?
If nobody sends a patch for this in 1-2 weeks, I'll send one.

Particularly, this would help with review, since people that are unfamiliar with IIO-specific macros would also find it easier at review.

The good part, is that it's only needed for AD7280A. AD7192 has been re-worked, and is no longer on checkpatch's radar. I'm reworking AD7793 now.

Quoted 22 lines

julia

Quoted 19 lines
Quoted 19 lines

Deepak.

Quoted 17 lines
Quoted 17 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu
.

#24 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

Quoted 91 lines · Alexandru
Quoted 80 lines · Julia Lawall

[External]

Quoted 74 lines · Alexandru
Quoted 60 lines · DEEPAK VARMA

[External]

Quoted 57 lines · Julia Lawall
Quoted 54 lines · DEEPAK VARMA
Quoted 41 lines · Greg KH
Quoted 40 lines · Lars-Peter Clausen
Quoted 39 lines · Greg KH
Quoted 31 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning
flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +0 -0
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t

ad7280_event_handler(int
irq, void *private)
}
static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -

voltage_thresh_low_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config, AD7280A_CELL_UNDERVOLTAGE);
static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -
Quoted 4 lines

voltage_thresh_high_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config,

Did you try building this code?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you
please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Quoted 8 lines
Quoted 5 lines

The code involves a macro, as indicated by the capital letters. You will
see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

I'll try to make some time to address this somehow, so that checkpatch doesn't
bump into this.

Quoted 5 lines
Quoted 3 lines

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for various Analog drivers].
So, don't feel too bad.

Maybe a comment?

Comment works for now.
Anybody wants to do a patch for that?
If nobody sends a patch for this in 1-2 weeks, I'll send one.

Quoted 7 lines

Particularly, this would help with review, since people that are unfamiliar with IIO-specific macros would also find it easier at review.

The good part, is that it's only needed for AD7280A. AD7192 has been re-worked, and is no longer on checkpatch's radar. I'm reworking AD7793 now.

I will be happy to add a comment around the code area to indicate ignore checkpatch warning for the mentioned argument. Please confirm if that is what you are expecting to be done.

Thanks,
Deepak.

Quoted 23 lines
Quoted 23 lines

julia

Quoted 19 lines
Quoted 19 lines

Deepak.

Quoted 17 lines
Quoted 17 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu
.

#25 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

Quoted 106 lines · DEEPAK VARMA

[External]

Quoted 103 lines · Alexandru
Quoted 87 lines · Julia Lawall

[External]

Quoted 81 lines · Alexandru
Quoted 67 lines · DEEPAK VARMA

[External]

Quoted 64 lines · Julia Lawall
Quoted 61 lines · DEEPAK VARMA
Quoted 47 lines · Greg KH
Quoted 45 lines · Lars-Peter Clausen
Quoted 43 lines · Greg KH
Quoted 32 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning
flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +0 -0
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t

ad7280_event_handler(int
irq, void *private)
}
static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -

voltage_thresh_low_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config
,
AD7280A_CELL_UNDERVOLTAGE);
static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -
Quoted 5 lines

voltage_thresh_high_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config
,

Did you try building this code?

It catches everyone...

Quoted 8 lines
Quoted 2 lines

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well,
it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can
you
please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Quoted 8 lines
Quoted 5 lines

The code involves a macro, as indicated by the capital letters. You will
see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

I'll try to make some time to address this somehow, so that checkpatch doesn't
bump into this.

Quoted 6 lines
Quoted 4 lines

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for
various Analog drivers].
So, don't feel too bad.

Maybe a comment?

Comment works for now.
Anybody wants to do a patch for that?
If nobody sends a patch for this in 1-2 weeks, I'll send one.

Particularly, this would help with review, since people that are unfamiliar with
IIO-specific macros would also find it easier at review.

Quoted 8 lines
Quoted 4 lines

The good part, is that it's only needed for AD7280A. AD7192 has been re-worked, and is no longer on checkpatch's radar. I'm reworking AD7793 now.

I will be happy to add a comment around the code area to indicate ignore checkpatch warning for the mentioned argument. Please confirm if that is what you are expecting to be done.

Sure.
Please send a patch.

Thanks
Alex

Quoted 25 lines

Thanks,
Deepak.

Quoted 21 lines
Quoted 21 lines

julia

Quoted 19 lines
Quoted 19 lines

Deepak.

Quoted 18 lines
Quoted 18 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu
.

#26 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

In reply to DEEPAK VARMA
Quoted 95 lines · DEEPAK VARMA
Quoted 94 lines · Alexandru
Quoted 80 lines · Julia Lawall

[External]

Quoted 74 lines · Alexandru
Quoted 60 lines · DEEPAK VARMA

[External]

Quoted 57 lines · Julia Lawall
Quoted 54 lines · DEEPAK VARMA
Quoted 41 lines · Greg KH
Quoted 40 lines · Lars-Peter Clausen
Quoted 39 lines · Greg KH
Quoted 31 lines · Deepak R Varma

Add spaces around operator symbols to improve readability. Warning
flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +0 -0
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t

ad7280_event_handler(int
irq, void *private)
}
static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -

voltage_thresh_low_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config, AD7280A_CELL_UNDERVOLTAGE);
static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -
Quoted 4 lines

voltage_thresh_high_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config,

Did you try building this code?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It catches everyone...

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well, it's still a great "trick" to see if people understand C or not :)

Yes, it did build. I am sorry but I am not following you fully. Can you
please let me know if the change I introduced is not good. You may please direct me to a document where I can read more about it.

Quoted 8 lines
Quoted 5 lines

The code involves a macro, as indicated by the capital letters. You will
see the issue when you look at the definition of the macro.

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

I'll try to make some time to address this somehow, so that checkpatch doesn't
bump into this.

Quoted 5 lines
Quoted 3 lines

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for various Analog drivers].
So, don't feel too bad.

Maybe a comment?

Comment works for now.
Anybody wants to do a patch for that?
If nobody sends a patch for this in 1-2 weeks, I'll send one.

Particularly, this would help with review, since people that are unfamiliar with IIO-specific macros would also find it easier at review.

Quoted 9 lines
Quoted 4 lines

The good part, is that it's only needed for AD7280A. AD7192 has been re-worked, and is no longer on checkpatch's radar. I'm reworking AD7793 now.

I will be happy to add a comment around the code area to indicate ignore checkpatch warning for the mentioned argument. Please confirm if that is what you are expecting to be done.

Hello Alexandru,
could you please confirm if I should add a comment around the code in ad7280a.c to avoid further changes being made to the string argument?

Quoted 26 lines

Thanks,
Deepak.

Quoted 23 lines
Quoted 23 lines

julia

Quoted 19 lines
Quoted 19 lines

Deepak.

Quoted 17 lines
Quoted 17 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226%40deeUbuntu
.

#27 lore raw

Re: [Outreachy kernel] Re: [PATCH 2/2] staging: iio: adc: ad7280a: Add spaces around operators

Quoted 115 lines · DEEPAK VARMA

[External]

Quoted 112 lines · DEEPAK VARMA
Quoted 110 lines · Alexandru
Quoted 90 lines · Julia Lawall

[External]

Quoted 84 lines · Alexandru
Quoted 74 lines · DEEPAK VARMA

[External]

Quoted 71 lines · Julia Lawall
Quoted 57 lines · DEEPAK VARMA
Quoted 48 lines · Greg KH
Quoted 46 lines · Lars-Peter Clausen
Quoted 44 lines · Greg KH
Quoted 33 lines · Deepak R Varma

Add spaces around operator symbols to improve
readability.
Warning
flagged by checkpatch script.

---
  drivers/staging/iio/adc/ad7280a.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +0 -0
index 19a5f244dcae..34ca0d09db85 100644
@@ -825,14 +825,14 @@ static irqreturn_t

ad7280_event_handler(int
irq, void *private)
}
static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_low_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -

voltage_thresh_low_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config
,
AD7280A_CELL_UNDERVOLTAGE);
static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +0 -1
-			     in_voltage-

voltage_thresh_high_value,

drivers/staging/iio/adc/ad7280a.c +1 -0
+			     in_voltage -
Quoted 5 lines

voltage_thresh_high_value,
0644, ad7280_read_channel_config, ad7280_write_channel_config
,

Did you try building this code?

It catches everyone...

Quoted 8 lines
Quoted 2 lines

The problem is it builds. The token is stringyfied and "in_voltage - voltage_thresh_high_value" is a valid string.

Ah, I thought it used to break the build when it happened. Oh well,
it's still a great "trick" to see if people understand C or not :)

Quoted 6 lines

Yes, it did build. I am sorry but I am not following you fully. Can
you
please let me know if the change I introduced is not good. You may
please direct me to a document where I can read more about it.

The code involves a macro, as indicated by the capital letters. You
will
see the issue when you look at the definition of the macro.

Quoted 4 lines
Quoted 1 line

julia

Thank you Julia and all. I got my mistake. I will revert the change. Sorry for the trouble.

I'll try to make some time to address this somehow, so that checkpatch doesn't
bump into this.

Quoted 6 lines
Quoted 4 lines

In the last 2-3 years, I think I saw 3-4 patches trying to address this [for
various Analog drivers].
So, don't feel too bad.

Maybe a comment?

Comment works for now.
Anybody wants to do a patch for that?
If nobody sends a patch for this in 1-2 weeks, I'll send one.

Particularly, this would help with review, since people that are unfamiliar with
IIO-specific macros would also find it easier at review.

The good part, is that it's only needed for AD7280A. AD7192 has been re-worked, and is no longer on checkpatch's radar. I'm reworking AD7793 now.

Quoted 8 lines
Quoted 4 lines

I will be happy to add a comment around the code area to indicate ignore checkpatch warning for the mentioned argument. Please confirm if that is what you are expecting to be done.

Hello Alexandru,
could you please confirm if I should add a comment around the code in ad7280a.c to avoid further changes being made to the string argument?

Sure.
Please send a patch.
[ I already replied this a few days ago; must have gotten lost in some emails ]

Quoted 27 lines
Quoted 27 lines

Thanks,
Deepak.

Quoted 22 lines
Quoted 22 lines

julia

Quoted 20 lines
Quoted 20 lines

Deepak.

Quoted 19 lines
Quoted 19 lines

Thanks,
Deepak.

Quoted 3 lines

thanks,

greg k-h

--
You received this message because you are subscribed to the Google
Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to [email protected]. To view this discussion on the web visit
https://urldefense.com/v3/__https://groups.google.com/d/msgid/outreachy-kernel/20200318162353.GA23226*40deeUbuntu__;JQ!!A3Ni8CS0y2Y!uU95kG8KOMvTxz7PtgIm2gziXrrKPEfRDslhYEuDsrhPhXlYxaYcX-70a6Ipi1oLtgyinw$
.