From nobody Thu Jun 18 23:52:52 2026 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 4924DC433EF for ; Mon, 11 Apr 2022 11:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344261AbiDKLTR (ORCPT ); Mon, 11 Apr 2022 07:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233870AbiDKLTP (ORCPT ); Mon, 11 Apr 2022 07:19:15 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9121B427CF; Mon, 11 Apr 2022 04:17:01 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 4E7CB809F; Mon, 11 Apr 2022 11:14:28 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman Cc: Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Jiri Slaby , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Steffen Trumtrar , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCHv2] serial: 8250: Fix runtime PM for start_tx() for empty buffer Date: Mon, 11 Apr 2022 14:16:57 +0300 Message-Id: <20220411111657.16744-1-tony@atomide.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 932d596378b0 ("serial: 8250: Return early in .start_tx() if there are no chars to send") caused a regression where the drivers implementing runtime PM stopped idling. This is because serial8250_rpm_put_tx() is now unbalanced on early return, it normally gets called at __stop_tx(). Fixes: 932d596378b0 ("serial: 8250: Return early in .start_tx() if there ar= e no chars to send") Cc: Steffen Trumtrar Cc: Uwe Kleine-K=C3=B6nig Signed-off-by: Tony Lindgren Reviewed-by: Johan Hovold Reviewed-by: Uwe Kleine-K=C3=B6nig --- Changes since v1: - Call serial8250_rpm_get_tx() only after buffer empty test as suggested by Uwe and Johan - Drop RS885 related patch for now, it needs to be investigated further --- drivers/tty/serial/8250/8250_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1675,11 +1675,11 @@ static void serial8250_start_tx(struct uart_port *p= ort) struct uart_8250_port *up =3D up_to_u8250p(port); struct uart_8250_em485 *em485 =3D up->em485; =20 - serial8250_rpm_get_tx(up); - if (!port->x_char && uart_circ_empty(&port->state->xmit)) return; =20 + serial8250_rpm_get_tx(up); + if (em485 && em485->active_timer =3D=3D &em485->start_tx_timer) return; --=20 2.35.1