From nobody Sun Dec 14 06:16:02 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAAFEC00140 for ; Mon, 15 Aug 2022 19:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344033AbiHOTkX (ORCPT ); Mon, 15 Aug 2022 15:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245630AbiHOThe (ORCPT ); Mon, 15 Aug 2022 15:37:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D2431349; Mon, 15 Aug 2022 11:46:24 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id E57B9B81057; Mon, 15 Aug 2022 18:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 044B9C433C1; Mon, 15 Aug 2022 18:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589181; bh=+z29A/P3gfUa+DLcK1Cr+c4N/+VadkGSz84KoYlC+7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/clz9Ee3eI2cfG2ggRWs6SegMHv/6r87saS2tksE+qNPU5bs5gNhVEE6G8sy265W kjK7hOoDKFw0+AHvb8ufIzIG27lSbqgq9s8Z2vyw0SG8QF0WjPhyLZqJo7TJvGU6RG rH8PcwDaAojTyV3PJxYoj4VR4vVgT5i6VrAQPVZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Sherry Sun , Sasha Levin Subject: [PATCH 5.15 639/779] tty: serial: fsl_lpuart: correct the count of break characters Date: Mon, 15 Aug 2022 20:04:43 +0200 Message-Id: <20220815180404.666599482@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sherry Sun [ Upstream commit 707f816f25590c20e056b3bd4a17ce69b03fe856 ] The LPUART can't distinguish between a break signal and a framing error, so need to count the break characters if there is a framing error and received data is zero instead of the parity error. Fixes: 5541a9bacfe5 ("serial: fsl_lpuart: handle break and make sysrq work") Reviewed-by: Michael Walle Signed-off-by: Sherry Sun Link: https://lore.kernel.org/r/20220725050115.12396-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/fsl_lpuart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuar= t.c index 481107fdd69b..4155bd10711d 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -982,12 +982,12 @@ static void lpuart32_rxint(struct lpuart_port *sport) =20 if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) { if (sr & UARTSTAT_PE) { + sport->port.icount.parity++; + } else if (sr & UARTSTAT_FE) { if (is_break) sport->port.icount.brk++; else - sport->port.icount.parity++; - } else if (sr & UARTSTAT_FE) { - sport->port.icount.frame++; + sport->port.icount.frame++; } =20 if (sr & UARTSTAT_OR) @@ -1002,12 +1002,12 @@ static void lpuart32_rxint(struct lpuart_port *spor= t) sr &=3D sport->port.read_status_mask; =20 if (sr & UARTSTAT_PE) { + flg =3D TTY_PARITY; + } else if (sr & UARTSTAT_FE) { if (is_break) flg =3D TTY_BREAK; else - flg =3D TTY_PARITY; - } else if (sr & UARTSTAT_FE) { - flg =3D TTY_FRAME; + flg =3D TTY_FRAME; } =20 if (sr & UARTSTAT_OR) --=20 2.35.1