iio: dac: ad559*: fixed coding style issue (shorthand unsigned)
Subsystems (3)
PATCH 1/1 iio: dac: ad559*: fixed coding style issue (shorthand unsigned)
checkpatch.pl flagged use of shorthand 'unsigned' as warning trivial fix: replaced use of shorthand 'unsigned' with 'unsigned int'
--- drivers/iio/dac/ad5592r-base.c | 14 +++++++------- drivers/iio/dac/ad5592r-base.h | 4 ++-- drivers/iio/dac/ad5592r.c | 4 ++-- drivers/iio/dac/ad5593r.c | 5 +++-- 4 files changed, 14 insertions(+), 13 deletions(-)
drivers/iio/dac/ad5592r-base.c +7 -7
@@ -21,7 +21,7 @@#include "ad5592r-base.h" -static int ad5592r_gpio_get (struct gpio_chip *chip,unsigned offset) +static int ad5592r_gpio_get (struct gpio_chip *chip,unsigned int offset) {struct ad5592r_state *st =gpiochip_get_data (chip);int ret =0 ;
@@ -55,7 +55,7 @@ static int ad5592r_gpio_set(struct gpio_chip *chip, unsigned int offset,return st->ops->reg_write (st,AD5592R_REG_GPIO_SET , st->gpio_val); } -static int ad5592r_gpio_direction_input (struct gpio_chip *chip,unsigned offset) +static int ad5592r_gpio_direction_input (struct gpio_chip *chip,unsigned int offset) {struct ad5592r_state *st =gpiochip_get_data (chip);int ret;
@@ -73,7 +73,7 @@ static int ad5592r_gpio_direction_input(struct gpio_chip *chip, unsigned offset) }static int ad5592r_gpio_direction_output (struct gpio_chip *chip, -unsigned offset,int value) +unsigned int offset,int value) {struct ad5592r_state *st =gpiochip_get_data (chip);int ret;
@@ -99,7 +99,7 @@ static int ad5592r_gpio_direction_output(struct gpio_chip *chip,return st->ops->reg_write (st,AD5592R_REG_GPIO_IN_EN , st->gpio_in); } -static int ad5592r_gpio_request (struct gpio_chip *chip,unsigned offset) +static int ad5592r_gpio_request (struct gpio_chip *chip,unsigned int offset) {struct ad5592r_state *st =gpiochip_get_data (chip);
@@ -188,7 +188,7 @@ static int ad5592r_set_channel_modes(struct ad5592r_state *st) {const struct ad5592r_rw_ops *ops = st->ops;int ret; -unsigned i; +unsigned int i;u8 pulldown =0 , tristate =0 , dac =0 , adc =0 ;u16 read_back;
@@ -472,7 +472,7 @@ static const struct iio_chan_spec_ext_info ad5592r_ext_info[] = { };static void ad5592r_setup_channel (struct iio_dev *iio_dev, -struct iio_chan_spec *chan,bool output,unsigned id) +struct iio_chan_spec *chan,bool output,unsigned int id) { chan->type =IIO_VOLTAGE ; chan->indexed =1 ;
@@ -489,7 +489,7 @@ static void ad5592r_setup_channel(struct iio_dev *iio_dev,static int ad5592r_alloc_channels (struct iio_dev *iio_dev) {struct ad5592r_state *st =iio_priv (iio_dev); -unsigned i, curr_channel =0 , +unsigned int i, curr_channel =0 , num_channels = st->num_channels;struct iio_chan_spec *channels;struct fwnode_handle *child;
drivers/iio/dac/ad5592r-base.h +2 -2
@@ -42,8 +42,8 @@ enum ad5592r_registers {#define AD5592R_REG_CTRL_DAC_RANGE BIT(4)struct ad5592r_rw_ops { -int (*write_dac)(struct ad5592r_state *st,unsigned chan,u16 value); -int (*read_adc)(struct ad5592r_state *st,unsigned chan,u16 *value); +int (*write_dac)(struct ad5592r_state *st,unsigned int chan,u16 value); +int (*read_adc)(struct ad5592r_state *st,unsigned int chan,u16 *value);int (*reg_write)(struct ad5592r_state *st,u8 reg,u16 value);int (*reg_read)(struct ad5592r_state *st,u8 reg,u16 *value);int (*gpio_read)(struct ad5592r_state *st,u8 *value);
drivers/iio/dac/ad5592r.c +2 -2
@@ -30,7 +30,7 @@ static int ad5592r_spi_wnop_r16(struct ad5592r_state *st, __be16 *buf)return spi_sync_transfer (spi, &t,1 ); } -static int ad5592r_write_dac (struct ad5592r_state *st,unsigned chan,u16 value) +static int ad5592r_write_dac (struct ad5592r_state *st,unsigned int chan,u16 value) { struct spi_device *spi = container_of(st->dev, struct spi_device, dev);
@@ -39,7 +39,7 @@ static int ad5592r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value)return spi_write (spi, &st->spi_msg,sizeof (st->spi_msg)); } -static int ad5592r_read_adc (struct ad5592r_state *st,unsigned chan,u16 *value) +static int ad5592r_read_adc (struct ad5592r_state *st,unsigned int chan,u16 *value) { struct spi_device *spi = container_of(st->dev, struct spi_device, dev);int ret;
drivers/iio/dac/ad5593r.c +3 -2
@@ -40,7 +40,7 @@ static int ad5593r_read_word(struct i2c_client *i2c, u8 reg, u16 *value)return 0 ; } -static int ad5593r_write_dac (struct ad5592r_state *st,unsigned chan,u16 value) +static int ad5593r_write_dac (struct ad5592r_state *st,unsigned int chan,u16 value) {struct i2c_client *i2c =to_i2c_client (st->dev);
@@ -48,7 +48,7 @@ static int ad5593r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value) AD5593R_MODE_DAC_WRITE | chan, value); } -static int ad5593r_read_adc (struct ad5592r_state *st,unsigned chan,u16 *value) +static int ad5593r_read_adc (struct ad5592r_state *st,unsigned int chan,u16 *value) {struct i2c_client *i2c =to_i2c_client (st->dev);s32 val;
@@ -102,6 +102,7 @@ static const struct ad5592r_rw_ops ad5593r_rw_ops = {static int ad5593r_i2c_probe (struct i2c_client *i2c) {const struct i2c_device_id *id =i2c_client_get_device_id (i2c); +if (!i2c_check_functionality (i2c->adapter,I2C_FUNC_SMBUS_BYTE |I2C_FUNC_I2C ))return -EOPNOTSUPP ;
Signature · 1 line
2.49.0
Hello akshay,
Overall, your patch looks good to me.
Though, I think it may get slightly better if you consider my suggestions below.
Regards,
Marcelo
Quoted 5 lines · akshay bansod
checkpatch.pl flagged use of shorthand 'unsigned' as warning trivial fix: replaced use of shorthand 'unsigned' with 'unsigned int'
Signed-off-by akshay bansod <[email protected]>---
...
drivers/iio/dac/ad5592r-base.c static int ad5592r_gpio_set(struct gpio_chip *chip, unsigned int offset, · line 58
Quoted 6 lines
drivers/iio/dac/ad5592r-base.c +1
-1@@ -55,7 +55,7 @@ static int ad5592r_gpio_set(struct gpio_chip *chip, unsigned int offset,return st->ops->reg_write (st,AD5592R_REG_GPIO_SET , st->gpio_val); } -static int ad5592r_gpio_direction_input (struct gpio_chip *chip,unsigned offset) +static int ad5592r_gpio_direction_input (struct gpio_chip *chip,unsigned int offset)
Hmm, the driver code was mostly contained within 80 columns before. While it doesn't break any code style rule having it like that, I'd break the line to keep the code under 80 columns.
static int ad5592r_gpio_direction_input(struct gpio_chip *chip,
unsigned int offset)
Though, since that's just my personal preference, I think it should be fine if you decide to keep the function declaration in one line.
Quoted 3 lines
drivers/iio/dac/ad5592r-base.c +0
-0{struct ad5592r_state *st =gpiochip_get_data (chip);int ret;
...
drivers/iio/dac/ad5592r.c static int ad5592r_spi_wnop_r16(struct ad5592r_state *st, __be16 *buf) · line 33
Quoted 6 lines
drivers/iio/dac/ad5592r.c +1
-1@@ -30,7 +30,7 @@ static int ad5592r_spi_wnop_r16(struct ad5592r_state *st, __be16 *buf)return spi_sync_transfer (spi, &t,1 ); } -static int ad5592r_write_dac (struct ad5592r_state *st,unsigned chan,u16 value) +static int ad5592r_write_dac (struct ad5592r_state *st,unsigned int chan,u16 value)
I'd also break this one, but you may chose not to if you think it's better to keep it in one line.
drivers/iio/dac/ad5592r.c static int ad5592r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value) · line 42
Quoted 9 lines
drivers/iio/dac/ad5592r.c +1
-1{ struct spi_device *spi = container_of(st->dev, struct spi_device, dev);@@ -39,7 +39,7 @@ static int ad5592r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value)return spi_write (spi, &st->spi_msg,sizeof (st->spi_msg)); } -static int ad5592r_read_adc (struct ad5592r_state *st,unsigned chan,u16 *value) +static int ad5592r_read_adc (struct ad5592r_state *st,unsigned int chan,u16 *value)
Same here.
Quoted 3 lines
drivers/iio/dac/ad5592r.c +0
-0{ struct spi_device *spi = container_of(st->dev, struct spi_device, dev);int ret;
...
drivers/iio/dac/ad5593r.c static const struct ad5592r_rw_ops ad5593r_rw_ops = { · line 105
Quoted 5 lines
drivers/iio/dac/ad5593r.c +1
-0@@ -102,6 +102,7 @@ static const struct ad5592r_rw_ops ad5593r_rw_ops = {static int ad5593r_i2c_probe (struct i2c_client *i2c) {const struct i2c_device_id *id =i2c_client_get_device_id (i2c); +
The addition of a blank line here is desirable, but it doesn't fit this patch's scope. Drop that from this patch. You may propose another patch adding that if you want.
Hello Marcelo,
Thanks for the review.
I'll split this into two separate patches and make the necessary changes.
Regards
akshay