From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 356DEC2D0E4 for ; Tue, 17 Nov 2020 07:04:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C43E824248 for ; Tue, 17 Nov 2020 07:04:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="zWTiqqkx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbgKQHDr (ORCPT ); Tue, 17 Nov 2020 02:03:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:58678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgKQHDr (ORCPT ); Tue, 17 Nov 2020 02:03:47 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 364C3241A7; Tue, 17 Nov 2020 07:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605596626; bh=cRePH6Nm3raiXQTH7vJXeE6RGULZOaB6FuGTJ6mWU/o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zWTiqqkxLdREQx9EBE5d/pls6OCiksEky6lQTcOeAlNo1FZI6zmP3Yj23WHeOZfIE ADi95zcSVMwDOy11/ZrJkY+sS/orLBxb4FFZqD9M7ntwoQcqpfP9Mcu0Nhe63MCBko inMxYPi9pi5wyUSI+ng3628C0plETDvzOA4O716M= Date: Tue, 17 Nov 2020 08:04:35 +0100 From: Greg KH To: Junyong Sun Cc: arnd@arndb.de, sunjunyong@xiaomi.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] ttyprintk: optimize tpk_close flush code Message-ID: References: <1605579667-16573-1-git-send-email-sunjunyong@xiaomi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1605579667-16573-1-git-send-email-sunjunyong@xiaomi.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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