Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp660909pxb; Thu, 23 Sep 2021 08:08:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbayQmnAT+nYLX/QgHmv9efcNM2ZHP5+Bdfo5F4k9eKGbZwMeWbwHJ8mgqwgIBZYi5v+G3 X-Received: by 2002:a50:e085:: with SMTP id f5mr6078393edl.9.1632409687567; Thu, 23 Sep 2021 08:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632409687; cv=none; d=google.com; s=arc-20160816; b=ZrkfTaSD+eDLsOkGGF2sdp0fKbHBh+y9GZN+d4R7QU1prDNMlC08gx4VxAfLymc8pH vG3aHUNuIxgfbA0BxC4o/rJ0WscyVQlt19T81Xm7eehjK/DIS00IKbOQSeqg3Lh3PNzV 3rw5borFT5vm+lsIi03oBwxSMrbRUDsHk1Pq897TeoUKqOh92iT+zDQCZilkOf/nZsI/ Hpjf6YsvIdJpFCHQuKarOpfALo/HjdLgNZ3ji+LLxhPSZvVCXCFNxLWMkyjezII28se2 ShNYiOX5PKXPzrMpF08J3ID9IS9Yskt7AesYm+8zoQydvVCICBde1SbPWbnJiCtVojIK yexw== 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; bh=3ZbsDHWaQvm2UIJDJowSvxXZP7RijYBYUTNOdmLBr2U=; b=UtFtlIrQsIebUH5EifQFvX/Dmo6MQpdhunCm7G+6cifLyWRy2PJcaGfQ+CUgvXUoxR J2EH+i3QNNKxyAwhf5hvdS92lAgsnBdTwVkZnilgXLJTu10wcn9a6gFIxsD+euAEQSIe pFXRFpzhZH1FipSodCqDAj8T6fr1GW1s4EIKIxZdAn2rQuGC9uj+SAi74VSTYA8tbJzs qQQa6ltXg02tDPpP9YySLUcN35NlDseZmFV2wztr8gR09REIzZmY7TpeCKiglnapMWek r3+6ObBWL/57CK16mNDLpwEI125Jx6m8lO1uSMHzmBA3DlqsLhhNXjOm/6ccYeBrPhQL V0ew== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si5331665ejl.627.2021.09.23.08.07.31; Thu, 23 Sep 2021 08:08:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241921AbhIWPHK (ORCPT + 99 others); Thu, 23 Sep 2021 11:07:10 -0400 Received: from muru.com ([72.249.23.125]:36530 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241792AbhIWPHK (ORCPT ); Thu, 23 Sep 2021 11:07:10 -0400 Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 5BDB980C0; Thu, 23 Sep 2021 15:06:06 +0000 (UTC) Date: Thu, 23 Sep 2021 18:05:36 +0300 From: Tony Lindgren To: Johan Hovold 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Johan Hovold [210923 12:50]: > On Tue, Sep 21, 2021 at 01:33:44PM +0300, Tony Lindgren wrote: > > +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? Hmm yeah we should at pm_runtime_get() and pm_runtime_put() to write() unless serial8250_rpm_get() and serial8250_rpm_put() are doing it. Or pair prep with finish and deal with the usage count there. Regards, Tony