DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] staging: iio: adc: ad7280: Add spaces around math operator
@ 2019-11-09 15:17 Pedro Ortega
  2019-11-10 13:27 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Ortega @ 2019-11-09 15:17 UTC (permalink / raw)
  Cc: devel, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michael Hennerich, linux-iio, Greg Kroah-Hartman, portega.kernel,
	linux-kernel, Stefan Popa, Hartmut Knaack, Jonathan Cameron

Add spaces around the minus math operator to increase readability.

Signed-off-by: Pedro Ortega <portega.kernel@gmx.com>
---
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 19a5f244dcae..34ca0d09db85 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -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,
--
2.17.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: iio: adc: ad7280: Add spaces around math operator
  2019-11-09 15:17 [PATCH] staging: iio: adc: ad7280: Add spaces around math operator Pedro Ortega
@ 2019-11-10 13:27 ` Jonathan Cameron
  2019-11-10 18:19   ` Pedro Ortega
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2019-11-10 13:27 UTC (permalink / raw)
  To: Pedro Ortega
  Cc: devel, Lars-Peter Clausen, Stefan Popa, Michael Hennerich,
	linux-iio, Greg Kroah-Hartman, linux-kernel,
	Peter Meerwald-Stadler, Hartmut Knaack

On Sat,  9 Nov 2019 16:17:28 +0100
Pedro Ortega <portega.kernel@gmx.com> wrote:

> Add spaces around the minus math operator to increase readability.
> 
> Signed-off-by: Pedro Ortega <portega.kernel@gmx.com>
Hi Pedro,

Afraid not.  Look at what that macro is actually doing.  That's not a maths
operator at all.  I'm fairly sure we had a plan to actually hide these
examples away as we get a few people suggesting this 'fix' ever year.
Not sure what happened to them though, I'll have to check back.

Sorry about this, but it is a good lesson in making sure you check
that the suggestion from checkpatch is actually correct.  It's a
pattern matcher, it can't always know enough to be able to tell what
is going on.

Thanks,

Jonathan

> ---
>  drivers/staging/iio/adc/ad7280a.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index 19a5f244dcae..34ca0d09db85 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -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,
> --
> 2.17.1
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: iio: adc: ad7280: Add spaces around math operator
  2019-11-10 13:27 ` Jonathan Cameron
@ 2019-11-10 18:19   ` Pedro Ortega
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Ortega @ 2019-11-10 18:19 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: devel, Lars-Peter Clausen, Stefan Popa, Michael Hennerich,
	linux-iio, Greg Kroah-Hartman, linux-kernel,
	Peter Meerwald-Stadler, Hartmut Knaack

On Sun, Nov 10, 2019 at 01:27:10PM +0000, Jonathan Cameron wrote:
> On Sat,  9 Nov 2019 16:17:28 +0100
> Pedro Ortega <portega.kernel@gmx.com> wrote:
>
> > Add spaces around the minus math operator to increase readability.
> >
> > Signed-off-by: Pedro Ortega <portega.kernel@gmx.com>
> Hi Pedro,
>
> Afraid not.  Look at what that macro is actually doing.  That's not a maths
> operator at all.  I'm fairly sure we had a plan to actually hide these
> examples away as we get a few people suggesting this 'fix' ever year.
> Not sure what happened to them though, I'll have to check back.

I'm sorry. Next time I will review the code much more carefully. The macro
IIO_DEVICE_ATTR_NAMED expand the second parameter to a string. So, the hyphen
is not a maths operator.

>
> Sorry about this, but it is a good lesson in making sure you check
> that the suggestion from checkpatch is actually correct.  It's a
> pattern matcher, it can't always know enough to be able to tell what
> is going on.

First lesson learned.
>
> Thanks,
>
> Jonathan

Thanks,

Pedro
>
> > ---
> >  drivers/staging/iio/adc/ad7280a.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> > index 19a5f244dcae..34ca0d09db85 100644
> > --- a/drivers/staging/iio/adc/ad7280a.c
> > +++ b/drivers/staging/iio/adc/ad7280a.c
> > @@ -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,
> > --
> > 2.17.1
> >
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 15:17 [PATCH] staging: iio: adc: ad7280: Add spaces around math operator Pedro Ortega
2019-11-10 13:27 ` Jonathan Cameron
2019-11-10 18:19   ` Pedro Ortega

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/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 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


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