From: Joe Perches Subject: Re: [RFC PATCH] slimbus: Linux driver framework for SLIMbus. Date: Wed, 24 Aug 2011 10:24:34 -0700 Message-ID: <1314206674.1659.66.camel@Joe-Laptop> References: <1313019091-15354-1-git-send-email-kheitke@codeaurora.org> <1314144826.1659.30.camel@Joe-Laptop> <201108241614.58800.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from wondertoys-mx.wondertoys.net ([206.117.179.246]:40339 "EHLO labridge.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752553Ab1HXRYg (ORCPT ); Wed, 24 Aug 2011 13:24:36 -0400 In-Reply-To: <201108241614.58800.arnd@arndb.de> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Arnd Bergmann Cc: Kenneth Heitke , davidb@codeaurora.org, bryanh@codeaurora.org, linux-arm-msm@vger.kernel.org, Sagar Dharia , rdunlap@xenotime.net, rmk+kernel@arm.linux.org.uk, john.stultz@linaro.org, akpm@linux-foundation.org, ohad@wizery.com, gregkh@suse.de, Stefan Richter 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_: > > slim_(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, ctrl, fmt, ...) \ > > slim_printk(KERN_, 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 _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 _. 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