Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3385315pxb; Mon, 17 Jan 2022 19:16:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2zJ9gt9f4/4NMX57UQ+F5W+oyR/ovMe2HWB+RjIaFO85WlE9Yu3E59F+4U1788hwg5/ot X-Received: by 2002:a05:6a00:24d1:b0:4c1:f8f5:9f9c with SMTP id d17-20020a056a0024d100b004c1f8f59f9cmr21531237pfv.60.1642475764960; Mon, 17 Jan 2022 19:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475764; cv=none; d=google.com; s=arc-20160816; b=VvHrbxOBM1B0AD6+v3CGp7gnF78DEP23LLEvFVc4b6VE1pdGulPmvjwdid0kPMfkN1 mENzN2GxtnlBQm0rZXHsxrS49t7K6Rwva4rAs3C6GRe7IQxY9ROk0iD4NvkKqoOpjdY5 jDOIBA68KyELLPDEFJd4ReQ8rulavrkxn+yriO9bqJtkxFTTdBq1qv5Lzl2MmeJVbr7r Emg4yX3D5aXxWWPdH51dqu0hbj0SauCLOpANLGLer1KC76uQTs2UBXOhCCLLr5L/qegw sJ4uJv90GZHRf+e8vOgaPErh4zmgYiGdITl53yDx4XAo7xqhjyhWoiZtrPa/qS9F3lkc IuOw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zsgDg0n4NNqG5H4UJ207Y6aJCTyHPUNYBJoG9o4ya/I=; b=JIGV+fwb/4JADjlIbfhL6ogLDvyKMs9iYggG043rQIcg0W0eA3NX+EY/bLtMTSxEru CZ9wp+K0PERbLSuHyw1HJA03koN5Fx7ZH2sUFEAVdMrZ2Gj9jOqayuThepGOU4g1f9Kt bQXwHor/Z7KweeqWG/seIAcs8CLZ+aSQbFsSedZgF8YnxdZymaESfX/cWxzGkj61cLaa HSgEEnejg/6eQza3BjUVku4no5VyYo9BA2vKltWx2/+SxD1C1f66JZvdUW33gDXdmVyI YVZuwldrFib3sIayCJeGajModw3qupcmlpF2u+3HR78JfKXsIe16F0bMml2i24Yb/LZc lPdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C2KpF+eb; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si7902173pgc.154.2022.01.17.19.15.53; Mon, 17 Jan 2022 19:16:04 -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=@kernel.org header.s=k20201202 header.b=C2KpF+eb; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245354AbiARCZS (ORCPT + 99 others); Mon, 17 Jan 2022 21:25:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245307AbiARCXa (ORCPT ); Mon, 17 Jan 2022 21:23:30 -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 D6B67C061751; Mon, 17 Jan 2022 18:23:22 -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 511D260AD6; Tue, 18 Jan 2022 02:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE68CC36AEF; Tue, 18 Jan 2022 02:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472601; bh=cdFXuFaCObFyYMFaICM/VLalkvjImrTRIgfaj6Fp60w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2KpF+ebQXeWwNhscNskuf4CVEt1dVsiOlb4tvNUAIfYfJWNrWKef4mLzLlD5L4XD rEKMExD38/ZJgLXcleY6X8JtnzYBEDXcmOhOVTKJs42dI99NwSOE+fd9UjbwdC2EMX MkJkKXWzswqZFqrmj7BFghD6AA26oq3s5AuTuqCe4fRB/hFGMoe93/oZ3TUkyYQOSE KG9gvLkQnrAjBq+p901jGscyDDk6ZKC+Rpaxgd+GXv9LUe0aaAaO8MtJlPxuNRudrM iJC+9kd3ZZ6B1vTTDA7zgaR6KFo+UchJcgxLJ599svTvTCAheByxW8JngYvGDIjXCn dYGKC8O0Ucc0Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jiri Slaby , Greg Kroah-Hartman , Sasha Levin , jirislaby@kernel.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.16 066/217] mxser: keep only !tty test in ISR Date: Mon, 17 Jan 2022 21:17:09 -0500 Message-Id: <20220118021940.1942199-66-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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