On Wed, 2011-08-24 at 16:14 +0200, Arnd Bergmann wrote: > On Wednesday 24 August 2011, Joe Perches wrote: > > It might be reasonable to have slim specific macros/functions > > for message logging. That might allow slim specific prefixes. > > For functions, you could look at netdev_<level>: > > slim_<level>(struct slim_controller *ctrl, const char *fmt, ...) > > or macros like: > > #define slim_printk(level, ctrl, fmt, ...) \ > > dev_printk(level, &(ctrl)->dev, fmt, ##__VA_ARGS__) > > #define slim_<level>(level, ctrl, fmt, ...) \ > > slim_printk(KERN_<LEVEL>, ctrl, fmt, ##__VA_ARGS__) > > etc. > Hi Joe, Hi again Arnd. > My recommendation is always against such macros, and for using the > dev_* and pr_* macros directly. The reason is mostly so that a > causal reader with a kernel background can immediately understand > what they do, rather than having to look up extra macro definition, > e.g. to see if they add the newline character or not. Well, we have different opinions about this still. Subsystem specific logging functions or macros are a very common style in kernel code. Looking only for <foo>_warn(...) uses: $ grep -rPi --include=*.[ch] \ "^[\t ]*(#\s*define|(extern\s+|)(void|int))\s+[a-z0-9]+_warn(ing|)\s*\([^;}\)]*\.\.\." * | \ wc -l 132 There are at least a few benefits to subsystem specific uses of <foo>_<level>. When used as functions, they can reduce object size a considerable amount. They can also reduce the source code text when the dev pointer is a couple of structure indirections down. It's also easier to add/use/modify subsystem specific prefixes. cheers, Joe -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html