Skip to contentSkip to conversation

staging: greybus: simple formatting cleanup

PATCH In review Lourdes Pedrajas 4 participants 9 messages Mar 13, 2020 – Mar 17, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover staging: greybus: simple formatting cleanup

Patchset that performs simple code cleanup in greybus driver. Issues found with checkpatch.

Lourdes Pedrajas (2):
staging: greybus: gpio: improve bit fields formatting.
staging: greybus: hid: remove unneded braces

 drivers/staging/greybus/gpio.c | 4 ++--
 drivers/staging/greybus/hid.c  | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 staging: greybus: gpio: improve bit fields formatting.

Fix the formatting of bit fields on structure gb_gpio_line, in order to not confuse them with unindented labels.
Issue found with checkpatch.

---
 drivers/staging/greybus/gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/gpio.c +2 -2
index 36d99f9e419e..50e93a393dba 100644
@@ -20,9 +20,9 @@
 struct gb_gpio_line {
 	/* The following has to be an array of line_max entries */
 	/* --> make them just a flags field */
-	u8			active:    1,
+	u8			active: 1,
 				direction: 1,	/* 0 = output, 1 = input */
-				value:     1;	/* 0 = low, 1 = high */
+				value: 1;	/* 0 = low, 1 = high */
 	u16			debounce_usec;
 
 	u8			irq_type;
Signature · 1 line
2.17.1
#6 lore raw

PATCH 2/2 staging: greybus: hid: remove unneded braces

In reply to Lourdes Pedrajas

Braces are not necessary for single statement blocks. Issue found with checkpatch.

---
 drivers/staging/greybus/hid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/hid.c +1 -2
index 04bfd9110502..9d4ca66e1c8d 100644
@@ -290,9 +290,8 @@ static int gb_hid_parse(struct hid_device *hid)
 	}
 
 	rdesc = kzalloc(rsize, GFP_KERNEL);
-	if (!rdesc) {
+	if (!rdesc) 
 		return -ENOMEM;
-	}
 
 	ret = gb_hid_get_report_desc(ghid, rdesc);
 	if (ret) {
Signature · 1 line
2.17.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: greybus: gpio: improve bit fields formatting.

In reply to Lourdes Pedrajas
Quoted 2 lines · Lourdes Pedrajas

Fix the formatting of bit fields on structure gb_gpio_line, in order to not confuse them with unindented labels.

What do you mean by unindented labels?

julia

Quoted 31 lines

Issue found with checkpatch.

---
 drivers/staging/greybus/gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/gpio.c +2 -3
index 36d99f9e419e..50e93a393dba 100644
@@ -20,9 +20,9 @@
 struct gb_gpio_line {
 	/* The following has to be an array of line_max entries */
 	/* --> make them just a flags field */
-	u8			active:    1,
+	u8			active: 1,
 				direction: 1,	/* 0 = output, 1 = input */
-				value:     1;	/* 0 = low, 1 = high */
+				value: 1;	/* 0 = low, 1 = high */
 	u16			debounce_usec;
 
 	u8			irq_type;
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/88c5f940009f75813f026ebad57fc8865b242971.1584131593.git.lu%40pplo.net.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: greybus: gpio: improve bit fields formatting.

Quoted 11 lines · Julia Lawall
Quoted 2 lines · Lourdes Pedrajas

Fix the formatting of bit fields on structure gb_gpio_line, in order to not confuse them with unindented labels.

What do you mean by unindented labels?

julia

I am sorry for this error! Corrected now thank you Julia! Lourdes

maintainer
#4 lore raw

Re: [PATCH v2 1/2] staging: greybus: gpio: improve bit fields formatting.

In reply to Lourdes Pedrajas
Quoted 3 lines · Lourdes Pedrajas

Fix the formatting of bit fields on structure gb_gpio_line, in order to not confuse them with indented labels.
Issue found with checkpatch.

This is not an in issue found by checkpatch. Rather, you've found an issue *with* checkpatch, which gets confused by these bit fields.

I'd just leave this as is, since there's nothing wrong with the code.

Quoted 13 lines

---
v2: log message correction

 drivers/staging/greybus/gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/gpio.c +0 -0
index 36d99f9e419e..50e93a393dba 100644
@@ -20,9 +20,9 @@
 struct gb_gpio_line {

drivers/staging/greybus/gpio.c line 28

Quoted 10 lines
drivers/staging/greybus/gpio.c +2 -2
 	/* The following has to be an array of line_max entries */
 	/* --> make them just a flags field */
-	u8			active:    1,
+	u8			active: 1,
 				direction: 1,	/* 0 = output, 1 = input */
-				value:     1;	/* 0 = low, 1 = high */
+				value: 1;	/* 0 = low, 1 = high */
 	u16			debounce_usec;
 
 	u8			irq_type;

Johan

#5 lore raw

Re: [PATCH v2 1/2] staging: greybus: gpio: improve bit fields formatting.

Quoted 11 lines · Johan Hovold
Quoted 3 lines · Lourdes Pedrajas

Fix the formatting of bit fields on structure gb_gpio_line, in order to not confuse them with indented labels.
Issue found with checkpatch.

This is not an in issue found by checkpatch. Rather, you've found an issue *with* checkpatch, which gets confused by these bit fields.

I'd just leave this as is, since there's nothing wrong with the code.

Johan

Agreed, thank you!

Lourdes

maintainer
#7 lore raw

Re: [PATCH 2/2] staging: greybus: hid: remove unneded braces

In reply to Lourdes Pedrajas
Quoted 13 lines · Lourdes Pedrajas

Braces are not necessary for single statement blocks. Issue found with checkpatch.

---
 drivers/staging/greybus/hid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/hid.c +0 -0
index 04bfd9110502..9d4ca66e1c8d 100644

drivers/staging/greybus/hid.c static int gb_hid_parse(struct hid_device *hid) · line 297

Quoted 10 lines
drivers/staging/greybus/hid.c +1 -2
@@ -290,9 +290,8 @@ static int gb_hid_parse(struct hid_device *hid)
 	}
 
 	rdesc = kzalloc(rsize, GFP_KERNEL);
-	if (!rdesc) {
+	if (!rdesc) 
 		return -ENOMEM;
-	}
 
 	ret = gb_hid_get_report_desc(ghid, rdesc);
 	if (ret) {

This patch _ADDS_ checkpatch warnings :(

Please always verify that your patch does what you think it does before you send it out...

thanks,

greg k-h

#8 lore raw

Re: [PATCH 2/2] staging: greybus: hid: remove unneded braces

Quoted 11 lines · Greg KH

On Fri, Mar 13, 2020 at 09:49:37PM +0100, Lourdes Pedrajas wrote:

This patch _ADDS_ checkpatch warnings :(

Please always verify that your patch does what you think it does before you send it out...

thanks,

greg k-h

It won't happen again :(

Thank you,
Lourdes