From patchwork Mon Apr 11 09:48:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 12808823 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 6D7AEC433EF for ; Mon, 11 Apr 2022 09:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344747AbiDKJvW (ORCPT ); Mon, 11 Apr 2022 05:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344780AbiDKJvO (ORCPT ); Mon, 11 Apr 2022 05:51:14 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 62EEF41FA8; Mon, 11 Apr 2022 02:48:35 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 446C1809F; Mon, 11 Apr 2022 09:45:38 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman Cc: Andy Shevchenko , Jiri Slaby , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, "Matwey V . Kornilov" , Steffen Trumtrar , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= Subject: [PATCH 1/2] serial: 8250: Fix runtime PM for start_tx() for RS485 Date: Mon, 11 Apr 2022 12:48:04 +0300 Message-Id: <20220411094805.45696-1-tony@atomide.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The early return from serial8250_start_tx() added by commit e490c9144cfa ("tty: Add software emulated RS485 support for 8250") failed to call serial8250_rpm_put_tx() that normally gets called on __stop_tx(). Likely this is a harmless issue as the RS485 using folks probably are not using runtime PM for the serial ports. Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250") Cc: Matwey V. Kornilov Cc: Steffen Trumtrar Cc: Uwe Kleine-König Signed-off-by: Tony Lindgren --- drivers/tty/serial/8250/8250_port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 @@ -1681,8 +1681,10 @@ static void serial8250_start_tx(struct uart_port *port) return; if (em485 && - em485->active_timer == &em485->start_tx_timer) + em485->active_timer == &em485->start_tx_timer) { + serial8250_rpm_put_tx(up); return; + } if (em485) start_tx_rs485(port); From patchwork Mon Apr 11 09:48:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 12808824 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 20033C433F5 for ; Mon, 11 Apr 2022 09:49:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344759AbiDKJv1 (ORCPT ); Mon, 11 Apr 2022 05:51:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344767AbiDKJvR (ORCPT ); Mon, 11 Apr 2022 05:51:17 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 23C084160B; Mon, 11 Apr 2022 02:48:38 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 3556C8191; Mon, 11 Apr 2022 09:45:42 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman Cc: Andy Shevchenko , 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_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , "Matwey V. Kornilov" Subject: [PATCH 2/2] serial: 8250: Fix runtime PM for start_tx() for empty buffer Date: Mon, 11 Apr 2022 12:48:05 +0300 Message-Id: <20220411094805.45696-2-tony@atomide.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220411094805.45696-1-tony@atomide.com> References: <20220411094805.45696-1-tony@atomide.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@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. We need to call serial8250_rpm_put_tx() on early exit, it normally gets called later on at __stop_tx(). Fixes: 932d596378b0 ("serial: 8250: Return early in .start_tx() if there are no chars to send") Cc: Steffen Trumtrar Cc: Uwe Kleine-König Signed-off-by: Tony Lindgren --- drivers/tty/serial/8250/8250_port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 @@ -1677,8 +1677,10 @@ static void serial8250_start_tx(struct uart_port *port) serial8250_rpm_get_tx(up); - if (!port->x_char && uart_circ_empty(&port->state->xmit)) + if (!port->x_char && uart_circ_empty(&port->state->xmit)) { + serial8250_rpm_put_tx(up); return; + } if (em485 && em485->active_timer == &em485->start_tx_timer) {