From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752472AbZEVF1I (ORCPT ); Fri, 22 May 2009 01:27:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751412AbZEVF0z (ORCPT ); Fri, 22 May 2009 01:26:55 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:42624 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbZEVF0x (ORCPT ); Fri, 22 May 2009 01:26:53 -0400 Date: Fri, 22 May 2009 06:26:52 +0100 From: Al Viro To: Joe Perches Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, Dave Jones , Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , x86@kernel.org, Len Brown , Mike Travis , Rusty Russell , Thomas Gleixner , Venkatesh Pallipadi , Alan Cox Subject: Re: [PATCH V2 0/3] Introduce and use DO_ONCE statement expression macro Message-ID: <20090522052652.GX8633@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 21, 2009 at 09:27:29PM -0700, Joe Perches wrote: > The printk_once macro in kernel.h is limited to printk > > This generalizes the functionality of printk_once and > allows statements like DO_ONCE(pr_info("foo\n")) > and DO_ONCE(initialize(foo)); Sigh... Please, don't do introduce new control structures without extremely good reasons. printk_once() has syntax of function call; it's far more tolerable for casual reader (e.g. somebody looking through the code while trying to localize a bug) since it doesn't interrupt the flow - it parses as "some function call, apparently doing some debugging output, let's see if there are any obvious side effects in the arguments and move on". Your DO_ONCE(....) parses as "what the fuck is that?" followed by grepping for definition, and the cost is much higher. Don't do that. Staying close to normal syntax is a very good thing; preprocessor can be used in a lot of ways that are harmful and introduction of (effectively) new kinds of statements is a prime example. It *does* have its place, but it should be done very sparingly.