Re: [PATCH] printk: Modify operators of printed_len

From: Joe Perches
Date: Fri Jul 07 2017 - 19:04:56 EST


On Sat, 2017-07-08 at 04:32 +0800, pierre kuo wrote:
> hi Joe:

Hello Pierre.

> 2017-07-08 1:12 GMT+08:00 Joe Perches <joe@xxxxxxxxxxx>:
> > On Sat, 2017-07-08 at 00:30 +0800, Pierre Kuo wrote:
> > > In 8b1742c9c207, we remove printk-recursion detection code in
> > > vprintk_emit(), where it is the first place that printed_len calculated.
> > > After removing above detection, it seems we can directly assign the
> > > result of log_output to printed_len.
> >
> > []
> > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> >
> > []
> > > @@ -1754,7 +1754,7 @@ asmlinkage int vprintk_emit(int facility, int level,
> > > if (dict)
> > > lflags |= LOG_PREFIX|LOG_NEWLINE;
> > >
> > > - printed_len += log_output(facility, level, lflags, dict, dictlen, text, text_len);
> > > + printed_len = log_output(facility, level, lflags, dict, dictlen, text, text_len);
> >
> > If this is appropriate, this should also remove the
> > initialization of printed_len and perhaps rename it too.
>
> I cannot quite understand the reason why need to rename.
> printed_len seems meet the meaning we expect for here.

Verbosity. To me, len would be adequate.

Anyway, the real point was the declaration of printed_len could
remove the " = 0" as it's now only set once.

cheers, Joe