Skip to contentSkip to conversation

USB-CDC: Fix coding style issues

PATCH New vkuzmichev at mvista.com 3 participants 9 messages Sep 10, 2010 – Sep 20, 2010 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB-CDC: Fix coding style issues

From: Vitaly Kuzmichev <[email protected]>

Fixed most of checkpatch warnings and errors in USB gadget stack.

---
 drivers/usb/gadget/config.c       |    2 +-
 drivers/usb/gadget/epautoconf.c   |   73 ++++----
 drivers/usb/gadget/ether.c        |  385 ++++++++++++++++++-------------------
 drivers/usb/gadget/gadget_chips.h |   51 +++---
 drivers/usb/gadget/usbstring.c    |   42 ++--
 include/linux/usb/ch9.h           |    4 +-
 include/linux/usb/gadget.h        |   91 +++++-----
 7 files changed, 325 insertions(+), 323 deletions(-)
drivers/usb/gadget/config.c +1 -1
index 84c90f0..cf22629 100644
@@ -101,7 +101,7 @@ int usb_gadget_config_buf(
 	*cp = *config;
 
 	/* then interface/endpoint/class/vendor/... */
-	len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf,
+	len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf,
 			length - USB_DT_CONFIG_SIZE, desc);
 	if (len < 0)
 		return len;
drivers/usb/gadget/epautoconf.c +36 -37

170 lines not on this page · raw message

drivers/usb/gadget/ether.c +192 -193

996 lines not on this page · raw message

drivers/usb/gadget/gadget_chips.h +26 -25

171 lines not on this page · raw message

drivers/usb/gadget/usbstring.c +22 -20

80 lines not on this page · raw message

include/linux/usb/ch9.h +2 -2
index 1091692..49b7483 100644
@@ -69,8 +69,8 @@
 #define USB_RECIP_ENDPOINT		0x02
 #define USB_RECIP_OTHER			0x03
 /* From Wireless USB 1.0 */
-#define USB_RECIP_PORT 			0x04
-#define USB_RECIP_RPIPE 		0x05
+#define USB_RECIP_PORT			0x04
+#define USB_RECIP_RPIPE			0x05
 
 /*
  * Standard requests, for the bRequest field of a SETUP packet.
include/linux/usb/gadget.h +46 -45

280 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 USB-CDC: Fix coding style issues

Hi,

2010/9/10 <[email protected]>:

Quoted 19 lines

From: Vitaly Kuzmichev <[email protected]>

Fixed most of checkpatch warnings and errors in USB gadget stack.

---

?drivers/usb/gadget/config.c ? ? ? | ? ?2 +-
?drivers/usb/gadget/epautoconf.c ? | ? 73 ++++----
?drivers/usb/gadget/ether.c ? ? ? ?| ?385 ++++++++++++++++++-------------------
?drivers/usb/gadget/gadget_chips.h | ? 51 +++---
?drivers/usb/gadget/usbstring.c ? ?| ? 42 ++--
?include/linux/usb/ch9.h ? ? ? ? ? | ? ?4 +-
?include/linux/usb/gadget.h ? ? ? ?| ? 91 +++++-----

?7 files changed, 325 insertions(+), 323 deletions(-)

index 344fc78..cad2eeb 100644

include/linux/usb/gadget.h +0 -0
@@ -74,8 +74,9 @@ struct usb_ep;
Quoted 8 lines

?* Bulk endpoints can use any size buffers, and can also be used for interrupt ?* transfers. interrupt-only endpoints can be much less functional. ?*/
- ? ? ? // NOTE this is analagous to 'struct urb' on the host side,
- ? ? ? // except that it's thinner and promotes more pre-allocation.
+ ? ? ? /* NOTE this is analagous to 'struct urb' on the host side,
+ ? ? ? ?* except that it's thinner and promotes more pre-allocation.
+ ? ? ? ?*/

Multi-line comments should be like:
/*
* comment line 1
* comment line 2
*/

NOT:
/* comment line 1
* comment line 2
*/

Apart from that this patch looks good. Please fix globally.

Kind regards,

Remy

#2 lore raw

PATCH 1/1 USB-CDC: Fix coding style issues

Dear Remy Bohmer,

Quoted 2 lines · In message <[email protected]> you…

Apart from that this patch looks good. Please fix globally.

Hm... should we not rather try to keep (or bring) this file in sync with the corresponding current Linux header file?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It may be that our role on this planet is not to worship God but  to
create him."                                       - Arthur C. Clarke
#3 lore raw

PATCH 1/1 USB-CDC: Fix coding style issues

Hello,

Quoted 7 lines · Wolfgang Denk

Dear Remy Bohmer,

Quoted 1 line · In message <[email protected]> you…

Apart from that this patch looks good. Please fix globally.

Hm... should we not rather try to keep (or bring) this file in sync with the corresponding current Linux header file?

Yes, we should.
In linux this comment was moved into previous:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=41dceed51f0e6105ca2bf45c3835a7cd9eaa077b#patch3
I'm going to fix this and add more details in the header.

____
With best regards,
Vitaly Kuzmichev.

#4 lore raw

PATCH 1/1 USB-CDC: Fix coding style issues

In reply to Wolfgang Denk

Hi Wolfgang,

2010/9/11 Wolfgang Denk <[email protected]>:

Quoted 8 lines

Dear Remy Bohmer,

Quoted 2 lines · In message <[email protected]> you…

Apart from that this patch looks good. Please fix globally.

Hm... should we not rather try to keep (or bring) this file in sync with the corresponding current Linux header file?

Yes indeed. Where possible we should keep the files in sync. However in the USB gadget layer there are a few files for which it is difficult to keep them in sync with Linux. This header is not one of them...

Kind regards,

Remy

#5 lore raw

PATCH v2 1/1 USB-CDC: Fix coding style issues

In reply to vkuzmichev at mvista.com

From: Vitaly Kuzmichev <[email protected]>

Fixes most of checkpatch warnings and errors in USB gadget stack.

The most frequently encountered problems are:
1) "(foo*)", "foo * bar", "foo* bar"
2) C99 // comments
3) No spaces before/after/around '?', ':', '=', '==', ',', '&', '('
4) Spaces before '['
5) Spaces between function names and '('
6) Block braces in wrong places
7) Spaces before tabs
8) Macros with complex values not enclosed in parenthesis

---
 drivers/usb/gadget/config.c       |    2 +-
 drivers/usb/gadget/epautoconf.c   |   73 ++++----
 drivers/usb/gadget/ether.c        |  398 ++++++++++++++++++------------------
 drivers/usb/gadget/gadget_chips.h |   51 +++---
 drivers/usb/gadget/usbstring.c    |   48 +++--
 include/linux/usb/cdc.h           |   16 +-
 include/linux/usb/ch9.h           |    4 +-
 include/linux/usb/gadget.h        |  120 +++++------
 8 files changed, 352 insertions(+), 360 deletions(-)
drivers/usb/gadget/config.c +1 -1
index 84c90f0..cf22629 100644
@@ -101,7 +101,7 @@ int usb_gadget_config_buf(
 	*cp = *config;
 
 	/* then interface/endpoint/class/vendor/... */
-	len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf,
+	len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf,
 			length - USB_DT_CONFIG_SIZE, desc);
 	if (len < 0)
 		return len;
drivers/usb/gadget/epautoconf.c +36 -37

170 lines not on this page · raw message

drivers/usb/gadget/ether.c +199 -199

1,008 lines not on this page · raw message

drivers/usb/gadget/gadget_chips.h +26 -25

171 lines not on this page · raw message

drivers/usb/gadget/usbstring.c +27 -21

91 lines not on this page · raw message

include/linux/usb/cdc.h +8 -8
index 9b129c9..03541cb 100644
@@ -34,16 +34,16 @@
  * Class-Specific descriptors ... there are a couple dozen of them
  */
 
-#define USB_CDC_HEADER_TYPE		0x00		/* header_desc */
-#define USB_CDC_CALL_MANAGEMENT_TYPE	0x01		/* call_mgmt_descriptor */
-#define USB_CDC_ACM_TYPE		0x02		/* acm_descriptor */
-#define USB_CDC_UNION_TYPE		0x06		/* union_desc */
+#define USB_CDC_HEADER_TYPE		0x00	/* header_desc */
+#define USB_CDC_CALL_MANAGEMENT_TYPE	0x01	/* call_mgmt_descriptor */
+#define USB_CDC_ACM_TYPE		0x02	/* acm_descriptor */
+#define USB_CDC_UNION_TYPE		0x06	/* union_desc */
 #define USB_CDC_COUNTRY_TYPE		0x07
-#define USB_CDC_NETWORK_TERMINAL_TYPE	0x0a		/* network_terminal_desc */
-#define USB_CDC_ETHERNET_TYPE		0x0f		/* ether_desc */
+#define USB_CDC_NETWORK_TERMINAL_TYPE	0x0a	/* network_terminal_desc */
+#define USB_CDC_ETHERNET_TYPE		0x0f	/* ether_desc */
 #define USB_CDC_WHCM_TYPE		0x11
-#define USB_CDC_MDLM_TYPE		0x12		/* mdlm_desc */
-#define USB_CDC_MDLM_DETAIL_TYPE	0x13		/* mdlm_detail_desc */
+#define USB_CDC_MDLM_TYPE		0x12	/* mdlm_desc */
+#define USB_CDC_MDLM_DETAIL_TYPE	0x13	/* mdlm_detail_desc */
 #define USB_CDC_DMM_TYPE		0x14
 #define USB_CDC_OBEX_TYPE		0x15
 
include/linux/usb/ch9.h +2 -2
index 1091692..49b7483 100644
@@ -69,8 +69,8 @@
 #define USB_RECIP_ENDPOINT		0x02
 #define USB_RECIP_OTHER			0x03
 /* From Wireless USB 1.0 */
-#define USB_RECIP_PORT 			0x04
-#define USB_RECIP_RPIPE 		0x05
+#define USB_RECIP_PORT			0x04
+#define USB_RECIP_RPIPE			0x05
 
 /*
  * Standard requests, for the bRequest field of a SETUP packet.
include/linux/usb/gadget.h +53 -67

334 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#6 lore raw

PATCH v3 1/1 USB-CDC: Fix coding style issues

In reply to vkuzmichev at mvista.com

From: Vitaly Kuzmichev <[email protected]>

Fixes most of checkpatch warnings and errors in USB gadget stack.

The most frequently encountered problems are:
1) "(foo*)", "foo * bar", "foo* bar"
2) C99 // comments
3) No spaces before/after/around '?', ':', '=', '==', ',', '&', '('
4) Spaces before '['
5) Spaces between function names and '('
6) Block braces in wrong places
7) Spaces before tabs
8) Macros with complex values not enclosed in parenthesis
9) Multiline comments start just after /*

---
 drivers/usb/gadget/config.c       |    2 +-
 drivers/usb/gadget/epautoconf.c   |   73 +++---
 drivers/usb/gadget/ether.c        |  510 +++++++++++++++++++------------------
 drivers/usb/gadget/gadget_chips.h |   51 ++--
 drivers/usb/gadget/usbstring.c    |   48 ++--
 include/linux/usb/cdc.h           |   16 +-
 include/linux/usb/ch9.h           |    4 +-
 include/linux/usb/gadget.h        |  120 ++++-----
 8 files changed, 418 insertions(+), 406 deletions(-)
drivers/usb/gadget/config.c +1 -1
index 84c90f0..cf22629 100644
@@ -101,7 +101,7 @@ int usb_gadget_config_buf(
 	*cp = *config;
 
 	/* then interface/endpoint/class/vendor/... */
-	len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf,
+	len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf,
 			length - USB_DT_CONFIG_SIZE, desc);
 	if (len < 0)
 		return len;
drivers/usb/gadget/epautoconf.c +36 -37

170 lines not on this page · raw message

drivers/usb/gadget/ether.c +265 -245

1,277 lines not on this page · raw message

drivers/usb/gadget/gadget_chips.h +26 -25

171 lines not on this page · raw message

drivers/usb/gadget/usbstring.c +27 -21

91 lines not on this page · raw message

include/linux/usb/cdc.h +8 -8
index 9b129c9..03541cb 100644
@@ -34,16 +34,16 @@
  * Class-Specific descriptors ... there are a couple dozen of them
  */
 
-#define USB_CDC_HEADER_TYPE		0x00		/* header_desc */
-#define USB_CDC_CALL_MANAGEMENT_TYPE	0x01		/* call_mgmt_descriptor */
-#define USB_CDC_ACM_TYPE		0x02		/* acm_descriptor */
-#define USB_CDC_UNION_TYPE		0x06		/* union_desc */
+#define USB_CDC_HEADER_TYPE		0x00	/* header_desc */
+#define USB_CDC_CALL_MANAGEMENT_TYPE	0x01	/* call_mgmt_descriptor */
+#define USB_CDC_ACM_TYPE		0x02	/* acm_descriptor */
+#define USB_CDC_UNION_TYPE		0x06	/* union_desc */
 #define USB_CDC_COUNTRY_TYPE		0x07
-#define USB_CDC_NETWORK_TERMINAL_TYPE	0x0a		/* network_terminal_desc */
-#define USB_CDC_ETHERNET_TYPE		0x0f		/* ether_desc */
+#define USB_CDC_NETWORK_TERMINAL_TYPE	0x0a	/* network_terminal_desc */
+#define USB_CDC_ETHERNET_TYPE		0x0f	/* ether_desc */
 #define USB_CDC_WHCM_TYPE		0x11
-#define USB_CDC_MDLM_TYPE		0x12		/* mdlm_desc */
-#define USB_CDC_MDLM_DETAIL_TYPE	0x13		/* mdlm_detail_desc */
+#define USB_CDC_MDLM_TYPE		0x12	/* mdlm_desc */
+#define USB_CDC_MDLM_DETAIL_TYPE	0x13	/* mdlm_detail_desc */
 #define USB_CDC_DMM_TYPE		0x14
 #define USB_CDC_OBEX_TYPE		0x15
 
include/linux/usb/ch9.h +2 -2
index 1091692..49b7483 100644
@@ -69,8 +69,8 @@
 #define USB_RECIP_ENDPOINT		0x02
 #define USB_RECIP_OTHER			0x03
 /* From Wireless USB 1.0 */
-#define USB_RECIP_PORT 			0x04
-#define USB_RECIP_RPIPE 		0x05
+#define USB_RECIP_PORT			0x04
+#define USB_RECIP_RPIPE			0x05
 
 /*
  * Standard requests, for the bRequest field of a SETUP packet.
include/linux/usb/gadget.h +53 -67

334 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#7 lore raw

PATCH v3 1/1 USB-CDC: Fix coding style issues

Hello Remy,

vkuzmichev at mvista.com wrote:
[...]

drivers/usb/gadget/ether.c autoconf_fail: · line 1737

Quoted 4 lines
drivers/usb/gadget/ether.c +2 -1
-	/* use PKTSIZE (or aligned... from u-boot) and set
+	/*
+	 * use PKTSIZE (or aligned... from u-boot) and set
  	 * wMaxSegmentSize accordingly*/

Could you please fix the last line before commit? I missed this and would not like to spam more patches to the list.

____
With best regards,
Vitaly.

#8 lore raw

PATCH v3 1/1 USB-CDC: Fix coding style issues

Hi,

2010/9/13 Vitaly Kuzmichev <[email protected]>:

Quoted 11 lines

Hello Remy,

vkuzmichev at mvista.com wrote:
[...]

Quoted 4 lines

- ? ? /* use PKTSIZE (or aligned... from u-boot) and set
+ ? ? /*
+ ? ? ?* use PKTSIZE (or aligned... from u-boot) and set ? ? ? ?* wMaxSegmentSize accordingly*/

Could you please fix the last line before commit? I missed this and would not like to spam more patches to the list.

Fixed and applied to u-boot-usb (cdc)

Thanks.

Remy