2024-04-28 19:44:11

by Gustavo

[permalink] [raw]
Subject: [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch

From: Gustavo Rodrigues <[email protected]>

Clean code of iio:adc:ad799x to cease warning messages pointed by
checkpatch. These include proper variable declaration 'unsigned' to
'unsigned int', add blank line and use of octal permission instead of
symbolic.

Gustavo (3):
iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration
iio: adc: ad799x.c: add blank line to avoid warning messages
iio: adc: ad799x: Prefer to use octal permission instead of symbolic

drivers/iio/adc/ad799x.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

--
2.34.1



2024-04-28 19:44:22

by Gustavo

[permalink] [raw]
Subject: [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration

From: Gustavo Rodrigues <[email protected]>

Prefer 'unsigned int' instead of bare use of 'unsigned' declarations to
to improve code readbility. This ceases one of the warning messages
pointed by checkpatch.

Co-developed-by: Bruna Lopes <[email protected]>
Signed-off-by: Bruna Lopes <[email protected]>
Signed-off-by: Gustavo Rodrigues <[email protected]>
---
drivers/iio/adc/ad799x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index b757cc45c4de..3040575793a2 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -128,7 +128,7 @@ struct ad799x_state {
struct regulator *vref;
/* lock to protect against multiple access to the device */
struct mutex lock;
- unsigned id;
+ unsigned int id;
u16 config;

u8 *rx_buf;
@@ -253,7 +253,7 @@ static int ad799x_update_scan_mode(struct iio_dev *indio_dev,
}
}

-static int ad799x_scan_direct(struct ad799x_state *st, unsigned ch)
+static int ad799x_scan_direct(struct ad799x_state *st, unsigned int ch)
{
u8 cmd;

--
2.34.1


2024-04-28 19:44:35

by Gustavo

[permalink] [raw]
Subject: [PATCH 2/3] iio: adc: ad799x: add blank line to avoid warning messages

From: Gustavo Rodrigues <[email protected]>

Add a blank line before if statement to avoid warning messages pointed by
checkpatch.

Co-developed-by: Bruna Lopes <[email protected]>
Signed-off-by: Bruna Lopes <[email protected]>
Signed-off-by: Gustavo Rodrigues <[email protected]>
---
drivers/iio/adc/ad799x.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 3040575793a2..9a12e562c259 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -335,6 +335,7 @@ static ssize_t ad799x_read_frequency(struct device *dev,
struct ad799x_state *st = iio_priv(indio_dev);

int ret = i2c_smbus_read_byte_data(st->client, AD7998_CYCLE_TMR_REG);
+
if (ret < 0)
return ret;

--
2.34.1


2024-04-28 19:44:48

by Gustavo

[permalink] [raw]
Subject: [PATCH 3/3] iio: adc: ad799x: Prefer to use octal permission

From: Gustavo Rodrigues <[email protected]>

Octal permissions are preferred over the symbolics ones
for readbility. This ceases warning message pointed by checkpatch.

Co-developed-by: Bruna Lopes <[email protected]>
Signed-off-by: Bruna Lopes <[email protected]>
Signed-off-by: Gustavo Rodrigues <[email protected]>
---
drivers/iio/adc/ad799x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 9a12e562c259..0f0dcd9ca6b6 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -524,7 +524,7 @@ static irqreturn_t ad799x_event_handler(int irq, void *private)
return IRQ_HANDLED;
}

-static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_SAMP_FREQ(0644,
ad799x_read_frequency,
ad799x_write_frequency);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("15625 7812 3906 1953 976 488 244 0");
--
2.34.1


2024-04-29 07:25:13

by Nuno Sá

[permalink] [raw]
Subject: Re: [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch

On Sun, 2024-04-28 at 16:43 -0300, [email protected] wrote:
> From: Gustavo Rodrigues <[email protected]>
>
> Clean code of iio:adc:ad799x to cease warning messages pointed by
> checkpatch. These include proper variable declaration 'unsigned' to
> 'unsigned int', add blank line and use of octal permission instead of
> symbolic.
>
> Gustavo (3):
>   iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration
>   iio: adc: ad799x.c: add blank line to avoid warning messages
>   iio: adc: ad799x: Prefer to use octal permission instead of symbolic
>
>  drivers/iio/adc/ad799x.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>

Patches look good. Just one note... It seems Marcelo gave some feedback on a
previous iterations so it looks like this should have been marked as v2?

Anyways,

Reviewed-by: Nuno Sa <[email protected]>


2024-04-29 19:58:52

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch

On Mon, 29 Apr 2024 09:28:25 +0200
Nuno Sá <[email protected]> wrote:

> On Sun, 2024-04-28 at 16:43 -0300, [email protected] wrote:
> > From: Gustavo Rodrigues <[email protected]>
> >
> > Clean code of iio:adc:ad799x to cease warning messages pointed by
> > checkpatch. These include proper variable declaration 'unsigned' to
> > 'unsigned int', add blank line and use of octal permission instead of
> > symbolic.
> >
> > Gustavo (3):
> >   iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration
> >   iio: adc: ad799x.c: add blank line to avoid warning messages
> >   iio: adc: ad799x: Prefer to use octal permission instead of symbolic
> >
> >  drivers/iio/adc/ad799x.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
>
> Patches look good. Just one note... It seems Marcelo gave some feedback on a
> previous iterations so it looks like this should have been marked as v2?
>
> Anyways,
>
> Reviewed-by: Nuno Sa <[email protected]>
>

Indeed on v2. Anyhow, applied to the togreg branch of iio.git and pushed
out as testing for the autobuilders to see if we missed anything,

Thanks,

Jonathan