Skip to contentSkip to conversation

staging:iio:adc: fix codestyle

PATCH Superseded Sergey Efimochkin 3 participants 4 messages Dec 17, 2018 – Dec 22, 2018

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

PATCH 1/1 staging:iio:adc: fix codestyle

staging:iio:adc: fix codestyle

---
 drivers/staging/iio/adc/ad7280a.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/staging/iio/adc/ad7280a.c +9 -11
index 58420dcb406d..52e12d1201b3 100644
@@ -706,8 +706,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 				st->cell_threshhigh)
 				iio_push_event(indio_dev,
 					       IIO_EVENT_CODE(IIO_VOLTAGE,
-							1,
-							0,
+							      1,
+							      0,
 							IIO_EV_DIR_RISING,
 							IIO_EV_TYPE_THRESH,
 							0, 0, 0),
@@ -716,8 +716,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 				st->cell_threshlow)
 				iio_push_event(indio_dev,
 					       IIO_EVENT_CODE(IIO_VOLTAGE,
-							1,
-							0,
+							      1,
+							      0,
 							IIO_EV_DIR_FALLING,
 							IIO_EV_TYPE_THRESH,
 							0, 0, 0),
@@ -725,18 +725,16 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 		} else {
 			if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh)
 				iio_push_event(indio_dev,
-					       IIO_UNMOD_EVENT_CODE(
-							IIO_TEMP,
-							0,
+					       IIO_UNMOD_EVENT_CODE(IIO_TEMP,
+								    0,
 							IIO_EV_TYPE_THRESH,
 							IIO_EV_DIR_RISING),
 					       iio_get_time_ns(indio_dev));
 			else if (((channels[i] >> 11) & 0xFFF) <=
 				st->aux_threshlow)
 				iio_push_event(indio_dev,
-					       IIO_UNMOD_EVENT_CODE(
-							IIO_TEMP,
-							0,
+					       IIO_UNMOD_EVENT_CODE(IIO_TEMP,
+								    0,
 							IIO_EV_TYPE_THRESH,
 							IIO_EV_DIR_FALLING),
 					       iio_get_time_ns(indio_dev));
@@ -987,6 +985,6 @@ static struct spi_driver ad7280_driver = {
 };
 module_spi_driver(ad7280_driver);
 
-MODULE_AUTHOR("Michael Hennerich <[email protected]>");
+MODULE_AUTHOR("Michael Hennerich <[email protected]>");
 MODULE_DESCRIPTION("Analog Devices AD7280A");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
2.15.1 (Apple Git-101)
#1 lore raw

The patch prefix should be "staging: iio: adc: ad7280a:". Do git log --oneline drivers/staging/iio/adc/ad7280a.c and copy what other people do.

Quoted 1 line · Sergey Efimochkin

staging:iio:adc: fix codestyle

Only to do one thing per patch. We need a better patch description.

Quoted 10 lines
---
 drivers/staging/iio/adc/ad7280a.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/staging/iio/adc/ad7280a.c +0 -0
index 58420dcb406d..52e12d1201b3 100644

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

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +2 -2
@@ -706,8 +706,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 				st->cell_threshhigh)
 				iio_push_event(indio_dev,
 					       IIO_EVENT_CODE(IIO_VOLTAGE,
-							1,
-							0,
+							      1,
+							      0,
 							IIO_EV_DIR_RISING,
 							IIO_EV_TYPE_THRESH,
 							0, 0, 0),

No. Now the IIO_EV_DIR_RISING, and later columns are not aligned correctly. Just ignore the checkpatch warning. It's fine as-is.

drivers/staging/iio/adc/ad7280a.c static struct spi_driver ad7280_driver = { · line 988

Quoted 6 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
@@ -987,6 +985,6 @@ static struct spi_driver ad7280_driver = {
 };
 module_spi_driver(ad7280_driver);
 
-MODULE_AUTHOR("Michael Hennerich <[email protected]>");
+MODULE_AUTHOR("Michael Hennerich <[email protected]>");

This change needs to come from Michael. Just leave the code as-is.

regards,
dan carpenter

#2 lore raw

PATCH v2 1/1 staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler

staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler

---
Changes in v2:
- changed patch prefix
- changed patch description
- removed incorrect fixes to codestyle

 drivers/staging/iio/adc/ad7280a.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/ad7280a.c +2 -4
index 58420dcb406d..f167ee1b2127 100644
@@ -725,8 +725,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 		} else {
 			if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh)
 				iio_push_event(indio_dev,
-					       IIO_UNMOD_EVENT_CODE(
-							IIO_TEMP,
+					       IIO_UNMOD_EVENT_CODE(IIO_TEMP,
 							0,
 							IIO_EV_TYPE_THRESH,
 							IIO_EV_DIR_RISING),
@@ -734,8 +733,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 			else if (((channels[i] >> 11) & 0xFFF) <=
 				st->aux_threshlow)
 				iio_push_event(indio_dev,
-					       IIO_UNMOD_EVENT_CODE(
-							IIO_TEMP,
+					       IIO_UNMOD_EVENT_CODE(IIO_TEMP,
 							0,
 							IIO_EV_TYPE_THRESH,
 							IIO_EV_DIR_FALLING),
Signature · 1 line
2.15.1 (Apple Git-101)
maintainer
#3 lore raw

Re: [PATCH v2] staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler

Quoted 2 lines · On Tue, 18 Dec 2018 01:06:01 +0300 Sergey Efimochkin…

staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler

Hi,

I wouldn't say this is a real improvement on readability.
If you are really determined to 'fix it', then I would suggest introducing local variables, and only having a single call to iio_push_event for all the deeply nested cases (well one per channel anyway).

Jonathan

Quoted 32 lines

---
Changes in v2:
- changed patch prefix
- changed patch description
- removed incorrect fixes to codestyle

 drivers/staging/iio/adc/ad7280a.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/ad7280a.c +2 -4
index 58420dcb406d..f167ee1b2127 100644
@@ -725,8 +725,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 		} else {
 			if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh)
 				iio_push_event(indio_dev,
-					       IIO_UNMOD_EVENT_CODE(
-							IIO_TEMP,
+					       IIO_UNMOD_EVENT_CODE(IIO_TEMP,
 							0,
 							IIO_EV_TYPE_THRESH,
 							IIO_EV_DIR_RISING),
@@ -734,8 +733,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 			else if (((channels[i] >> 11) & 0xFFF) <=
 				st->aux_threshlow)
 				iio_push_event(indio_dev,
-					       IIO_UNMOD_EVENT_CODE(
-							IIO_TEMP,
+					       IIO_UNMOD_EVENT_CODE(IIO_TEMP,
 							0,
 							IIO_EV_TYPE_THRESH,
 							IIO_EV_DIR_FALLING),