<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi ,</div><div><br data-mce-bogus="1"></div><div>There is a script in kernel source tree which used to check the code is in the proper coding style.</div><div>But I don't about automatically changing code to specific coding style.</div><div><br data-mce-bogus="1"></div><div>The script name called checkpatch.pl present in kernel tree scripts/ directory.</div><div><br data-mce-bogus="1"></div><div>If you want to use this script.</div><div><br data-mce-bogus="1"></div><div>Make it as executable, by giving</div><div><br data-mce-bogus="1"></div><div>chmod +x checkpatch.pl</div><div><br data-mce-bogus="1"></div><div>./checkpatch.pl --no-tree -f <file_name></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>This will tell you what are all the coding style you have missed. So you can format your code </div><div>to coding style easily.</div><div><br data-mce-bogus="1"></div><div>Thanks,</div><div>Ramesh</div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"Aruna Hewapathirane" <aruna.hewapathirane@gmail.com><br><b>To: </b>"Nan Xiao" <xiaonan830818@gmail.com><br><b>Cc: </b>"kernelnewbies" <kernelnewbies@kernelnewbies.org><br><b>Sent: </b>Monday, August 3, 2015 10:30:47 AM<br><b>Subject: </b>Re: Is there any tool can format source code according to kernel coding rule?<br></div><div><br></div><div data-marker="__QUOTED_TEXT__"><div dir="ltr">> Hi all,<br>><br>> I am just wondering whether there is a script/tool which format source code<br>> according to kernel coding rule automatically? Such as tab, space, brace,<br>> etc. <br>><br>> Thanks very much in advance!<br>><br>> Best Regards<br>> Nan Xiao<br><br>If your using vi(m) in command mode type gg=G this will indent your code . if your want kernel coding rules compatibility run your code through scripts/Lindent. There is a vim plugi-in <a href="http://www.vim.org/scripts/script.php?script_id=4369" target="_blank" data-mce-href="http://www.vim.org/scripts/script.php?script_id=4369">http://www.vim.org/scripts/script.php?script_id=4369</a> will do the same.<br><br></div><br>_______________________________________________<br>Kernelnewbies mailing list<br>Kernelnewbies@kernelnewbies.org<br>http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies<br></div></div></body></html>