Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp540786pxb; Thu, 23 Sep 2021 05:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWLo2UHpCBIic239OD0xa+dTCM+x0EydBpOQEto649KgnNcfT19PUG2EaVJrcBRa3RND3j X-Received: by 2002:a05:6638:2405:: with SMTP id z5mr3851739jat.124.1632401521770; Thu, 23 Sep 2021 05:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632401521; cv=none; d=google.com; s=arc-20160816; b=kbPosUxpYIO5PvvoE2gifhs85I+Wq+ZNDjwwophGNToCcyW+4CY6BpAKTIgjGL9ekA 66c6E2K9c/CcjgDBdkXzI5NQ3coBvdFGXjv2FLU1WatzOUxEvsl2Vw6h3cF9WBhUB/27 /9fpL68CNaTFm88oDqBaUOceKkDWqJUOrIpELDhRfO9qdmnSMqfO3/I0NrdM6v0gkd64 WRDIMtxP+tH/i9ycDEJkPC9PBTmFwIS0Oiillm2wkajNG5MmYv63VvEmDZ+0t2I0kcOV gHOKM7K1NEdlGjk9vfHSqh/nE2cHyBogb3fatqtQvt/2e3Sf/OJAB/tnzD3OW1P6tk0+ T0IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pf5wPCtQYIgfooidHjU4bT81Z0JOlFXv63PMxc7y6g4=; b=cyKwE+BKPiXOfbYclpDDnvVg1HsA9peoqzwc/wg5gp5WAX0EoAPSUt7OstZwYqEBgn 6VJL5hSQClMVJGPXiW273GfxejtIiJKl5xFd0GlFrFTMSoZNkDPAnbsBuGUCLUFb6dbj xQj7JzOuFDfIJGmtBLsTUBhv1gY98iPkusTgTWJ12r5hs3K2aYzaR+7utJ6TqHThcyYs JxhrjECfYqZhChQKwDm9C+dp5xMRsJrsAZr9+tHTAwfgtn2+AMYRFmXq53CVUtoeKdcK y1/KFpV0IdXfgHQ6+CS4kziPAjjKupav0VZ/wnO+xQAHw1cyy3p/KlM92hBHBXU+4Dk1 8+tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bKNWDjKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p31si7704691jac.95.2021.09.23.05.51.47; Thu, 23 Sep 2021 05:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bKNWDjKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241091AbhIWMva (ORCPT + 99 others); Thu, 23 Sep 2021 08:51:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:54702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241000AbhIWMv3 (ORCPT ); Thu, 23 Sep 2021 08:51:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3635C60FE6; Thu, 23 Sep 2021 12:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632401398; bh=UMepoSpw7A+fESNgPq1gBYNpjtYbMA1QMXXCmUStQ3U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bKNWDjKpLU2Z+6/d4fxh7ogVZ1YAp7XG1nxQSQRqnw0VKsA4lEkI9FFIQO7UoBL5I a8Vo7cXHmO1XFBZXXhm3HbUGwu4DFj5QDsdt6xURSbmHkEBklLTo0iljMuMh/ymQeR v9uBBcudr05ppvzu3cJmUS6IZaQL2OC3RorhnGCrDjx2SCwPB9FL9O4gKfyQt0KEZ4 /Q8KRXQdP5pUpM8BX1IAB4O0AznADbVTmVdB8YAxo6f9onQZY2GvqsoAOsbnIC23y2 AO/YpreQjncm+0uU3TcfrdiwL8wTAlSquD4gHIJ6a1W2rsW9xZHSLiy/qXLBC/38jC qkCBkVwii28eQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1mTOAp-0001cS-Q2; Thu, 23 Sep 2021 14:49:59 +0200 Date: Thu, 23 Sep 2021 14:49:59 +0200 From: Johan Hovold To: Tony Lindgren Cc: Greg Kroah-Hartman , Andy Shevchenko , Jiri Slaby , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] serial: 8250: Implement prep_tx for power management Message-ID: References: <20210921103346.64824-1-tony@atomide.com> <20210921103346.64824-5-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210921103346.64824-5-tony@atomide.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 01:33:44PM +0300, Tony Lindgren wrote: > We can use the prep_tx() call to wake up an idle serial port. This allows > ust to remove the depedency to pm_runtime_irq_safe() for 8250_omap driver > in the following patches. > > Signed-off-by: Tony Lindgren > --- > drivers/tty/serial/8250/8250_port.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > 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 > @@ -1650,6 +1650,29 @@ static enum hrtimer_restart serial8250_em485_handle_start_tx(struct hrtimer *t) > return HRTIMER_NORESTART; > } > > +static int serial8250_prep_tx(struct uart_port *port) > +{ > + struct uart_8250_port *up = up_to_u8250p(port); > + struct device *dev = up->port.dev; > + int err; > + > + if (!(up->capabilities & UART_CAP_RPM)) > + return 0; > + > + if (!pm_runtime_suspended(dev)) { > + pm_runtime_mark_last_busy(dev); > + return 0; > + } > + > + err = pm_request_resume(dev); > + if (err < 0) { > + dev_warn(dev, "prep_tx wakeup failed: %d\n", err); > + return err; > + } How is this supposed to work without a runtime PM usage-counter increment? What's to prevent the port from suspending again while it's transmitting? > + > + return -EINPROGRESS; > +} Johan