printk: Modify operators of printed_len
PATCH 1/1 printk: Modify operators of printed_len
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.
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -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);
Signature · 1 line
1.7.9.5
Quoted 4 lines · Pierre Kuo
In
8b1742c9c207, we remove printk-recursion detection code invprintk_emit(), where it is the first place thatprinted_lencalculated. After removing above detection, it seems we can directly assign the result oflog_outputtoprinted_len.
[]
kernel/printk/printk.c
Quoted 1 line
kernel/printk/printk.c +0
-0
[]
kernel/printk/printk.c asmlinkage int vprintk_emit(int facility, int level, · line 1757
Quoted 6 lines
kernel/printk/printk.c +1
-1@@ -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.
hi Joe:
2017-07-08 1:12 GMT+08:00 Joe Perches <[email protected]>:
Quoted 12 lines · Pierre Kuo
Quoted 4 lines
In
8b1742c9c207, we remove printk-recursion detection code invprintk_emit(), where it is the first place thatprinted_lencalculated. After removing above detection, it seems we can directly assign the result oflog_outputtoprinted_len.[]
kernel/printk/printk.c
Quoted 1 line
kernel/printk/printk.c +0
-0[]
Quoted 4 lines
kernel/printk/printk.c +0
-0@@ -1754,7 +1754,7 @@ asmlinkage int vprintk_emit(int facility, int level,if (dict) lflags |=LOG_PREFIX |LOG_NEWLINE ;
Quoted 5 lines
kernel/printk/printk.c asmlinkage int vprintk_emit(int facility, int level, · line 1757
Quoted 2 lines
kernel/printk/printk.c +1
-1- 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_lenand 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.
Quoted 1 line · pierre kuo
hi Joe:
Hello Pierre.
Quoted 15 lines
2017-07-08 1:12 GMT+08:00 Joe Perches <[email protected]>:
Quoted 14 lines · Pierre Kuo
Quoted 4 lines
In
8b1742c9c207, we remove printk-recursion detection code invprintk_emit(), where it is the first place thatprinted_lencalculated. After removing above detection, it seems we can directly assign the result oflog_outputtoprinted_len.[]
kernel/printk/printk.c
Quoted 1 line
kernel/printk/printk.c +0
-0[]
Quoted 4 lines
kernel/printk/printk.c +0
-0@@ -1754,7 +1754,7 @@ asmlinkage int vprintk_emit(int facility, int level,if (dict) lflags |=LOG_PREFIX |LOG_NEWLINE ;
Quoted 8 lines
Quoted 5 lines
kernel/printk/printk.c asmlinkage int vprintk_emit(int facility, int level, · line 1757
Quoted 2 lines
kernel/printk/printk.c +1
-1- 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_lenand perhaps rename it too.I cannot quite understand the reason why need to rename.
printed_lenseems 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
hi Joe
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
[]
kernel/printk/printk.c
Quoted 1 line
kernel/printk/printk.c +0
-0[]
kernel/printk/printk.c asmlinkage int vprintk_emit(int facility, int level, · line 1757
Quoted 6 lines
kernel/printk/printk.c +1
-1@@ -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_lenand perhaps rename it too.
Quoted 7 lines
Quoted 2 lines
I cannot quite understand the reason why need to rename.
printed_lenseems meet the meaning we expect for here.Verbosity. To me, len would be adequate.
Anyway, the real point was the declaration of
printed_lencould remove the " = 0" as it's now only set once.
Got it and I will resend the patch again.
Appreciate your kind advice.