mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Junyong Sun <sunjy516@gmail.com>
To: arnd@arndb.de, gregkh@linuxfoundation.org, sunjunyong@xiaomi.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2] ttyprintk: optimize tpk_close flush code
Date: Tue, 17 Nov 2020 10:21:07 +0800	[thread overview]
Message-ID: <1605579667-16573-1-git-send-email-sunjunyong@xiaomi.com> (raw)

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);
 
 	tty_port_close(&tpkp->port, tty, filp);
-- 
2.7.4


             reply	other threads:[~2020-11-17  2:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  2:21 Junyong Sun [this message]
2020-11-17  7:04 ` Greg KH
2020-11-28  6:33   ` 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=1605579667-16573-1-git-send-email-sunjunyong@xiaomi.com \
    --to=sunjy516@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sunjunyong@xiaomi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®