Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2714569iob; Mon, 16 May 2022 04:48:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIy3cK+Tp4IpxjZXkfnjywWixwo9samkQupDvKO8QXvue6zp8Syy9yt+nHOaTvJij3BRO3 X-Received: by 2002:a05:6402:b8f:b0:42a:be5d:7a94 with SMTP id cf15-20020a0564020b8f00b0042abe5d7a94mr675130edb.150.1652701700379; Mon, 16 May 2022 04:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652701700; cv=none; d=google.com; s=arc-20160816; b=IHViTUllqltZh513TdqpknT4mPWm/ArYy+W5sLbMQV5eYa/Ei0BpSGaAn5UlmGyFNB cG4Y852ZxtLi2G7FtNTfLeQPs5NuOCdtCht9TKL1qGREpkjCO3Qn/rhDsTSlUFPfaSNK w8ZNVlMFTHWo14sqmJVvF8ErKSUmFMbgLs7DnCet93nCRY2ecNylyCbKfljvRPIrf6iz j/yklVwrWajUpHjUGgWeMXYKeHlbFZnc+5pmyU7pbF4EiKnaowuB9CJ9uhKBsPusCShS Uh6kl/deAY/y/C52xq7fBfbdVwq+pB1OHX4jVF/JKy63M6JONLIMWadIINcpj4gEaAWB aeDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=f+gPMpnzEuE1lo/LHuKc1FpoHI7Zthw1RbS6wbpsxzw=; b=R6DP2IMCKV1gz3GP847xWLj1zL8YQGzjiq3n8iAi+gCfdnMUxuKQaCtcnTQbHvoTbf /iKb63rpcQ+Nj2CrQNtbgaabqiSaAxvBRUkV8IR54R+HVV8IiKx+PeNMGA+KSN6hd+UM jRt63+KeQTu7xupmpft97TualNlG6IEq0JwHjgXwgNjnncZBPWuy9bbDjq4h7No7igxm Ke81kx6OyzShCZblQ+o0WLv5quUHojS6+zRcxWcQe6iJiQ8QEeie1/yoFtdvy6VfN+Ja xy/qXWNFVFimfTpzJZacJUgQE2e02JjxdImFtmbkf6z2f+lE2/0KwUb1RFz7HfAB/ceH RjmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=gRHMRINT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a170906841200b006f45a8561cdsi8540834ejx.556.2022.05.16.04.47.54; Mon, 16 May 2022 04:48:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=gRHMRINT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241901AbiEPJUv (ORCPT + 99 others); Mon, 16 May 2022 05:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234385AbiEPJUf (ORCPT ); Mon, 16 May 2022 05:20:35 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF5526102; Mon, 16 May 2022 02:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652692829; x=1684228829; h=from:to:cc:subject:date:message-id; bh=f+gPMpnzEuE1lo/LHuKc1FpoHI7Zthw1RbS6wbpsxzw=; b=gRHMRINTY3zZdy0ADzNnvge4WuH8+VIi9pSuC46WtISUdK51uOG9QvY+ yaSAMS9Cj8p/cB6id8pHmv7dhkIJYV8SCNFxLVtnugIWYZn3HfU5gAwtN sJV6ZvQPPyjrp6p9JObM8hlcC1mWV5zaKCeCXhICGyTJa7ASqTekKzitB c=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 16 May 2022 02:20:28 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 16 May 2022 02:20:27 -0700 X-QCInternal: smtphost Received: from hu-vnivarth-hyd.qualcomm.com (HELO hu-sgudaval-hyd.qualcomm.com) ([10.213.111.166]) by ironmsg02-blr.qualcomm.com with ESMTP; 16 May 2022 14:50:14 +0530 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 3994820) id D4B3E3E54; Mon, 16 May 2022 14:50:13 +0530 (+0530) From: Vijaya Krishna Nivarthi To: gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: quic_msavaliy@quicinc.com, dianders@chromium.org, mka@chromium.org, swboyd@chromium.org, Vijaya Krishna Nivarthi Subject: [V4] serial: core: Do stop_rx in suspend path for console if console_suspend is disabled Date: Mon, 16 May 2022 14:50:10 +0530 Message-Id: <1652692810-31148-1-git-send-email-quic_vnivarth@quicinc.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the case of console_suspend disabled, if back to back suspend/resume test is executed, at the end of test, sometimes console would appear to be frozen not responding to input. This would happen because, during resume, rx transactions can come in before system is ready, malfunction of rx happens in turn resulting in console appearing to be stuck. Do a stop_rx in suspend sequence to prevent this. Signed-off-by: Vijaya Krishna Nivarthi --- v4: moved the change to serial core to apply for all drivers v3: swapped the order of conditions to be more human readable v2: restricted patch to contain only stop_rx in suspend sequence v1: intial patch contained 2 additional unrelated changes in vicinity --- drivers/tty/serial/serial_core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 82a1770..9a85b41 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2211,9 +2211,16 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) } put_device(tty_dev); - /* Nothing to do if the console is not suspending */ - if (!console_suspend_enabled && uart_console(uport)) + /* + * Nothing to do if the console is not suspending + * except stop_rx to prevent any asynchronous data + * over RX line. Re-start_rx, when required, is + * done by set_termios in resume sequence + */ + if (!console_suspend_enabled && uart_console(uport)) { + uport->ops->stop_rx(uport); goto unlock; + } uport->suspended = 1; -- Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by the Linux Foundation.