Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683305 > unrolled thread

[PATCH] printk: Modify operators of printed_len

Started byPierre Kuo <vichy.kuo@gmail.com>
First post2017-07-07 18:40 +0200
Last post2017-07-08 04:50 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] printk: Modify operators of printed_len Pierre Kuo <vichy.kuo@gmail.com> - 2017-07-07 18:40 +0200
    Re: [PATCH] printk: Modify operators of printed_len Joe Perches <joe@perches.com> - 2017-07-07 19:20 +0200
      Re: [PATCH] printk: Modify operators of printed_len pierre kuo <vichy.kuo@gmail.com> - 2017-07-07 22:40 +0200
        Re: [PATCH] printk: Modify operators of printed_len Joe Perches <joe@perches.com> - 2017-07-08 01:10 +0200
          Re: [PATCH] printk: Modify operators of printed_len pierre kuo <vichy.kuo@gmail.com> - 2017-07-08 04:50 +0200

#1683305 — [PATCH] printk: Modify operators of printed_len

FromPierre Kuo <vichy.kuo@gmail.com>
Date2017-07-07 18:40 +0200
Subject[PATCH] printk: Modify operators of printed_len
Message-ID<u0Esq-6Av-41@gated-at.bofh.it>
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.

Signed-off-by: Pierre Kuo <vichy.kuo@gmail.com>
---
 kernel/printk/printk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fc47863..16f3a61 100644
--- 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);
 
 	logbuf_unlock_irqrestore(flags);
 
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1683327

FromJoe Perches <joe@perches.com>
Date2017-07-07 19:20 +0200
Message-ID<u0F58-74W-3@gated-at.bofh.it>
In reply to#1683305
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.

[toc] | [prev] | [next] | [standalone]


#1683425

Frompierre kuo <vichy.kuo@gmail.com>
Date2017-07-07 22:40 +0200
Message-ID<u0IcG-Hi-7@gated-at.bofh.it>
In reply to#1683327
hi Joe:
2017-07-08 1:12 GMT+08:00 Joe Perches <joe@perches.com>:
> 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.

thanks for your friendly comment.

[toc] | [prev] | [next] | [standalone]


#1683459

FromJoe Perches <joe@perches.com>
Date2017-07-08 01:10 +0200
Message-ID<u0KxR-2tK-13@gated-at.bofh.it>
In reply to#1683425
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@perches.com>:
> > 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

[toc] | [prev] | [next] | [standalone]


#1683517

Frompierre kuo <vichy.kuo@gmail.com>
Date2017-07-08 04:50 +0200
Message-ID<u0NYJ-4Lr-5@gated-at.bofh.it>
In reply to#1683459
hi Joe
>> > []
>> > > 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.
Got it and I will resend the patch again.

Appreciate your kind advice.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web