Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753043AbdFLWSX (ORCPT ); Mon, 12 Jun 2017 18:18:23 -0400 Received: from smtprelay0075.hostedemail.com ([216.40.44.75]:59281 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752765AbdFLWSV (ORCPT ); Mon, 12 Jun 2017 18:18:21 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960: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:2693:2828:2892:2895:2896:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3871:4321:5007:6742:7576:7875:7901:10004:10400:10848:11026:11232:11473:11658:11914:12043:12291:12679:12683:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:21080:21433:21434:21451:21627:30012:30045:30054:30056:30064:30075:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: feet16_8281b3ff1060d X-Filterd-Recvd-Size: 3145 Message-ID: <1497305895.18751.1.camel@perches.com> Subject: Re: [PATCH v2 5/8] PM / sleep: Print timing information if debug is enabled From: Joe Perches To: "Rafael J. Wysocki" , Linux ACPI Cc: Linux PCI , Linux PM , Bjorn Helgaas , LKML , Mika Westerberg , Srinivas Pandruvada , Linux USB , Mathias Nyman , Felipe Balbi , Mario Limonciello , Andy Shevchenko , Dominik Brodowski , Hans De Goede , Alan Stern Date: Mon, 12 Jun 2017 15:18:15 -0700 In-Reply-To: <7222456.034JZvbkBs@aspire.rjw.lan> References: <8918199.uo13RZ8hZk@aspire.rjw.lan> <1615075.mBkoKApGGc@aspire.rjw.lan> <7222456.034JZvbkBs@aspire.rjw.lan> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 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: 1657 Lines: 53 On Mon, 2017-06-12 at 22:51 +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Avoid printing the device suspend/resume timing information if > CONFIG_PM_DEBUG is not set to reduce the log noise level. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/base/power/main.c | 4 ++++ > 1 file changed, 4 insertions(+) > > Index: linux-pm/drivers/base/power/main.c > =================================================================== > --- linux-pm.orig/drivers/base/power/main.c > +++ linux-pm/drivers/base/power/main.c > @@ -417,6 +417,7 @@ static void pm_dev_err(struct device *de > dev_name(dev), pm_verb(state.event), info, error); > } > > +#ifdef CONFIG_PM_DEBUG > static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info) > { > ktime_t calltime; > @@ -433,6 +434,9 @@ static void dpm_show_time(ktime_t startt > info ?: "", info ? " " : "", pm_verb(state.event), > usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC); > } > +#else > +static inline void dpm_show_time(ktime_t starttime, pm_message_t state, char *info) {} > +#endif /* CONFIG_PM_DEBUG */ > > static int dpm_run_callback(pm_callback_t cb, struct device *dev, > pm_message_t state, char *info) > trivia: This style of code can be reduced a few lines of code using a single definition. static type func(args...) { #ifdef CONFIG_ [code ...] #endif } and compilers will generate the same code for the !defined CONFIG_ case. This style can help avoid defects of updating one function definition and not the other and only compile testing the updated version.