Is there any tool can format source code according to kernel coding rule?

Rameshbabu p.rameshbabu at globaledgesoft.com
Mon Aug 3 05:51:36 EDT 2015


Hi , 

There is a script in kernel source tree which used to check the code is in the proper coding style. 
But I don't about automatically changing code to specific coding style. 

The script name called checkpatch.pl present in kernel tree scripts/ directory. 

If you want to use this script. 

Make it as executable, by giving 

chmod +x checkpatch.pl 

./checkpatch.pl --no-tree -f <file_name> 


This will tell you what are all the coding style you have missed. So you can format your code 
to coding style easily. 

Thanks, 
Ramesh 


From: "Aruna Hewapathirane" <aruna.hewapathirane at gmail.com> 
To: "Nan Xiao" <xiaonan830818 at gmail.com> 
Cc: "kernelnewbies" <kernelnewbies at kernelnewbies.org> 
Sent: Monday, August 3, 2015 10:30:47 AM 
Subject: Re: Is there any tool can format source code according to kernel coding rule? 

> Hi all, 
> 
> I am just wondering whether there is a script/tool which format source code 
> according to kernel coding rule automatically? Such as tab, space, brace, 
> etc. 
> 
> Thanks very much in advance! 
> 
> Best Regards 
> Nan Xiao 

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 http://www.vim.org/scripts/script.php?script_id=4369 will do the same. 


_______________________________________________ 
Kernelnewbies mailing list 
Kernelnewbies at kernelnewbies.org 
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150803/ec0366e6/attachment-0001.html 


More information about the Kernelnewbies mailing list