On Tuesday, December 02, 2014 07:07:47 AM Joe Perches wrote: > net_<foo>_ratelimited uses the same form. > > include/linux/net.h:#define net_ratelimited_function(function, ...) > include/linux/net.h-do { > include/linux/net.h- if (net_ratelimit()) > include/linux/net.h- function(__VA_ARGS__); > include/linux/net.h-} while (0) > Yes, I see. There are representatives of both "schools". As counter example, netdev_<foo> uses "long" way: #define define_netdev_printk_level(func, level) \ void func(const struct net_device *dev, const char *fmt, ...) \ { \ struct va_format vaf; \ va_list args; \ \ va_start(args, fmt); \ \ vaf.fmt = fmt; \ vaf.va = &args; \ \ __netdev_printk(level, dev, &vaf); \ \ va_end(args); \ } \ EXPORT_SYMBOL(func); define_netdev_printk_level(netdev_emerg, KERN_EMERG); Problem with "short" way, it is hard to detect usage with side effect. Example from netfilter: if (dst_mtu(skb_dst(skb)) <= minlen) { net_err_ratelimited("unknown or invalid path-MTU (%u)\n", dst_mtu(skb_dst(skb))); Now, one need to remember that dst_mtu() can't have side effects. I agree it is bad practice to have non-trivial arguments in printk-like functions, but it is hard to detect, specifically if one just automatically replace function with its "ratelimited" version. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html