Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932560AbbFIXaw (ORCPT ); Tue, 9 Jun 2015 19:30:52 -0400 Received: from smtprelay0213.hostedemail.com ([216.40.44.213]:40200 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752246AbbFIXan (ORCPT ); Tue, 9 Jun 2015 19:30:43 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3871:3872:3873:4250:4321:5007:6119:6261:8660:9108:10004:10400:10848:10967:11026:11232:11473:11657:11658:11914:12043:12296:12438:12517:12519:12740:13148:13161:13229:13230:21060:21063: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: bomb64_5d42334ab8204 X-Filterd-Recvd-Size: 3083 Message-ID: <1433892639.2730.81.camel@perches.com> Subject: Re: [PATCH] [media] lmedm04: Neaten logging From: Joe Perches To: Mauro Carvalho Chehab Cc: Malcolm Priestley , linux-media@vger.kernel.org, linux-kernel Date: Tue, 09 Jun 2015 16:30:39 -0700 In-Reply-To: <20150609190749.56a1c6dd@recife.lan> References: <1432542547.2846.55.camel@perches.com> <20150609190749.56a1c6dd@recife.lan> 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: 2401 Lines: 69 On Tue, 2015-06-09 at 19:07 -0300, Mauro Carvalho Chehab wrote: > Hi Joe, Marhaba Mauro. > Em Mon, 25 May 2015 01:29:07 -0700 > Joe Perches escreveu: > > > Use a more current logging style. > > > > o Use pr_fmt > > o Add missing newlines to formats > > o Remove used-once lme_debug macro incorporating it into dbg_info > > o Remove unnecessary allocation error messages > > o Remove unnecessary semicolons from #defines > > o Remove info macro and convert uses to pr_info > > o Fix spelling of snippet > > o Use %phN extension > > There are a few checkpatch warnings: I hardly use checkpatch tbh The long lines I don't care about, I presume all the others are existing, but I'll run --fix on it and resubmit if you want. > > diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c [] > > /* debug */ > > static int dvb_usb_lme2510_debug; > > -#define lme_debug(var, level, args...) do { \ > > - if ((var >= level)) \ > > - pr_debug(DVB_USB_LOG_PREFIX": " args); \ > > +#define deb_info(level, fmt, ...) \ > > +do { \ > > + if (dvb_usb_lme2510_debug >= level) \ > > + pr_debug(fmt, ##__VA_ARGS__); \ > > } while (0) > > > The usage of both a debug level and pr_debug() is not nice, as, > if CONFIG_DYNAMIC_DEBUG is enabled (with is the case on most distros), > one needing to debug would need to both pass a debug level AND to enable > the debug line via sysfs, with is not nice. > We might of course remove debug levels as a hole and just use > pr_debug(), but the end result is generally worse (didn't chec > the specifics on this file). > > So, the better here would be to use printk like: > > #define deb_info(level, fmt, ...)\ > do { if (dvb_usb_lme2510_debug >= level)\ > printk(KERN_DEBUG pr_fmt(fmt), ## arg);\ > } while (0) > > Ok, this issue were already present on the old code, but IMHO the > best is to either use the above definition of deb_info() or to just > call pr_debug() and get rid of dvb_usb_lme2510_debug. Alternately, you could #define DEBUG and these would be enabled by default for CONFIG_DYNAMIC_DEBUG and act the same otherwise. -- 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/