Skip to contentSkip to conversation

staging: wlan-ng: fix checkpatch.pl code style warnings

PATCH In review Andrii 2 participants 7 messages Mar 11, 2017 – Mar 29, 2017 Staging

lore
Share & tools
lore

Andrii

author
#0 lore raw

PATCH 1/1 staging: wlan-ng: fix checkpatch.pl code style warnings

Fixed code style warnings reported by checkpatch.pl script.

drivers/staging/wlan-ng/hfa384x_usb.c +4 -8
index 6134eba..d7d2d13 100644
@@ -1346,14 +1346,10 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,
-						  init_cmd_completor(&completor,
-								     &ctlx->
-								     inbuf.
-								     cmdresp,
-								     &cmd->
-								     result));
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+						init_cmd_completor(&completor,
+							&ctlx->inbuf.cmdresp,
+							&cmd->result));
 	}
 
 done:
maintainer
#1 lore raw
Quoted 1 line · Andrii

Fixed code style warnings reported by checkpatch.pl script.

What warning would that be? Please always be very specific.

Quoted 2 lines

Trailing whitespace on this line :(

Quoted 10 lines
drivers/staging/wlan-ng/hfa384x_usb.c +0 -2
index 6134eba..d7d2d13 100644
@@ -1346,14 +1346,10 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,

drivers/staging/wlan-ng/hfa384x_usb.c hfa384x_docmd(struct hfa384x *hw, · line 1352

Quoted 10 lines
drivers/staging/wlan-ng/hfa384x_usb.c +4 -6
-						  init_cmd_completor(&completor,
-								     &ctlx->
-								     inbuf.
-								     cmdresp,
-								     &cmd->
-								     result));
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+						init_cmd_completor(&completor,
+							&ctlx->inbuf.cmdresp,
+							&cmd->result));

It's still a pain to read, can't there be a better way to rewite the code to be readable?

thanks,

greg k-h

author
#2 lore raw

PATCH v2 1/1 staging: wlan-ng: fix avoid multiple line dereference warning reported by checkpatch.pl

In reply to Andrii

Fixed three code style warnings (multiple line dereference) reported by checkpatch.pl script.

drivers/staging/wlan-ng/hfa384x_usb.c +2 -8
index 6134eba..a050748 100644
@@ -1346,14 +1346,8 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,
-						  init_cmd_completor(&completor,
-								     &ctlx->
-								     inbuf.
-								     cmdresp,
-								     &cmd->
-								     result));
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+	init_cmd_completor(&completor, &ctlx->inbuf.cmdresp, &cmd->result))
 	}
 
 done:
maintainer
#3 lore raw

Re: [PATCHv2] staging: wlan-ng: fix avoid multiple line dereference warning reported by checkpatch.pl

Quoted 13 lines · Andrii

Fixed three code style warnings (multiple line dereference) reported by checkpatch.pl script.

drivers/staging/wlan-ng/hfa384x_usb.c +0 -0
index 6134eba..a050748 100644
@@ -1346,14 +1346,8 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 

drivers/staging/wlan-ng/hfa384x_usb.c hfa384x_docmd(struct hfa384x *hw, · line 1350

Quoted 10 lines
drivers/staging/wlan-ng/hfa384x_usb.c +2 -8
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,
-						  init_cmd_completor(&completor,
-								     &ctlx->
-								     inbuf.
-								     cmdresp,
-								     &cmd->
-								     result));
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+	init_cmd_completor(&completor, &ctlx->inbuf.cmdresp, &cmd->result))

Hm, did you run your patch through checkpatch? There's no way that his code is correct :(

greg k-h

author
#4 lore raw

Re: [PATCHv2] staging: wlan-ng: fix avoid multiple line dereference warning reported by checkpatch.pl

Quoted 35 lines · On Sun, 12 Mar 2017 16:42:07 +0100 Greg KH <[email protected]> wrote:
Quoted 29 lines · Andrii

Fixed three code style warnings (multiple line dereference) reported by checkpatch.pl script.

(quoted diff) +0 -0

b/drivers/staging/wlan-ng/hfa384x_usb.c index 6134eba..a050748 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c

drivers/staging/wlan-ng/hfa384x_usb.c +0 -4
@@ -1346,14 +1346,8 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,
-
 init_cmd_completor(&completor,
-

&ctlx->
-
inbuf.
-
cmdresp,
-
&cmd->
-
result));

(quoted diff) +2 -0
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+	init_cmd_completor(&completor, &ctlx->inbuf.cmdresp,
Quoted 1 line

&cmd->result))

Hm, did you run your patch through checkpatch? There's no way that his code is correct :(

Quoted 1 line

greg k-h

Yes, I did. The code is correct. Checkpatch now reports "Alignment should match open parenthesis" CHECK, which is obviously better than original WARNING.

Regards,
Andrii

maintainer
#5 lore raw

Re: [PATCHv2] staging: wlan-ng: fix avoid multiple line dereference warning reported by checkpatch.pl

Quoted 38 lines · Andrii
Quoted 35 lines · On Sun, 12 Mar 2017 16:42:07 +0100 Greg KH <[email protected]> wrote:
Quoted 29 lines · Andrii

Fixed three code style warnings (multiple line dereference) reported by checkpatch.pl script.

(quoted diff) +0 -0

b/drivers/staging/wlan-ng/hfa384x_usb.c index 6134eba..a050748 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c

drivers/staging/wlan-ng/hfa384x_usb.c +0 -4
@@ -1346,14 +1346,8 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,
-
 init_cmd_completor(&completor,
-

&ctlx->
-
inbuf.
-
cmdresp,
-
&cmd->
-
result));

(quoted diff) +2 -0
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+	init_cmd_completor(&completor, &ctlx->inbuf.cmdresp,
Quoted 1 line

&cmd->result))

Hm, did you run your patch through checkpatch? There's no way that his code is correct :(

Quoted 5 lines
Quoted 1 line

greg k-h

Yes, I did. The code is correct. Checkpatch now reports "Alignment should match open parenthesis" CHECK, which is obviously better than original WARNING.

Really? No, it's much worse. Indentation should be obvious when looking at the code, right now this is just so wrong it hurts my brain to look at (seriously, coding style is there for your brain, not because we are crazy picky developers.)

Also you forgot a trailing ';' did that even compile?

thanks,

greg k-h

maintainer
#6 lore raw

Re: [PATCHv2] staging: wlan-ng: fix avoid multiple line dereference warning reported by checkpatch.pl

In reply to Andrii
Quoted 12 lines · Andrii

Fixed three code style warnings (multiple line dereference) reported by checkpatch.pl script.

drivers/staging/wlan-ng/hfa384x_usb.c +0 -0
index 6134eba..a050748 100644
@@ -1346,14 +1346,8 @@ hfa384x_docmd(struct hfa384x *hw,
 	} else if (mode == DOWAIT) {
 		struct usbctlx_cmd_completor completor;
 

drivers/staging/wlan-ng/hfa384x_usb.c hfa384x_docmd(struct hfa384x *hw, · line 1350

Quoted 10 lines
drivers/staging/wlan-ng/hfa384x_usb.c +2 -8
-		result =
-		    hfa384x_usbctlx_complete_sync(hw, ctlx,
-						  init_cmd_completor(&completor,
-								     &ctlx->
-								     inbuf.
-								     cmdresp,
-								     &cmd->
-								     result));
+		result = hfa384x_usbctlx_complete_sync(hw, ctlx,
+	init_cmd_completor(&completor, &ctlx->inbuf.cmdresp, &cmd->result))

Ick, no, that doesn't look right, does it?

Please use your brain when making checkpatch changes, it's just a dumb perl script...

greg k-h