[PATCH 00/49] staging: Convert printk(KERN_<LEVEL> to pr_<level>

Greg KH greg at kroah.com
Thu Oct 15 02:09:48 UTC 2009


On Wed, Oct 14, 2009 at 06:53:44PM -0700, Joe Perches wrote:
> Where appropriate:
> Use #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt or
>     #define pr_fmt(fmt) "some prefix: " fmt
> Remove prefixes
> Remove direct function names and use %s...__func__
> Convert __FUNCTION__ to __func__
> Convert some printks to pr_cont
> Convert printk(KERN_<LEVEL> to pr_<level>(
> Integrated long strings
> 
> Did not do much conversions of bare printks
> 
> Some of these are uncompiled and all of them
> are untested.
> 
> Mostly done via a perl script and some emacs macros:
> 
> $ for file in $(find drivers/staging -name "*.[ch]") ; do \
>   perl -i -e ' \
>        local $/; \
>        while (<>) { \
>          s@\bprintk\s*\(\s*KERN_(INFO|WARNING|ERR|ALERT|CRIT|EMERG|NOTICE)\s*@pr_\L$1\(@g; \
>        	 s@\b(pr_[^;]+)\"\s*\n\s*\"@$1 at g; \
>        	 s@\b(pr_[^;]+)\"\s*\n\s*\"@$1 at g; \
>        	 s@\b(pr_[^;]+)\"\s*\n\s*\"@$1 at g; \
>        	 print; \
>        }' $file ; \
> done

I hate patches done by scripts, as they usually are wrong.  Like these
:(

Please, convert the majority of these calls to the proper dev_printk()
type calls (dev_info, dev_dbg, etc.) and not use "raw" printk calls.

thanks,

greg k-h



More information about the devel mailing list