Solving checkpatch error with lex

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Wed Dec 17 16:24:15 EST 2014


On Wed, 17 Dec 2014 19:10:24 +0000, karthik nayak said:

> The only reason I didn't do that is cause the file is too large to
> manually have a look at, even the diff tends to be very huge.

[/usr/src/linux-next] grep '//' drivers/staging/rtl8192u/r8192U_dm.c | wc -l
373

And why use lex when sed is up to the task?

 [/usr/src/linux-next] sed 's?//(.*)$?/* \1 */?' drivers/staging/rtl8192u/r8192U_dm.c >| /tmp/z99
sed: -e expression #1, char 19: invalid reference \1 on `s' command's RHS
1 [/usr/src/linux-next] sed 's?//\(.*\)$?/* \1 */?' drivers/staging/rtl8192u/r8192U_dm.c >| /tmp/z99
0 [/usr/src/linux-next] diff -u drivers/staging/rtl8192u/r8192U_dm.c /tmp/z99 | head -20
--- drivers/staging/rtl8192u/r8192U_dm.c        2014-11-20 16:18:35.941071156 -0500
+++ /tmp/z99    2014-12-17 16:22:42.831566630 -0500
@@ -21,9 +21,9 @@
 #include "r8190_rtl8256.h"
 #include "r819xU_cmdpkt.h"
 /*---------------------------Define Local Constant---------------------------*/
-//
-// Indicate different AP vendor for IOT issue.
-//
+/*  */
+/*  Indicate different AP vendor for IOT issue. */
+/*  */
 static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
                { 0x5e4322,     0x5e4322,       0x5e4322,       0x604322,       0xa44f,         0x5ea44f};
 static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
@@ -36,11 +36,11 @@


 /*------------------------Define global variable-----------------------------*/
-// Debug variable ?
0 [/usr/src/linux-next] diff -u drivers/staging/rtl8192u/r8192U_dm.c /tmp/z99 | wc -l
1960

2K lines isn't that hard to review, if the *only* thing you do is fix c99
comments.  I'd recommend it as *two* patches - one to do basically what your
lex code does and convert '// foo bar baz' to '/* foo bar baz */'

And then a *second* patch to fix block comments to   /*    *     */ form.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141217/44410b83/attachment.bin 


More information about the Kernelnewbies mailing list