Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3712441pxb; Mon, 24 Jan 2022 16:05:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7sgjQugB2qh24UrozWJtlIcKctPuEQyscHtGiO+bTC9bScR60ej09LYzg5glktk9GDuZ3 X-Received: by 2002:a05:6a00:cca:b0:4c8:ffa7:5dfd with SMTP id b10-20020a056a000cca00b004c8ffa75dfdmr6787049pfv.86.1643069105248; Mon, 24 Jan 2022 16:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069105; cv=none; d=google.com; s=arc-20160816; b=GNOptj9ULvyqlCKLOX7jb0rUuPEpsFhddkhKl/kQp9043V4MOkj5WbmK4hhmIERIeo 77f+4muiWrqqsxGP6VjEbcFgXJJcCE4BfYtDPXCtbxrTw5M8VeF4bCeIIBuQS171xXo0 BAoEhucNpAfzv2VboAnTvoNPrQx1tkEI4UbY3SnJF0OjjLk8lRc8rpFCwb7r6blYQe96 DLw+V15CS9Hl0Wx85UYMfhkIkcZ2H973XyC7M/cJERW9JGXD6rWQS00bJ6lXVXDf3/Wk 0d9ziFxXQHhh5+dtdVIVRAEP0IQviOONH8qc1IDIqTcL6Ci5OG5h3Ur2Z3lHAEa2ccsg bSrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zsgDg0n4NNqG5H4UJ207Y6aJCTyHPUNYBJoG9o4ya/I=; b=0GhBOkyui1t0V67lBsh0oDdMz8gnHadxu9ORC11W0gP+niFosGzpDoFoF76FEECtww B6srjLJ+ZcEosw+UnBB57t3CfAoeLbRwnW6hMKt+cO670TcPe/h8lZYWcwV2HZakaovn 3sp2LXWvlcFKyBI/5G9Eg6RixgzNlkqlNov6Klu8O4wVPC2agDNFTr6Ffnb5SapNTYyx S+jxm8TspxdEta3KlBM1qXgnnFW80oyERiqGasGbTxLm5jyleI9MDsXGGJsLL2XJ/UA4 mRwGG+jQX3lS305KEJm9l7NJ+siSdgkbFNFwzLdzBXvnO+NaD9DJhXK7xqxNFNo0jivK u7tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HhtcIFzB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h190si6263575pge.868.2022.01.24.16.04.52; Mon, 24 Jan 2022 16:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HhtcIFzB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367947AbiAXX4z (ORCPT + 99 others); Mon, 24 Jan 2022 18:56:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846419AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAEEC0604D0; Mon, 24 Jan 2022 13:24:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD3DA61320; Mon, 24 Jan 2022 21:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FB5C340E4; Mon, 24 Jan 2022 21:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059453; bh=cdFXuFaCObFyYMFaICM/VLalkvjImrTRIgfaj6Fp60w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HhtcIFzBKrctYhB0946H0Efteh9tYp+NuxJYzBDVZP0FaB2DnzLf475y27Mnt5PDz +YXcN5Jvbdb0h2IKHCfc6ii0WRj2LgHdPLKXYx/J6X62gnG1e9UWZSUOhqWdxt4M6N 2eu/d/RjsI2Q41EJp7jSWePmrPxL31D1fT51khhU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Sasha Levin Subject: [PATCH 5.16 0588/1039] mxser: keep only !tty test in ISR Date: Mon, 24 Jan 2022 19:39:37 +0100 Message-Id: <20220124184145.101983897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Slaby [ Upstream commit 274ab58dc2b460cc474ffc7ccfcede4b2be1a3f5 ] The others are superfluous with tty refcounting in place now. And they are racy in fact: * tty_port_initialized() reports false for a small moment after interrupts are enabled. * closing is 1 while the port is still alive. The queues are flushed later during close anyway. So there is no need for this special handling. Actually, the ISR should not flush the queues. It should behave as every other driver, just queue the chars into tty buffer and go on. But this will be changed later. There is still a lot code depending on having tty in ISR (and not only tty_port). Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20211118073125.12283-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/mxser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 93a95a135a71a..27caa2f9ba79b 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -262,7 +262,6 @@ struct mxser_port { unsigned int xmit_head; unsigned int xmit_tail; unsigned int xmit_cnt; - int closing; spinlock_t slock; }; @@ -918,7 +917,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) return; if (tty_port_close_start(port, tty, filp) == 0) return; - info->closing = 1; mutex_lock(&port->mutex); mxser_close_port(port); mxser_flush_buffer(tty); @@ -927,7 +925,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) mxser_shutdown_port(port); tty_port_set_initialized(port, 0); mutex_unlock(&port->mutex); - info->closing = 0; /* Right now the tty_port set is done outside of the close_end helper as we don't yet have everyone using refcounts */ tty_port_close_end(port, tty); @@ -1683,7 +1680,7 @@ static bool mxser_port_isr(struct mxser_port *port) iir &= MOXA_MUST_IIR_MASK; tty = tty_port_tty_get(&port->port); - if (!tty || port->closing || !tty_port_initialized(&port->port)) { + if (!tty) { status = inb(port->ioaddr + UART_LSR); outb(port->FCR | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, port->ioaddr + UART_FCR); -- 2.34.1