From mboxrd@z Thu Jan 1 00:00:00 1970 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 0B7D9E7B5E3 for ; Wed, 4 Oct 2023 10:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241094AbjJDKBd (ORCPT ); Wed, 4 Oct 2023 06:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241950AbjJDKB3 (ORCPT ); Wed, 4 Oct 2023 06:01:29 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11C929E; Wed, 4 Oct 2023 03:01:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 4819E80BD; Wed, 4 Oct 2023 10:01:25 +0000 (UTC) Date: Wed, 4 Oct 2023 13:01:23 +0300 From: Tony Lindgren To: Johan Hovold Cc: Maximilian Luz , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Dhruva Gole , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , John Ogness , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-omap@vger.kernel.org, Andy Shevchenko , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v12 1/1] serial: core: Start managing serial controllers to enable runtime PM Message-ID: <20231004100123.GH34982@atomide.com> References: <20230525113034.46880-1-tony@atomide.com> <62d3678a-a23d-4619-95de-145026629ba8@gmail.com> <20231003121455.GB34982@atomide.com> <20231003122137.GC34982@atomide.com> <20231004061708.GD34982@atomide.com> <20231004090320.GE34982@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Johan Hovold [231004 09:14]: > On Wed, Oct 04, 2023 at 12:03:20PM +0300, Tony Lindgren wrote: > > The serial port device and serdev device are siblings of the physical > > serial port controller device as seen in the hierarcy printed out by > > Maximilian. > > Yeah, and that's precisely the broken part. Keeping the serdev > controller active is supposed to keep the serial controller active. Your > serial core rework appears to have broken just that. Hmm OK good point, tx can currently have an extra delay if a serdev device is active, and the serial port controller device is not active. So we can check for active port->dev instead of &port_dev->dev though to know when when start_tx() is safe to do as below. Thanks. Tony 8< ----------------- diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 6207f0051f23d..defecc5b04422 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -156,7 +156,7 @@ static void __uart_start(struct uart_state *state) * enabled, serial_port_runtime_resume() calls start_tx() again * after enabling the device. */ - if (pm_runtime_active(&port_dev->dev)) + if (!pm_runtime_enabled(port->dev) || pm_runtime_active(port->dev)) port->ops->start_tx(port); pm_runtime_mark_last_busy(&port_dev->dev); pm_runtime_put_autosuspend(&port_dev->dev);