Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751659AbbEPRJc (ORCPT ); Sat, 16 May 2015 13:09:32 -0400 Received: from smtprelay0209.hostedemail.com ([216.40.44.209]:49285 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751177AbbEPRJ3 (ORCPT ); Sat, 16 May 2015 13:09:29 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:960:969:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3308:3353:3622:3865:3866:3867:3868:3871:3872:4250:4321:4605:5007:6261:7903:8700:10004:10400:10848:11026:11232:11658:11914:12517:12519:12740:13069:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: bee15_1855673ae0521 X-Filterd-Recvd-Size: 2392 Message-ID: <1431796166.15709.81.camel@perches.com> Subject: Re: [RFC] Refactor kenter/kleave/kdebug macros From: Joe Perches To: Leon Romanovsky Cc: dhowells@redhat.com, Linux-MM , "linux-kernel@vger.kernel.org" , linux-cachefs@redhat.com, linux-afs@lists.infradead.org Date: Sat, 16 May 2015 10:09:26 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1664 Lines: 39 On Sat, 2015-05-16 at 20:01 +0300, Leon Romanovsky wrote: > Dear David, > > During my work on NOMMU system (mm/nommu.c), I saw definition and > usage of kenter/kleave/kdebug macros. These macros are compiled as > empty because of "#if 0" construction. > 45 #if 0 > 46 #define kenter(FMT, ...) \ > 47 printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__) > 48 #define kleave(FMT, ...) \ > 49 printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__) > 50 #define kdebug(FMT, ...) \ > 51 printk(KERN_DEBUG "xxx" FMT"yyy\n", ##__VA_ARGS__) > 52 #else > 53 #define kenter(FMT, ...) \ > 54 no_printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__) > 55 #define kleave(FMT, ...) \ > 56 no_printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__) > 57 #define kdebug(FMT, ...) \ > 58 no_printk(KERN_DEBUG FMT"\n", ##__VA_ARGS__) > 59 #endif [] > My question is how we should handle such duplicated debug print code? > As possible solutions, I see five options: > 1. Leave it as is. > 2. Move it to general include file (for example linux/printk.h) and > commonize the output to be consistent between different kdebug users. > 3. Add CONFIG_*_DEBUG definition for every kdebug user. > 4. Move everything to "#if 0" construction. > 5. Move everything to "#if defined(__KDEBUG)" construction. 6: delete the macros and uses -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/