staging: iio/meter: add name to function definition arguments
Subsystems (4)
PATCH 1/1 staging: iio/meter: add name to function definition arguments
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...
--- drivers/staging/iio/meter/ade7854.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/iio/meter/ade7854.h +14 -14
@@ -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 ]; };
Signature · 6 lines
2.16.1 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Hi Rodrigo,
I think this is a nice finding. One comment inline:
drivers/staging/iio/meter/ade7854.h line 161
Quoted 7 lines · rodrigosiqueira
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...drivers/staging/iio/meter/ade7854.h +2
-0+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.
Hi Daniel
Quoted 7 lines
Hi Rodrigo,
I think this is a nice finding. One comment inline:
Quoted 2 lines · rodrigosiqueira
This patch fixes the checkpatch.pl warning:
Quoted 9 lines
drivers/staging/iio/meter/ade7854.h line 161
Quoted 5 lines
drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition argument 'struct device *' should also have an identifier name...drivers/staging/iio/meter/ade7854.h +2
-0+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.
Quoted 3 lines
thanks,
Daniel.
Thanks
Jonathan Cameron
maintainerQuoted 23 lines · On Fri, 16 Feb 2018 11:16:58 -0200 Rodrigo Siqueira…
Hi Daniel
Quoted 7 lines
Hi Rodrigo,
I think this is a nice finding. One comment inline:
Quoted 2 lines · rodrigosiqueira
This patch fixes the checkpatch.pl warning:
Quoted 9 lines
drivers/staging/iio/meter/ade7854.h line 161
Quoted 5 lines
drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition argument 'struct device *' should also have an identifier name...drivers/staging/iio/meter/ade7854.h +2
-0+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_* .
Quoted 6 lines
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
Quoted 6 lines
Quoted 4 lines
thanks,
Daniel.Thanks
Hi Jonathan,
Quoted 32 lines
Quoted 23 lines · On Fri, 16 Feb 2018 11:16:58 -0200 Rodrigo Siqueira…
Hi Daniel
Quoted 7 lines
Hi Rodrigo,
I think this is a nice finding. One comment inline:
Quoted 2 lines · rodrigosiqueira
This patch fixes the checkpatch.pl warning:
Quoted 9 lines
drivers/staging/iio/meter/ade7854.h line 161
Quoted 5 lines
drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition argument 'struct device *' should also have an identifier name...drivers/staging/iio/meter/ade7854.h +2
-0+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_* .
Quoted 6 lines
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.
Quoted 5 lines
Hohum. It isn't even that consistent ;)
ade7754_write_reg_8uses val andade7754_write_reg_16uses 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
Quoted 10 lines
Thanks,
Jonathan
Quoted 6 lines
Quoted 4 lines
thanks,
Daniel.Thanks