Re: [PATCH V2 0/3] Introduce and use DO_ONCE statement expression macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:

> On Thu, May 21, 2009 at 10:39:16PM -0700, Joe Perches wrote:
> > On Fri, 2009-05-22 at 06:26 +0100, Al Viro wrote:
> > > Your DO_ONCE(....) parses as "what the fuck is that?" followed by
> > > grepping for definition, and the cost is much higher.
> > 
> > So what do you suggest?
> > 
> > #define pr_info_once(fmt, args...)	printk_once(KERN_INFO pr_fmt(fmt), ##args)
> > #define pr_warning_once(fmt, args...)	printk_once(KERN_WARNING pr_fmt(fmt), ##args)
> > etc
> 
> That would be much saner.

Agreed.

The *_once() namespace meme is intuitive and easily understood, and 
we use it in a couple of places in the kernel and extend it on an 
as-needed basis for reoccuring (and boring and distracting) 
once-flag C code spam. We apply it to 'boring to begin with' 
constructs: printing a message or a warning, etc. So if a kernel 
coder sees a _once() or _ONCE() construct it can be assumed almost 
straight away that the code there is largely uninteresting from a 
code logic POV.

DO_ONCE() on the other hand is non-intuitive as it is a control 
structure that can be applied to _any_ code construct - interesting 
and uninteresting alike. For anything truly interesting that is not 
a kernel library/facility i dont want it to be hidden and abstracted 
away in 98% of the cases, i want to see the raw C form of it.

Otherwise we might as well write the kernel in C++.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux