linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch
@ 2024-04-26  1:23 Gustavo
  2024-04-26  1:23 ` [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration Gustavo
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gustavo @ 2024-04-26  1:23 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23; +Cc: Gustavo, linux-iio, linux-kernel

Clean code of iio:adc:ad799x to avoid warning messages. 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


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

* [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration
  2024-04-26  1:23 [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Gustavo
@ 2024-04-26  1:23 ` Gustavo
  2024-04-26  1:23 ` [PATCH 2/3] iio: adc: ad799x.c: add blank line to avoid warning messages Gustavo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gustavo @ 2024-04-26  1:23 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: Gustavo, linux-iio, linux-kernel, Bruna Lopes

Prefer 'unsigned int' instead of bare use of 'unsigned' declarations to
to improve code readbility.

Co-developed-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Gustavo <gustavenrique01@gmail.com>
---
 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


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

* [PATCH 2/3] iio: adc: ad799x.c: add blank line to avoid warning messages
  2024-04-26  1:23 [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Gustavo
  2024-04-26  1:23 ` [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration Gustavo
@ 2024-04-26  1:23 ` Gustavo
  2024-04-26  1:23 ` [PATCH 3/3] iio: adc: ad799x: Prefer to use octal permission instead of symbolic Gustavo
  2024-04-27 10:39 ` [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Marcelo Schmitt
  3 siblings, 0 replies; 6+ messages in thread
From: Gustavo @ 2024-04-26  1:23 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: Gustavo, linux-iio, linux-kernel, Bruna Lopes

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

Co-developed-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Gustavo <gustavenrique01@gmail.com>
---
 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


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

* [PATCH 3/3] iio: adc: ad799x: Prefer to use octal permission instead of symbolic
  2024-04-26  1:23 [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Gustavo
  2024-04-26  1:23 ` [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration Gustavo
  2024-04-26  1:23 ` [PATCH 2/3] iio: adc: ad799x.c: add blank line to avoid warning messages Gustavo
@ 2024-04-26  1:23 ` Gustavo
  2024-04-27 10:39 ` [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Marcelo Schmitt
  3 siblings, 0 replies; 6+ messages in thread
From: Gustavo @ 2024-04-26  1:23 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: Gustavo, linux-iio, linux-kernel, Bruna Lopes

Octal permissions are preferred over the symbolics ones
for readbility.

Co-developed-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Gustavo <gustavenrique01@gmail.com>
---
 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


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

* Re: [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch
  2024-04-26  1:23 [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Gustavo
                   ` (2 preceding siblings ...)
  2024-04-26  1:23 ` [PATCH 3/3] iio: adc: ad799x: Prefer to use octal permission instead of symbolic Gustavo
@ 2024-04-27 10:39 ` Marcelo Schmitt
  3 siblings, 0 replies; 6+ messages in thread
From: Marcelo Schmitt @ 2024-04-27 10:39 UTC (permalink / raw)
  To: Gustavo; +Cc: lars, Michael.Hennerich, jic23, Gustavo, linux-iio, linux-kernel

Hi Gustavo, Bruna,

The patches look overall good but there are some improvements that can be made.
First, checkpatch points out email address mismatch. Gustavo address of sign-off
is different then the address used to send the patches. I think this can
be solved by adding --from parameter to git format-patch or git send-email.
Second, Gustavo's sign-off tag is incomplete. The tag must have either first and
last name or all developer's names.
For example:
Signed-off-by: first_name last_name <email_address>
or
Signed-off-by: first_name 1st_middle_name 2nd_middle_name ... last_name <email_address>
I'm pretty sure those actually must be sort out for a patch to be acceptable.
Some additional tips to improve patch set quality:
- Don't use file extensions in subjects
  iio: adc: ad799x.c: ... -> iio: adc: ad799x: ...
- Also wrap the cover letter text to 75 columns except when it makes text
  clearly less readable.
- It should be okay to say in commit message that a change is suggested by
  checkpatch or fixes some checkpatch warning as long as you also describe
  what the actual change is. You seem to already be describing the changes
  so maybe adding that they also cease checkpatch warnings / make code
  compliant to Linux code style.
- Maybe have a look at the submitting-patches documentation [1] and
  tips to write commit messages [2] to help producing patches.

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html
[2]: https://cbea.ms/git-commit/#why-not-how

Regards,
Marcelo

On 04/25, Gustavo wrote:
> Clean code of iio:adc:ad799x to avoid warning messages. 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
> 
> 

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

* [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int'  declaration
  2024-04-28 19:43 ogustavo
@ 2024-04-28 19:43 ` ogustavo
  0 siblings, 0 replies; 6+ messages in thread
From: ogustavo @ 2024-04-28 19:43 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: Gustavo Rodrigues, linux-iio, linux-kernel, Bruna Lopes

From: Gustavo Rodrigues <ogustavo@usp.br>

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 <brunaafl@usp.br>
Signed-off-by: Bruna Lopes <brunaafl@usp.br>
Signed-off-by: Gustavo Rodrigues <ogustavo@usp.br>
---
 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


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

end of thread, other threads:[~2024-04-28 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26  1:23 [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Gustavo
2024-04-26  1:23 ` [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration Gustavo
2024-04-26  1:23 ` [PATCH 2/3] iio: adc: ad799x.c: add blank line to avoid warning messages Gustavo
2024-04-26  1:23 ` [PATCH 3/3] iio: adc: ad799x: Prefer to use octal permission instead of symbolic Gustavo
2024-04-27 10:39 ` [PATCH 0/3] iio: adc: ad799x: Fix warning generated by checkpatch Marcelo Schmitt
2024-04-28 19:43 ogustavo
2024-04-28 19:43 ` [PATCH 1/3] iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration ogustavo

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