[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101020174846.GA22819@ericsson.com>
Date: Wed, 20 Oct 2010 10:48:46 -0700
From: Guenter Roeck <guenter.roeck@...csson.com>
To: Joe Perches <joe@...ches.com>
CC: Jean Delvare <khali@...ux-fr.org>,
Hans de Goede <j.w.r.degoede@....nl>,
Alistair John Strachan <alistair@...zero.co.uk>,
Henrik Rydberg <rydberg@...omail.se>,
"Mark M. Hoffman" <mhoffman@...htlink.com>,
Luca Tettamanti <kronos.it@...il.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Juerg Haefliger <juergh@...il.com>,
Eric Piel <eric.piel@...mplin-utc.net>,
Jim Cromie <jim.cromie@...il.com>,
Roger Lucas <vt8231@...denengine.co.uk>,
"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers/hwmon: Use pr_fmt and pr_<level>
On Wed, Oct 20, 2010 at 01:28:20PM -0400, Joe Perches wrote:
> On Wed, 2010-10-20 at 10:18 -0700, Guenter Roeck wrote:
> > On Wed, Oct 20, 2010 at 12:54:20PM -0400, Joe Perches wrote:
> > > On Wed, 2010-10-20 at 09:49 -0700, Guenter Roeck wrote:
> > > > On Wed, Oct 20, 2010 at 11:59:23AM -0400,
> > > > Joe Perches wrote:
> > > > [ ... ]
> > > > > Anyway, I'd like to sort it out eventually.
> > > > > For now, I just add the #define pr_fmt, with
> > > > > a long term goal of removing them all and using
> > > > > a different mechanism to remove the duplicated
> > > > > prefix string altogether from the formats and
> > > > > save some text.
> > > > I don't mind individual pr_fmt defines as long as they are used.
> > > > However, that is not the case in many of the patches.
> > > > Just adding a pr_fmt define to a file without using it doesn't make sense to me.
> > > kernel.h has the equivalent of:
> > > #define pr_<level>(fmt, arg...) printk(KERN_<level> pr_fmt(fmt), ##arg)
> > >
> > And no one minds that there are literally hundreds of equivalent defines
> > for pr_fmt in the code, and even more conflicting ones ? Odd.
> >
> > Maybe the following in kernel.h would make more sense.
> >
> > #ifndef pr_fmt
> > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > #endif
> >
> > At least it would make more sense than littering source files with pr_fmt definitions.
> > If that doesn't fly, I would prefer to stick with the existing default definition in kernel.h.
>
> That would give you no prefix at all and make the
> logging messages harder to distinguish.
>
Exactly my point.
> > At least that would give people an incentive to fix the problem in kernel.h (or in some other
> > central location) if they dislike the resulting missing module names.
>
> I don't think it flies for another year or two.
>
> $ grep -Prh --include=*.[ch] "define\s*pr_fmt" * | \
> perl -p -e 's/[ \t]+/ /g' | \
> sort | uniq -c | sort -rn
> 211 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 93 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
> 16 #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
> 16 #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
> 4 #define pr_fmt(fmt) "intc: " fmt
> 4 #define pr_fmt(fmt) "ep93xx " KBUILD_MODNAME ": " fmt
> 3 #define pr_fmt(fmt) "%s: " fmt, __func__
> 3 #define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
> 2 #define pr_fmt(fmt) "gcov: " fmt
> 2 #define pr_fmt(fmt) fmt
> 2 #define pr_fmt(fmt) DRV_NAME ": " fmt
> 1 #define pr_fmt(fmt) "viod: " fmt
> 1 #define pr_fmt(fmt) "tboot: " fmt
> 1 #define pr_fmt(fmt) "(stll) :" fmt
> 1 #define pr_fmt(fmt) "(stk) :" fmt
> 1 #define pr_fmt(fmt) "(stc): " fmt
> 1 #define pr_fmt(fmt) "PMU: " fmt
> 1 #define pr_fmt(fmt) "pit: " fmt
> 1 #define pr_fmt(fmt) "phram: " fmt
> 1 #define pr_fmt(fmt) "PCI: " fmt
> 1 #define pr_fmt(fmt) "module %s: " fmt
> 1 #define pr_fmt(fmt) "mmiotrace: " fmt
> 1 #define pr_fmt(fmt) KBUILD_MODNAME " WATCHDOG: " fmt
> 1 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt /* Append 'batman-adv: ' before
> 1 #define pr_fmt(fmt) KBUILD_MODNAME " " fmt
> 1 #define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
> 1 #define pr_fmt(fmt) "isram: " fmt
> 1 #define pr_fmt(fmt) "hw perfevents: " fmt
> 1 #define pr_fmt(fmt) "hw-breakpoint: " fmt
> 1 #define pr_fmt(fmt) DRIVER_NAME ": " fmt
> 1 #define pr_fmt(fmt) "cxgb: " fmt
> 1 #define pr_fmt(fmt) "cn_test: " fmt
> 1 #define pr_fmt(fmt) "clock: " fmt
> 1 #define pr_fmt(fmt) "acerhdf: " fmt
>
The modified define in kernel.org would only apply if pr_fmt isn't already defined,
so that argument is not really correct. The real difference would be that you could
then remove the individual pr_fmt defines from 211 files, and all users of pr_fmt
without module name (ie those hard to read) would be easier to read/identify.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists