linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: dac: ad559*: fixed coding style issue (shorthand unsigned)
@ 2025-05-03  9:55 akshay bansod
  2025-05-03 15:22 ` Marcelo Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: akshay bansod @ 2025-05-03  9:55 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-iio, linux-kernel, linux-gpio

checkpatch.pl flagged use of shorthand 'unsigned' as warning
trivial fix: replaced use of shorthand 'unsigned' with 'unsigned int'

Signed-off-by: akshay bansod <akshaybansod997@gmail.com>
---
 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(-)

diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
index 5f2cd5172..9aa051a74 100644
--- a/drivers/iio/dac/ad5592r-base.c
+++ b/drivers/iio/dac/ad5592r-base.c
@@ -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;
diff --git a/drivers/iio/dac/ad5592r-base.h b/drivers/iio/dac/ad5592r-base.h
index cc7be426c..d78f5bb72 100644
--- a/drivers/iio/dac/ad5592r-base.h
+++ b/drivers/iio/dac/ad5592r-base.h
@@ -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);
diff --git a/drivers/iio/dac/ad5592r.c b/drivers/iio/dac/ad5592r.c
index 92d1b629b..a40f590e6 100644
--- a/drivers/iio/dac/ad5592r.c
+++ b/drivers/iio/dac/ad5592r.c
@@ -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;
diff --git a/drivers/iio/dac/ad5593r.c b/drivers/iio/dac/ad5593r.c
index 9a8525c61..3bdb54820 100644
--- a/drivers/iio/dac/ad5593r.c
+++ b/drivers/iio/dac/ad5593r.c
@@ -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;
-- 
2.49.0


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

* Re: [PATCH] iio: dac: ad559*: fixed coding style issue (shorthand unsigned)
  2025-05-03  9:55 [PATCH] iio: dac: ad559*: fixed coding style issue (shorthand unsigned) akshay bansod
@ 2025-05-03 15:22 ` Marcelo Schmitt
  2025-05-03 18:21   ` Akshay Bansod
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Schmitt @ 2025-05-03 15:22 UTC (permalink / raw)
  To: akshay bansod
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, linux-iio, linux-kernel, linux-gpio

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

On 05/03, akshay bansod wrote:
> checkpatch.pl flagged use of shorthand 'unsigned' as warning
> trivial fix: replaced use of shorthand 'unsigned' with 'unsigned int'
> 
> Signed-off-by: akshay bansod <akshaybansod997@gmail.com>
> ---
...
> @@ -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.

>  {
>  	struct ad5592r_state *st = gpiochip_get_data(chip);
>  	int ret;
...
> @@ -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.

>  {
>  	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.

>  {
>  	struct spi_device *spi = container_of(st->dev, struct spi_device, dev);
>  	int ret;
...
> @@ -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.

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

* Re: [PATCH] iio: dac: ad559*: fixed coding style issue (shorthand unsigned)
  2025-05-03 15:22 ` Marcelo Schmitt
@ 2025-05-03 18:21   ` Akshay Bansod
  0 siblings, 0 replies; 3+ messages in thread
From: Akshay Bansod @ 2025-05-03 18:21 UTC (permalink / raw)
  To: Marcelo Schmitt
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, linux-iio, linux-kernel, linux-gpio

Hello Marcelo,

Thanks for the review.
I'll split this into two separate patches and make the necessary changes.

Regards
akshay

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

end of thread, other threads:[~2025-05-03 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-03  9:55 [PATCH] iio: dac: ad559*: fixed coding style issue (shorthand unsigned) akshay bansod
2025-05-03 15:22 ` Marcelo Schmitt
2025-05-03 18:21   ` Akshay Bansod

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).