From: Greg KH <gregkh@linuxfoundation.org>
To: Junyong Sun <sunjy516@gmail.com>
Cc: arnd@arndb.de, sunjunyong@xiaomi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ttyprintk: optimize tpk_close flush code
Date: Thu, 12 Nov 2020 08:52:23 +0100 [thread overview]
Message-ID: <X6zptw9Fbd3AKbPy@kroah.com> (raw)
In-Reply-To: <1604469744-8708-1-git-send-email-sunjunyong@xiaomi.com>
On Wed, Nov 04, 2020 at 02:02:24PM +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>
> ---
> drivers/char/ttyprintk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
> index 6a0059e..2ce78b3 100644
> --- a/drivers/char/ttyprintk.c
> +++ b/drivers/char/ttyprintk.c
> @@ -104,7 +104,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp)
>
> spin_lock_irqsave(&tpkp->spinlock, flags);
> /* flush tpk_printk buffer */
> - tpk_printk(NULL, 0);
> + tpk_flush();
If you do this, then please remove the logic in tpk_flush() that handles
NULL as now that logic will not be needed at all, right?
Also the comment here wouldn't be needed as the code obviously does that
based on the function call being made :)
thanks,
greg k-h
next prev parent reply other threads:[~2020-11-12 7:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 6:02 [PATCH] ttyprintk: optimize tpk_close flush code Junyong Sun
2020-11-12 7:52 ` Greg KH [this message]
2020-11-12 13:41 ` sunjunyong
2020-11-12 17:17 ` Greg KH
2020-11-13 2:38 ` sunjunyong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X6zptw9Fbd3AKbPy@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sunjunyong@xiaomi.com \
--cc=sunjy516@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.