Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1189717rwb; Thu, 22 Sep 2022 11:17:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CGa0ck3uq5+euT6R+n+7y7xmbGo1AUPtFxRrm3SXOGeL3mhLjWocwcefE7TCD+0VrMWm2 X-Received: by 2002:a63:5a63:0:b0:42f:e143:80d4 with SMTP id k35-20020a635a63000000b0042fe14380d4mr4205759pgm.456.1663870652063; Thu, 22 Sep 2022 11:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663870652; cv=none; d=google.com; s=arc-20160816; b=vHq1qe3fTsl43C25LT5DOYDpyFbib7HLiQE+OXV+0lls4DMLHglDL+PHglYZYKw3db 831cPNDrK4Zh06BPU5fPS7Nu3tC/SAXVWTRi/y8owx4uNmtN+FXmRqeSVGYhbn9ipIPv 2hVRkv8Qre9KCLWgh26NpWkFMRR+TLzO1Zg1AVzC1hNP83LN8VCgHpttnoYiv5u4jI9E 3TLwT1D8xO9lus+zsmpEulURaHqeYmuysSNWfK68p3sBwB++8//qYQUTD9Qewrffkbwv vXy6+fM73sbGl//EHtDmNrLKlxaCIJxY1OhiGs1x81EY3+c2znaKikrczXggkmGlGjqI Gpqw== 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=LTPdCNlsV+sDrdd5vM3x4rhd45x9deZcKuBFPG/4a1g=; b=aCdWhQlj4aE4Poj0cPwITUTVRw1dNFADVZ1+QACjj3TGlPdz/G5strRVYJFBgLJYMu Jq17phuvSPAT75XDD8QuV+n6vw7NJq5n9fB5yG9uwKePzeF487hKyxgT3XxUJGWB1eFn rFyDLmZJQaGYJQ9rGmuLWUcKzxVhlUOT7u8u6hnk7S8sLw0tlOQfYFFrdN/AHTtAQMO1 q6GNQrQKr7qlhsI/hIQE3n8FNJfyw1OLhUMTKh1vl9Oq4Eisj9eMT+rlDQa3udAmhS8/ fMlXAGwfJM+PT4ngz08H90IxFIfIpgZgSFS2o56ahgowJ4mJGi76pZN1PdlVub81p8I2 rF3w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu11-20020a056a00410b00b0052e6c99a571si6686312pfb.323.2022.09.22.11.17.19; Thu, 22 Sep 2022 11:17:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231771AbiIVSFU (ORCPT + 99 others); Thu, 22 Sep 2022 14:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbiIVSFB (ORCPT ); Thu, 22 Sep 2022 14:05:01 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CEC452E75; Thu, 22 Sep 2022 11:04:43 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id d810c28a7d9b3634; Thu, 22 Sep 2022 20:04:41 +0200 Received: from kreacher.localnet (unknown [213.134.188.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id D931566D661; Thu, 22 Sep 2022 20:04:40 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: Douglas Anderson , LKML , Alan Stern , Ulf Hansson Subject: [PATCH] PM: runtime: Return -EINPROGRESS from rpm_resume() in the RPM_NOWAIT case Date: Thu, 22 Sep 2022 20:04:40 +0200 Message-ID: <12079576.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.188.178 X-CLIENT-HOSTNAME: 213.134.188.178 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefgedgiedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppedvudefrddufeegrddukeekrddujeeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekkedrudejkedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopeguihgrnhguvghrshestghhrhhomhhiuhhmrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhtvghrnhesrhhofihlrghnugdrhhgrrhhvrghrugdrvgguuhdprhgtphhtthho pehulhhfrdhhrghnshhsohhnsehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 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. Signed-off-by: Rafael J. Wysocki --- 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; }