* [PATCH] staging: iio/meter: add name to function definition arguments
@ 2018-02-16 12:50 rodrigosiqueira
2018-02-16 12:56 ` Daniel Baluta
0 siblings, 1 reply; 5+ messages in thread
From: rodrigosiqueira @ 2018-02-16 12:50 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman
Cc: linux-iio, devel, daniel.baluta, linux-kernel
This patch fixes the checkpatch.pl warning:
drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
argument 'struct device *' should also have an identifier name...
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
drivers/staging/iio/meter/ade7854.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7854.h b/drivers/staging/iio/meter/ade7854.h
index c27247a7891a..2362a4a51ce3 100644
--- a/drivers/staging/iio/meter/ade7854.h
+++ b/drivers/staging/iio/meter/ade7854.h
@@ -152,20 +152,20 @@
* @rx: receive buffer
**/
struct ade7854_state {
- struct spi_device *spi;
- struct i2c_client *i2c;
- int (*read_reg_8)(struct device *, u16, u8 *);
- int (*read_reg_16)(struct device *, u16, u16 *);
- int (*read_reg_24)(struct device *, u16, u32 *);
- int (*read_reg_32)(struct device *, u16, u32 *);
- int (*write_reg_8)(struct device *, u16, u8);
- int (*write_reg_16)(struct device *, u16, u16);
- int (*write_reg_24)(struct device *, u16, u32);
- int (*write_reg_32)(struct device *, u16, u32);
- int irq;
- struct mutex buf_lock;
- u8 tx[ADE7854_MAX_TX] ____cacheline_aligned;
- u8 rx[ADE7854_MAX_RX];
+ struct spi_device *spi;
+ struct i2c_client *i2c;
+ int (*read_reg_8)(struct device *dev, u16 reg_address, u8 *val);
+ int (*read_reg_16)(struct device *dev, u16 reg_address, u16 *val);
+ int (*read_reg_24)(struct device *dev, u16 reg_address, u32 *val);
+ int (*read_reg_32)(struct device *dev, u16 reg_address, u32 *val);
+ int (*write_reg_8)(struct device *dev, u16 reg_address, u8 value);
+ int (*write_reg_16)(struct device *dev, u16 reg_address, u16 value);
+ int (*write_reg_24)(struct device *dev, u16 reg_address, u32 value);
+ int (*write_reg_32)(struct device *dev, u16 reg_address, u32 value);
+ int irq;
+ struct mutex buf_lock;
+ u8 tx[ADE7854_MAX_TX] ____cacheline_aligned;
+ u8 rx[ADE7854_MAX_RX];
};
--
2.16.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: iio/meter: add name to function definition arguments
2018-02-16 12:50 [PATCH] staging: iio/meter: add name to function definition arguments rodrigosiqueira
@ 2018-02-16 12:56 ` Daniel Baluta
2018-02-16 13:16 ` Rodrigo Siqueira
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Baluta @ 2018-02-16 12:56 UTC (permalink / raw)
To: lars, knaack.h, rodrigosiqueiramelo, Michael.Hennerich, jic23,
pmeerw, gregkh
Cc: linux-kernel, linux-iio, devel
Hi Rodrigo,
I think this is a nice finding. One comment inline:
On Vi, 2018-02-16 at 10:50 -0200, rodrigosiqueira wrote:
> This patch fixes the checkpatch.pl warning:
>
> drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
> argument 'struct device *' should also have an identifier name...
>
> + int (*read_reg_32)(struct device *dev, u16 reg_address, u32 *val);
> + int (*write_reg_8)(struct device *dev, u16 reg_address, u8 value);
Any particular reason for using val vs value? I get that one is a pointer
and another a plain type, but I think the name should be the same.
thanks,
Daniel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: iio/meter: add name to function definition arguments
2018-02-16 12:56 ` Daniel Baluta
@ 2018-02-16 13:16 ` Rodrigo Siqueira
2018-02-17 14:09 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: Rodrigo Siqueira @ 2018-02-16 13:16 UTC (permalink / raw)
To: Daniel Baluta
Cc: lars, knaack.h, Michael.Hennerich, jic23, pmeerw, gregkh,
linux-kernel, linux-iio, devel
Hi Daniel
> Hi Rodrigo,
>
> I think this is a nice finding. One comment inline:
>
> On Vi, 2018-02-16 at 10:50 -0200, rodrigosiqueira wrote:
> > This patch fixes the checkpatch.pl warning:
> >
> > drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
> > argument 'struct device *' should also have an identifier name...
> >
> > + int (*read_reg_32)(struct device *dev, u16 reg_address, u32 *val);
> > + int (*write_reg_8)(struct device *dev, u16 reg_address, u8 value);
>
>
> Any particular reason for using val vs value? I get that one is a pointer
> and another a plain type, but I think the name should be the same.
Before I selected the name, I figure out that read_reg_* and write_reg_*
was assigned inside the iio/meter/ade7754-(i2c|spi).c files by function
like ade7754_*_read_reg_* and ade7754_*_write_reg_* .
I considered to use 'value' name for both functions parameters, however,
I noticed that function ade7754_*_write_reg_* adopted the name 'value'
for the last argument and ade7754_*_read_reg_* named the last argument
as 'val'. So, for consistency sake between the header file and the c
code, I decided to use the same parameter name patterns.
> thanks,
> Daniel.
>
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: iio/meter: add name to function definition arguments
2018-02-16 13:16 ` Rodrigo Siqueira
@ 2018-02-17 14:09 ` Jonathan Cameron
2018-02-19 11:52 ` Rodrigo Siqueira
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2018-02-17 14:09 UTC (permalink / raw)
To: Rodrigo Siqueira
Cc: Daniel Baluta, lars, knaack.h, Michael.Hennerich, pmeerw, gregkh,
linux-kernel, linux-iio, devel
On Fri, 16 Feb 2018 11:16:58 -0200
Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> wrote:
> Hi Daniel
>
> > Hi Rodrigo,
> >
> > I think this is a nice finding. One comment inline:
> >
> > On Vi, 2018-02-16 at 10:50 -0200, rodrigosiqueira wrote:
> > > This patch fixes the checkpatch.pl warning:
> > >
> > > drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
> > > argument 'struct device *' should also have an identifier name...
> > >
> > > + int (*read_reg_32)(struct device *dev, u16 reg_address, u32 *val);
> > > + int (*write_reg_8)(struct device *dev, u16 reg_address, u8 value);
> >
> >
> > Any particular reason for using val vs value? I get that one is a pointer
> > and another a plain type, but I think the name should be the same.
>
> Before I selected the name, I figure out that read_reg_* and write_reg_*
> was assigned inside the iio/meter/ade7754-(i2c|spi).c files by function
> like ade7754_*_read_reg_* and ade7754_*_write_reg_* .
>
> I considered to use 'value' name for both functions parameters, however,
> I noticed that function ade7754_*_write_reg_* adopted the name 'value'
> for the last argument and ade7754_*_read_reg_* named the last argument
> as 'val'. So, for consistency sake between the header file and the c
> code, I decided to use the same parameter name patterns.
>
Hohum. It isn't even that consistent ;)
ade7754_write_reg_8 uses val and ade7754_write_reg_16 uses value.
I would suggest another patch to make them all val.
Thanks,
Jonathan
>
> > thanks,
> > Daniel.
> >
>
> Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: iio/meter: add name to function definition arguments
2018-02-17 14:09 ` Jonathan Cameron
@ 2018-02-19 11:52 ` Rodrigo Siqueira
0 siblings, 0 replies; 5+ messages in thread
From: Rodrigo Siqueira @ 2018-02-19 11:52 UTC (permalink / raw)
To: Jonathan Cameron
Cc: devel, lars, Michael.Hennerich, linux-iio, gregkh, linux-kernel,
pmeerw, knaack.h, Daniel Baluta
Hi Jonathan,
> On Fri, 16 Feb 2018 11:16:58 -0200
> Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> wrote:
>
> > Hi Daniel
> >
> > > Hi Rodrigo,
> > >
> > > I think this is a nice finding. One comment inline:
> > >
> > > On Vi, 2018-02-16 at 10:50 -0200, rodrigosiqueira wrote:
> > > > This patch fixes the checkpatch.pl warning:
> > > >
> > > > drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
> > > > argument 'struct device *' should also have an identifier name...
> > > >
> > > > + int (*read_reg_32)(struct device *dev, u16 reg_address, u32 *val);
> > > > + int (*write_reg_8)(struct device *dev, u16 reg_address, u8 value);
> > >
> > >
> > > Any particular reason for using val vs value? I get that one is a pointer
> > > and another a plain type, but I think the name should be the same.
> >
> > Before I selected the name, I figure out that read_reg_* and write_reg_*
> > was assigned inside the iio/meter/ade7754-(i2c|spi).c files by function
> > like ade7754_*_read_reg_* and ade7754_*_write_reg_* .
> >
> > I considered to use 'value' name for both functions parameters, however,
> > I noticed that function ade7754_*_write_reg_* adopted the name 'value'
> > for the last argument and ade7754_*_read_reg_* named the last argument
> > as 'val'. So, for consistency sake between the header file and the c
> > code, I decided to use the same parameter name patterns.
> >
> Hohum. It isn't even that consistent ;)
>
> ade7754_write_reg_8 uses val and ade7754_write_reg_16 uses value.
>
> I would suggest another patch to make them all val.
Thanks for the review. I will send another patch as you recommended.
Rodrigo Siqueira
> Thanks,
>
> Jonathan
> >
> > > thanks,
> > > Daniel.
> > >
> >
> > Thanks
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-19 11:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16 12:50 [PATCH] staging: iio/meter: add name to function definition arguments rodrigosiqueira
2018-02-16 12:56 ` Daniel Baluta
2018-02-16 13:16 ` Rodrigo Siqueira
2018-02-17 14:09 ` Jonathan Cameron
2018-02-19 11:52 ` Rodrigo Siqueira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).