Skip to contentSkip to conversation

staging: iio: adc: add missing spaces around minus sign

PATCH In review Slawomir Stepien 5 participants 7 messages Oct 1, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: adc: add missing spaces around minus sign

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +1 -1
index acdbc07fd259..7c632cf1932b 100644
@@ -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,
drivers/staging/iio/adc/ad7280a.c +2 -2
index 58420dcb406d..a4b4f8678c56 100644
@@ -750,14 +750,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.19.0
#1 lore raw
Quoted 18 lines · Slawomir Stepien

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index acdbc07fd259..7c632cf1932b 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 359

Quoted 6 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);

This doesn't work. That's not arithmatic, it's a string which is passed to a macro. It's an ugly macro, but it would take a lot of work to change it at this point.

regards,
dan carpenter

#2 lore raw
Quoted 31 lines · Dan Carpenter
Quoted 18 lines · Slawomir Stepien

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index acdbc07fd259..7c632cf1932b 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 359

Quoted 6 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);

This doesn't work. That's not arithmatic, it's a string which is passed to a macro. It's an ugly macro, but it would take a lot of work to change it at this point.

Quoted 1 line

From a technical perspective it is easy to change this. We already had

patches for that. The difficulty is convincing Greg that this would be a sensible change to pass the string as a string and not a preprocessor token.

#3 lore raw
Quoted 32 lines · Lars-Peter Clausen
Quoted 30 lines · Dan Carpenter
Quoted 18 lines · Slawomir Stepien

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index acdbc07fd259..7c632cf1932b 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 359

Quoted 6 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);

This doesn't work. That's not arithmatic, it's a string which is passed to a macro. It's an ugly macro, but it would take a lot of work to change it at this point.

Quoted 3 lines
Quoted 1 line

From a technical perspective it is easy to change this. We already had

patches for that. The difficulty is convincing Greg that this would be a sensible change to pass the string as a string and not a preprocessor token.

Oh. Hm... I was looking at this wrong. It would be awkward to make it a string because the _show() op names depend on the filename.

People do keep bumping into this mistake, but there is no chance that anyone is going to merge it so it's probably not worth investing any more time on it.

regards,
dan carpenter

#4 lore raw
Quoted 37 lines · On Mon, 1 Oct 2018 16:35:33 +0300 Dan Carpenter <[email protected]>…
Quoted 32 lines · Lars-Peter Clausen
Quoted 30 lines · Dan Carpenter
Quoted 18 lines · Slawomir Stepien

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index acdbc07fd259..7c632cf1932b 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 359

Quoted 6 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);  

This doesn't work. That's not arithmatic, it's a string which is passed to a macro. It's an ugly macro, but it would take a lot of work to change it at this point.

Quoted 3 lines
Quoted 1 line

From a technical perspective it is easy to change this. We already had

patches for that. The difficulty is convincing Greg that this would be a sensible change to pass the string as a string and not a preprocessor token.

Quoted 7 lines

Oh. Hm... I was looking at this wrong. It would be awkward to make it a string because the _show() op names depend on the filename.

People do keep bumping into this mistake, but there is no chance that anyone is going to merge it so it's probably not worth investing any more time on it.

Or... Plan b) use the callbacks to generate this automatically and avoid having to have the macro use at all.

In theory it was on the plan to get rid of all of these _available definitions in favour of ones that in kernel consumers can actually read easily, we just haven't made that much progress with it.

Jonathan

p.s. Good learning experience for people to discover that checkpatch isn't infallible? *ducks*

Quoted 2 lines

regards,
dan carpenter

#5 lore raw
In reply to Slawomir Stepien
Quoted 4 lines

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

oh no, not again
please see e.g. https://lore.kernel.org/patchwork/patch/635994/
for some discussion why this patch doesn't make sense

Quoted 45 lines

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +1 -1
index acdbc07fd259..7c632cf1932b 100644
@@ -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,

drivers/staging/iio/adc/ad7280a.c +2 -2
index 58420dcb406d..a4b4f8678c56 100644
@@ -750,14 +750,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 · 2 lines
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
#6 lore raw
Quoted 8 lines · Peter Meerwald-Stadler
Quoted 4 lines

The checkpatch.pl tool detected coding style problem:

CHECK: spaces preferred around that '-' (ctx:VxV)

oh no, not again
please see e.g. https://lore.kernel.org/patchwork/patch/635994/
for some discussion why this patch doesn't make sense

Oh...my mistake. Thank you for clarification. I should be more careful. Sorry!

Quoted 46 lines
Quoted 45 lines

in two files inside the adc directory. This patch will remove this problem.

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7192.c +1 -1
index acdbc07fd259..7c632cf1932b 100644
@@ -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,

drivers/staging/iio/adc/ad7280a.c +2 -2
index 58420dcb406d..a4b4f8678c56 100644
@@ -750,14 +750,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
Slawomir Stepien