From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756922AbcKKRzJ (ORCPT ); Fri, 11 Nov 2016 12:55:09 -0500 Received: from smtprelay0242.hostedemail.com ([216.40.44.242]:43150 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756905AbcKKRzI (ORCPT ); Fri, 11 Nov 2016 12:55:08 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3871:3872:3874:4321:5007:6119:6261:6742:7875:9163:10004:10400:10848:10967:11026:11232:11473:11658:11914:12296:12438:12555:12740:12760:12986:13095:13439:14096:14097:14181:14659:14721:21080:21212:21433:21451:30054:30064:30079:30090:30091,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,LFtime:2,LUA_SUMMARY:none X-HE-Tag: rest45_81ffce5d48a3b X-Filterd-Recvd-Size: 3509 Date: Fri, 11 Nov 2016 12:54:51 -0500 From: Steven Rostedt To: Petr Mladek Cc: Linus Torvalds , Joe Perches , Andrew Morton , Sergey Senozhatsky , Jason Wessel , Jaroslav Kysela , Takashi Iwai , Chris Mason , Josef Bacik , David Sterba , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] printk/sound: Handle more message headers Message-ID: <20161111125451.611f40c7@gandalf.local.home> In-Reply-To: <1478695291-12169-5-git-send-email-pmladek@suse.com> References: <1478695291-12169-1-git-send-email-pmladek@suse.com> <1478695291-12169-5-git-send-email-pmladek@suse.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Nov 2016 13:41:31 +0100 Petr Mladek wrote: > The commit 4bcc595ccd80decb4245096e ("printk: reinstate KERN_CONT for > printing continuation lines") allows to define more message headers > for a single message. The motivation is that continuous lines might > get mixed. Therefore it make sense to define the right log level > for every piece of a cont line. > > This patch allows to copy only the real message level. We should > ignore KERN_CONT because is added for each message. > By other words, we want to know where each piece of the line comes > from. > > Signed-off-by: Petr Mladek > --- > sound/core/misc.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/sound/core/misc.c b/sound/core/misc.c > index f2e8226c88fb..45f03b1d4102 100644 > --- a/sound/core/misc.c > +++ b/sound/core/misc.c > @@ -71,6 +71,7 @@ void __snd_printk(unsigned int level, const char *path, int line, > int kern_level; > struct va_format vaf; > char verbose_fmt[] = KERN_DEFAULT "ALSA %s:%d %pV"; > + bool level_found = false; > #endif > > #ifdef CONFIG_SND_DEBUG > @@ -83,15 +84,22 @@ void __snd_printk(unsigned int level, const char *path, int line, > vaf.fmt = format; > vaf.va = &args; > > - kern_level = printk_get_level(format); > - if (kern_level) { > - const char *end_of_header = printk_skip_level(format); > - memcpy(verbose_fmt, format, end_of_header - format); > + while ((kern_level = printk_get_level(vaf.fmt)) != 0) { > + const char *end_of_header = printk_skip_level(vaf.fmt); > + > + /* Ignore KERN_CONT. We print filename:line for each piece. */ > + if (kern_level >= '0' || kern_level <= '7') { Again, the above is always true. -- Steve > + memcpy(verbose_fmt, vaf.fmt, end_of_header - vaf.fmt); > + level_found = true; > + } > + > vaf.fmt = end_of_header; > - } else if (level) > + } > + > + if (!level_found && level) > memcpy(verbose_fmt, KERN_DEBUG, sizeof(KERN_DEBUG) - 1); > - printk(verbose_fmt, sanity_file_name(path), line, &vaf); > > + printk(verbose_fmt, sanity_file_name(path), line, &vaf); > #else > vprintk(format, args); > #endif