public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator
@ 2019-03-10 21:22 Karen Palacio
  2019-03-11  8:12 ` Alexandru Ardelean
  0 siblings, 1 reply; 5+ messages in thread
From: Karen Palacio @ 2019-03-10 21:22 UTC (permalink / raw)
  To: linux-kernel, devel, linux-iio, gregkh, pmeerw, knaack.h, jic23,
	Michael.Hennerich, lars
  Cc: Karen Palacio

Add spaces around minus operator to fix readibility.

Signed-off-by: Karen Palacio <karen.palacio.1994@gmail.com>
---
 drivers/staging/iio/adc/ad7192.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index acdbc07..7c632cf 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -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,
-- 
2.7.4


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

* Re: [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator
  2019-03-10 21:22 [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator Karen Palacio
@ 2019-03-11  8:12 ` Alexandru Ardelean
  2019-03-11  8:31   ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Ardelean @ 2019-03-11  8:12 UTC (permalink / raw)
  To: Karen Palacio
  Cc: LKML, devel, linux-iio, gregkh, Peter Meerwald-Stadler, knaack.h,
	Jonathan Cameron, Hennerich, Michael, lars, Mircea Caprioru

On Sun, Mar 10, 2019 at 11:23 PM Karen Palacio
<karen.palacio.1994@gmail.com> wrote:
>
> Add spaces around minus operator to fix readibility.
>
> Signed-off-by: Karen Palacio <karen.palacio.1994@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7192.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> index acdbc07..7c632cf 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -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,

This isn't broken, but I do agree it should be addressed.
I think it's the second time I see a similar patch trying to fix this.
So, obviously the code is a bit misleading.

>                              0444, ad7192_show_scale_available, NULL, 0);
>
>  static IIO_DEVICE_ATTR(in_voltage_scale_available, 0444,
> --
> 2.7.4
>

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

* Re: [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator
  2019-03-11  8:12 ` Alexandru Ardelean
@ 2019-03-11  8:31   ` Dan Carpenter
  2019-03-11  9:00     ` Jeremy Sowden
  2019-03-16 15:59     ` Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-03-11  8:31 UTC (permalink / raw)
  To: Alexandru Ardelean
  Cc: Karen Palacio, devel, lars, Hennerich, Michael, linux-iio, gregkh,
	LKML, Peter Meerwald-Stadler, knaack.h, Mircea Caprioru,
	Jonathan Cameron

On Mon, Mar 11, 2019 at 10:12:48AM +0200, Alexandru Ardelean wrote:
> On Sun, Mar 10, 2019 at 11:23 PM Karen Palacio
> <karen.palacio.1994@gmail.com> wrote:
> >
> > Add spaces around minus operator to fix readibility.
> >
> > Signed-off-by: Karen Palacio <karen.palacio.1994@gmail.com>
> > ---
> >  drivers/staging/iio/adc/ad7192.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> > index acdbc07..7c632cf 100644
> > --- a/drivers/staging/iio/adc/ad7192.c
> > +++ b/drivers/staging/iio/adc/ad7192.c
> > @@ -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,
> 
> This isn't broken, but I do agree it should be addressed.
> I think it's the second time I see a similar patch trying to fix this.
> So, obviously the code is a bit misleading.
> 

It's got to be more than that.  I did a simple grep of my inbox and it
says that this is the 13th time someone has tried to do this.  It's
possible that my grep is wrong, 13 seems high but not totaly impossible.

regards,
dan carpenter


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

* Re: [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator
  2019-03-11  8:31   ` Dan Carpenter
@ 2019-03-11  9:00     ` Jeremy Sowden
  2019-03-16 15:59     ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Jeremy Sowden @ 2019-03-11  9:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alexandru Ardelean, devel, Karen Palacio, lars,
	Hennerich, Michael, linux-iio, gregkh, LKML,
	Peter Meerwald-Stadler, knaack.h, Mircea Caprioru,
	Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 2154 bytes --]

On 2019-03-11, at 11:31:59 +0300, Dan Carpenter wrote:
> On Mon, Mar 11, 2019 at 10:12:48AM +0200, Alexandru Ardelean wrote:
> > On Sun, Mar 10, 2019 at 11:23 PM Karen Palacio
> > <karen.palacio.1994@gmail.com> wrote:
> > >
> > > Add spaces around minus operator to fix readibility.
> > >
> > > Signed-off-by: Karen Palacio <karen.palacio.1994@gmail.com>
> > > ---
> > >  drivers/staging/iio/adc/ad7192.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> > > index acdbc07..7c632cf 100644
> > > --- a/drivers/staging/iio/adc/ad7192.c
> > > +++ b/drivers/staging/iio/adc/ad7192.c
> > > @@ -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,
> >
> > This isn't broken, but I do agree it should be addressed.  I think
> > it's the second time I see a similar patch trying to fix this.  So,
> > obviously the code is a bit misleading.
> >
>
> It's got to be more than that.  I did a simple grep of my inbox and it
> says that this is the 13th time someone has tried to do this.  It's
> possible that my grep is wrong, 13 seems high but not totaly
> impossible.

The second parameter of IIO_DEVICE_ATTR_NAMED is a name which is
eventually stringified, not an arithmetic expression.

  #define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, \
				_addr) \
	struct iio_dev_attr iio_dev_attr_##_vname \
	= IIO_ATTR(_name, _mode, _show, _store, _addr)

which is defined as:

  #define IIO_ATTR(_name, _mode, _show, _store, _addr)		\
	{ .dev_attr = __ATTR(_name, _mode, _show, _store),	\
	  .address = _addr }

which is defined as:

  #define __ATTR(_name, _mode, _show, _store) {             \
	.attr = {.name = __stringify(_name),                \
		 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
	.show	= _show,                                    \
	.store	= _store,                                   \
  }

J.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator
  2019-03-11  8:31   ` Dan Carpenter
  2019-03-11  9:00     ` Jeremy Sowden
@ 2019-03-16 15:59     ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2019-03-16 15:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alexandru Ardelean, Karen Palacio, devel, lars,
	Hennerich, Michael, linux-iio, gregkh, LKML,
	Peter Meerwald-Stadler, knaack.h, Mircea Caprioru

On Mon, 11 Mar 2019 11:31:59 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Mon, Mar 11, 2019 at 10:12:48AM +0200, Alexandru Ardelean wrote:
> > On Sun, Mar 10, 2019 at 11:23 PM Karen Palacio
> > <karen.palacio.1994@gmail.com> wrote:  
> > >
> > > Add spaces around minus operator to fix readibility.
> > >
> > > Signed-off-by: Karen Palacio <karen.palacio.1994@gmail.com>
> > > ---
> > >  drivers/staging/iio/adc/ad7192.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> > > index acdbc07..7c632cf 100644
> > > --- a/drivers/staging/iio/adc/ad7192.c
> > > +++ b/drivers/staging/iio/adc/ad7192.c
> > > @@ -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,  
> > 
> > This isn't broken, but I do agree it should be addressed.
> > I think it's the second time I see a similar patch trying to fix this.
> > So, obviously the code is a bit misleading.
> >   
> 
> It's got to be more than that.  I did a simple grep of my inbox and it
> says that this is the 13th time someone has tried to do this.  It's
> possible that my grep is wrong, 13 seems high but not totaly impossible.

That sounds about right.

Best bet is to move this over to the read_avail callback and do it using
the core handling for available attributes which will build the name
in code so checkpatch won't find it.

Anyone want to spin up a patch to do that and save anyone else wasting
time on this?  Or we could just put a comment right next to it and hope
people read it..  

Thanks,

Jonathan

> 
> regards,
> dan carpenter
> 


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

end of thread, other threads:[~2019-03-16 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-10 21:22 [PATCH] staging: iio: adc: ad7192: Add spaces around minus operator Karen Palacio
2019-03-11  8:12 ` Alexandru Ardelean
2019-03-11  8:31   ` Dan Carpenter
2019-03-11  9:00     ` Jeremy Sowden
2019-03-16 15:59     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox