Linux-IIO Archive on lore.kernel.org
 help / Atom feed
* [PATCH] staging:iio:adc: fix codestyle
@ 2018-12-17  1:43 Sergey Efimochkin
  2018-12-17  7:45 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Efimochkin @ 2018-12-17  1:43 UTC (permalink / raw)
  To: unlisted-recipients:; (no To-header on input)
  Cc: Sergey Efimochkin, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, linux-iio, devel, linux-kernel

staging:iio:adc: fix codestyle
Signed-off-by: Sergey Efimochkin <efimochkin.sv@phystech.edu>
---
 drivers/staging/iio/adc/ad7280a.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 58420dcb406d..52e12d1201b3 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -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 <michael.hennerich@analog.com>");
+MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("Analog Devices AD7280A");
 MODULE_LICENSE("GPL v2");
-- 
2.15.1 (Apple Git-101)


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

* Re: [PATCH] staging:iio:adc: fix codestyle
  2018-12-17  1:43 [PATCH] staging:iio:adc: fix codestyle Sergey Efimochkin
@ 2018-12-17  7:45 ` Dan Carpenter
  2018-12-17 22:06   ` [PATCH v2] staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler Sergey Efimochkin
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2018-12-17  7:45 UTC (permalink / raw)
  To: Sergey Efimochkin
  Cc: devel, Lars-Peter Clausen, Michael Hennerich, linux-iio,
	Greg Kroah-Hartman, linux-kernel, Sergey Efimochkin,
	Peter Meerwald-Stadler, Hartmut Knaack, Jonathan Cameron

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.

On Mon, Dec 17, 2018 at 04:43:33AM +0300, Sergey Efimochkin wrote:
> staging:iio:adc: fix codestyle

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

> Signed-off-by: Sergey Efimochkin <efimochkin.sv@phystech.edu>
> ---
>  drivers/staging/iio/adc/ad7280a.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index 58420dcb406d..52e12d1201b3 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -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.

> @@ -987,6 +985,6 @@ static struct spi_driver ad7280_driver = {
>  };
>  module_spi_driver(ad7280_driver);
>  
> -MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
> +MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");

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

regards,
dan carpenter


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

* [PATCH v2] staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler
  2018-12-17  7:45 ` Dan Carpenter
@ 2018-12-17 22:06   ` Sergey Efimochkin
  2018-12-22 17:04     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Efimochkin @ 2018-12-17 22:06 UTC (permalink / raw)
  To: unlisted-recipients:; (no To-header on input)
  Cc: dan.carpenter, Sergey Efimochkin, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Hartmut Knaack,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, linux-iio, devel,
	linux-kernel

staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler
Signed-off-by: Sergey Efimochkin <efimochkin.sv@phystech.edu>
---
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(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 58420dcb406d..f167ee1b2127 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -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),
-- 
2.15.1 (Apple Git-101)


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

* Re: [PATCH v2] staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler
  2018-12-17 22:06   ` [PATCH v2] staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler Sergey Efimochkin
@ 2018-12-22 17:04     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2018-12-22 17:04 UTC (permalink / raw)
  To: Sergey Efimochkin
  Cc: dan.carpenter, Sergey Efimochkin, Lars-Peter Clausen,
	Michael Hennerich, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, linux-iio, devel, linux-kernel

On Tue, 18 Dec 2018 01:06:01 +0300
Sergey Efimochkin <sergeyanton2007@gmail.com> wrote:

> staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler
> Signed-off-by: Sergey Efimochkin <efimochkin.sv@phystech.edu>
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

> ---
> 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(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index 58420dcb406d..f167ee1b2127 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -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),


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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17  1:43 [PATCH] staging:iio:adc: fix codestyle Sergey Efimochkin
2018-12-17  7:45 ` Dan Carpenter
2018-12-17 22:06   ` [PATCH v2] staging: iio: adc: ad7280a: fix codestyle in ad7280_event_handler Sergey Efimochkin
2018-12-22 17:04     ` Jonathan Cameron

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org linux-iio@archiver.kernel.org
	public-inbox-index linux-iio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox