lkml.org 
[lkml]   [2011]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 11/11 re-post] dynamic_debug: use a single printk() to emit msgs
From
Date
On Mon, 2011-07-18 at 10:30 -0400, Jason Baron wrote:
> On Fri, Jul 15, 2011 at 04:46:31PM -0700, Joe Perches wrote:
> > On Fri, 2011-07-15 at 15:59 -0400, Jason Baron wrote:
> > > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> > > +#define LEFT(wrote) ((PREFIX_SIZE - wrote) > 0) ? (PREFIX_SIZE - wrote) : 0
[]
> > > + pos += snprintf(buf + pos, LEFT(pos), "%s", KERN_DEBUG);
> > > + if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
> > > if (in_interrupt())
> > > - snprintf(tid, sizeof(tid), "%s", "<intr> ");
> > > + pos += snprintf(buf + pos, LEFT(pos), "%s ",
> > > + "<intr>");
> > scnprintf works without using LEFT.
> > snprintf does as well.
> > http://lkml.org/lkml/2010/7/23/375
> So you're saying, just pass (PREFIX_SIZE - pos), as the second argument?

Yes.

> I see kernel code written both ways.

Perhaps one consistently used style is better than two.

> I think it's fine as written, unless you feel
> strongly about this.

You're the maintainer, do what you think best.

cheers, Joe



\
 
 \ /
  Last update: 2011-07-18 16:53    [W:0.040 / U:0.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site