lkml.org 
[lkml]   [2020]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ttyprintk: optimize tpk_close flush code
On Tue, Nov 17, 2020 at 10:21:07AM +0800, Junyong Sun wrote:
> tpk_printk(NULL,0) do nothing but call tpk_flush to
> flush buffer, so why don't use tpk_flush diretcly?
> this is a small optimization.
>
> Signed-off-by: Junyong Sun <sunjunyong@xiaomi.com>
> ---
> changes in v2:
> - rm the flush comment as tpk_flush makes it obvious.
> ---
> ---
> drivers/char/ttyprintk.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
> index 6a0059e..1f82742 100644
> --- a/drivers/char/ttyprintk.c
> +++ b/drivers/char/ttyprintk.c
> @@ -103,8 +103,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp)
> unsigned long flags;
>
> spin_lock_irqsave(&tpkp->spinlock, flags);
> - /* flush tpk_printk buffer */
> - tpk_printk(NULL, 0);
> + tpk_flush();
> spin_unlock_irqrestore(&tpkp->spinlock, flags);

Why did you not make the change to tpk_printk() as well that I asked you
to?

It is a static function, you control the callers, so the extra "is this
NULL, if so flush" logic makes no sense to keep around anymore, right?

thanks,

greg k-h

\
 
 \ /
  Last update: 2020-11-17 08:05    [W:0.042 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site