Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1063722rda; Mon, 23 Oct 2023 00:49:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGl/hx65a7tkSile9pJw16rqFYh/UunvqAOwuCAUoxFUJN8VwfTD0b5Xjcm402UqCoWuWIz X-Received: by 2002:a17:90b:4d8c:b0:27d:2d2f:9ca2 with SMTP id oj12-20020a17090b4d8c00b0027d2d2f9ca2mr13866656pjb.24.1698047361857; Mon, 23 Oct 2023 00:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698047361; cv=none; d=google.com; s=arc-20160816; b=gJmLugOkeompbPLy/ApT9NWGB237bRy40ZTyK+vJ6w18qtoAgGAyxULfKjfl9eazu8 RJGz2T5CahW5W0mGnb/FQYWc2omn2MIPBVfGpQal4nzV2gs9Ug+8soU2W2VrZP69OeA4 qrAAXHiKLC13e89rqNU6yu5KDl3gDQDK0Q1ozePgXHHFqMpE86HotSr44Xq4HZb/QAyX v/7OkSj6FP4vsaat4CKuJVNOc+5k+1IVwnsDxaDrQg6a0ZrEjsFyc6HZMeymJG7ZPLJF qYVICtDGawW+G3fuWXKfVrV8XQYLE0TX1Dh0+dwqjgkrwqVQhyUFpQG2A1psvIHfKYYQ fRJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=r+AuavFRjcbgjMQBUkmAqd7LvGO4d3X4p09yK136U3o=; fh=F0FXFConMhJt7PftR7TWZaugQI0e8RDObg6aU8mCZoU=; b=YVEshu2HGc/OMewIOE+GiNQthYgphpfbuhFeYttLkXbqal+A907EbQXJTqV0HcqfgW aDgqe5SC4mDFQWO79wakSRGElHsHWhaRdIqYx3QZFKAgFGRErFdK1Ld6sPVnInMa2aSH OdiWRC7TvO84J3mwPSvlxLSF84KyRa/C14kvl6FuwaEhAQtfT8GiEqkr6XwnbxPuUqb0 H/99AoPQkPfaBLBLlx/+1cp+nH1JzBHSfVoYLWQd39C9D+1apS8Z9ro0nmZpTInibwCE NafGSox4DYwqbUyLz0ld91YL6h5YBsRMthSilP7dszpsVwdZWfwpPAljbRxhDlI4DGoK vYvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f20-20020a17090ac29400b002791b907f0csi8500172pjt.121.2023.10.23.00.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:49:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DEB7D804C201; Mon, 23 Oct 2023 00:49:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233427AbjJWHtN (ORCPT + 99 others); Mon, 23 Oct 2023 03:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233630AbjJWHtG (ORCPT ); Mon, 23 Oct 2023 03:49:06 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E2DED7F; Mon, 23 Oct 2023 00:49:05 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 17C5880BB; Mon, 23 Oct 2023 07:49:01 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Richard Purdie , Bruce Ashfield , Mikko Rapeli , Paul Gortmaker , Randy MacLeod Subject: [PATCH] serial: core: Fix runtime PM handling for pending tx Date: Mon, 23 Oct 2023 10:48:54 +0300 Message-ID: <20231023074856.61896-1-tony@atomide.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 00:49:20 -0700 (PDT) Richard reported that a serial port may end up sometimes with tx data pending in the buffer for long periods of time. Turns out we bail out early on any errors from pm_runtime_get(), including -EINPROGRESS. To fix the issue, we need to ignore -EINPROGRESS as we only care about the runtime PM usage count at this point. We check for an active runtime PM state later on for tx. Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") Reported-by: Richard Purdie Cc: Bruce Ashfield Cc: Mikko Rapeli Cc: Paul Gortmaker Cc: Randy MacLeod Signed-off-by: Tony Lindgren --- drivers/tty/serial/serial_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -146,7 +146,7 @@ static void __uart_start(struct uart_state *state) /* Increment the runtime PM usage count for the active check below */ err = pm_runtime_get(&port_dev->dev); - if (err < 0) { + if (err < 0 && err != -EINPROGRESS) { pm_runtime_put_noidle(&port_dev->dev); return; } -- 2.42.0