Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1033631rwb; Fri, 23 Sep 2022 07:25:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74h2ma5/KmQIzGAoV3qrzaPUDx2Uh0IzREga5iSO+DkK2h42NfykKwYNsxHyWK9OSFEW+d X-Received: by 2002:a17:906:ef90:b0:77c:7227:705 with SMTP id ze16-20020a170906ef9000b0077c72270705mr7053757ejb.565.1663943113633; Fri, 23 Sep 2022 07:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663943113; cv=none; d=google.com; s=arc-20160816; b=ethG4MfrfxgC3jkEqs4lOiqFth4Aa1+GHokEbeTz7sYK+RC1bZ1jPIYHisb7K/zkb7 nsLE8qpG6NU0G8KfgXCZctQ6mij6SfCOsEzpFo2xk1GOU2pEq//JgIT7xhxKyX7gnFLv IoJfv+pDKtpjXYDG6pjvjAmlqEcj/G7XgvBFlwlAy4HzURcvf9UpXrw1AKUSHjOO2suN Ne4CyI4aJ7uSPNmSecPaK0Zhgg+hprExEDEC+9PGJ/eQtWzS5c6RcMcTtumCgx5CeIou wNdUysJFGTlXHBOojQOIf7TKmqaCzMnchxjSnPXLAsWnNOzzyaCA5HEX0jjA0m8dGH3N KiCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nX/6+loplHgFJT8kUh2DaZVIOlAUdD2TqBvnDdwr7aE=; b=kav6rxtnNHRhGaNatahpikCy/uilQGGW449JpNW0asFki1dCrJXSDzk5uczIpxKagZ bAPYdJiQODgOcepcT2NeVaeOP0pXpADZ+t4rUd+U6GepMucuHeXQBXPGtjf+FsDR3jiA lj9Gjx8m/fngoFyLBJkMnVZ4lIf3FhdjtNjTuaIqr4Y/DDtUOm3OReSGyDBWFlJInwAm STKgfOatvxzR2nKHtHxMmRzcu37rfrEL62YHZ3Gq1cw62uajGGNngR6904TQnlXU98LA 1JLcmqD3KdY795Wb5MdGmeLyt5BmVr6RVupM6gWD5+FlY8ye4hBNJ963QsOwSdcRYvQv akMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zO9vbyWN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kq9-20020a170906abc900b00741a19c2151si6814246ejb.625.2022.09.23.07.24.47; Fri, 23 Sep 2022 07:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zO9vbyWN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiIWN0g (ORCPT + 99 others); Fri, 23 Sep 2022 09:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232365AbiIWN0Q (ORCPT ); Fri, 23 Sep 2022 09:26:16 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F6B145CA6 for ; Fri, 23 Sep 2022 06:26:01 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id r7so28582wrm.2 for ; Fri, 23 Sep 2022 06:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=nX/6+loplHgFJT8kUh2DaZVIOlAUdD2TqBvnDdwr7aE=; b=zO9vbyWNjy0PacyXptByLwKcbKljVXwkFXuhRToBCZtT8PIHa0uRfUrvJKIgMWz7jA JcnS0OhBPVyZbHyeVsChSyOY1pqKb7s8IpQjeGcbDDIBEQIxD/C+53bPd97jui5U0vRB 2PG+9bAHes7ggkOd+bD7DCmcSIQdbfeM9diNNwBoZX4FvgZP+lDY1invPHhfPirpR8tc ZD3BG3l3hpJz8CyFCkArfZI1tXSQ51rCZ92nlMbQzhiLsVZv40yG/BrdiBzWWEdv3+Yq cBRcVRvCZFKs+Up2KLID+QGfVKkgmqyb6CudO6UfP9OcfKq87UmznWMjFqg6JBhXPUSi FY4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=nX/6+loplHgFJT8kUh2DaZVIOlAUdD2TqBvnDdwr7aE=; b=hRE2knvQe15l0QU8QPrr8r7cCe2oQDm9HoxmWwe3maCIEpT3GhvTG63YnvqZiUbRUK O/JN+/LonNJZkwZRZu75ZojwJp2DJQQ0xiOYqPrfoUawETPpcWiwyimOAC9DGioOZYuO IocIX0DiGiJGu4QLyE4ytde5Q7GvcAYQSxH3J3GnY6G6N68qsXAknkarSLZbTJVL5Uel Sl55ByHJ/BBc0Q/G2MuBG3iCiLSt8YFxoOTLN8j5ilo5kRWQoJOEWhO5oDBzw+lpxIlR HbobxLQotQuLXun4omryfLkxKOCDR2sOEl9gdt33f21+vmSuo9Jh1XuavgN6VJi//9+L 1s7Q== X-Gm-Message-State: ACrzQf1MWvTnIkk3Oext5c7f/uXgsT5hRJWDz+EdJzK5fMOwvOWfUhz5 8nKVk6YhG9eSooUgAfRCIIOJ7ZohnMfkusIB+K+cl+nGr1k= X-Received: by 2002:a5d:6d8e:0:b0:22a:4831:e0e with SMTP id l14-20020a5d6d8e000000b0022a48310e0emr4991454wrs.442.1663939560054; Fri, 23 Sep 2022 06:26:00 -0700 (PDT) MIME-Version: 1.0 References: <12079576.O9o76ZdvQC@kreacher> In-Reply-To: <12079576.O9o76ZdvQC@kreacher> From: Ulf Hansson Date: Fri, 23 Sep 2022 15:25:23 +0200 Message-ID: Subject: Re: [PATCH] PM: runtime: Return -EINPROGRESS from rpm_resume() in the RPM_NOWAIT case To: "Rafael J. Wysocki" Cc: Linux PM , Douglas Anderson , LKML , Alan Stern Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On Thu, 22 Sept 2022 at 20:04, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > The prospective callers of rpm_resume() passing RPM_NOWAIT to it may > be confused when it returns 0 without actually resuming the device > which may happen if the device is suspending at the given time and it > will only resume when the suspend in progress has completed. To avoid > that confusion, return -EINPROGRESS from rpm_resume() in that case. > > Since none of the current callers passing RPM_NOWAIT to rpm_resume() > check its return value, this change has no functional impact. Sounds like there are additional improvements that can be made around this, right? > > Signed-off-by: Rafael J. Wysocki Looks good to me! Reviewed-by: Ulf Hansson Kind regards Uffe > --- > drivers/base/power/runtime.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > Index: linux-pm/drivers/base/power/runtime.c > =================================================================== > --- linux-pm.orig/drivers/base/power/runtime.c > +++ linux-pm/drivers/base/power/runtime.c > @@ -792,10 +792,13 @@ static int rpm_resume(struct device *dev > DEFINE_WAIT(wait); > > if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) { > - if (dev->power.runtime_status == RPM_SUSPENDING) > + if (dev->power.runtime_status == RPM_SUSPENDING) { > dev->power.deferred_resume = true; > - else > + if (rpmflags & RPM_NOWAIT) > + retval = -EINPROGRESS; > + } else { > retval = -EINPROGRESS; > + } > goto out; > } > > > >