From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B396CC433F5 for ; Sat, 13 Nov 2021 14:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CAFE60F46 for ; Sat, 13 Nov 2021 14:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbhKMO1f (ORCPT ); Sat, 13 Nov 2021 09:27:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:44408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231672AbhKMO1e (ORCPT ); Sat, 13 Nov 2021 09:27:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C93460F46; Sat, 13 Nov 2021 14:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636813482; bh=hgKpwQGik/NP49mM2mMTOXcyZDElkRp+lv26AxDTDmY=; h=Subject:To:Cc:From:Date:From; b=SVRKywl+UXFlm1etTMXmAYJrmvXgiCRH1j1gYsmnYD2ftbPGcD9ZaArZ+0880MJbC ViY1BUKKaMCmyCG/K5z/NhFc+FTJLrBfLtN1Zdn/hfsM6xBdMzriQradyXyNgD0Mrf Eo5YUWNHarDNz8z1q61NhhD7SlLQ27P7izoL+4cM= Subject: FAILED: patch "[PATCH] PM: sleep: Do not let "syscore" devices runtime-suspend" failed to apply to 5.4-stable tree To: rafael.j.wysocki@intel.com, stable@vger.kernel.org, ulf.hansson@linaro.org Cc: From: Date: Sat, 13 Nov 2021 15:24:27 +0100 Message-ID: <163681346720264@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 928265e3601cde78c7e0a3e518a93b27defed3b1 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 22 Oct 2021 14:58:23 +0200 Subject: [PATCH] PM: sleep: Do not let "syscore" devices runtime-suspend during system transitions There is no reason to allow "syscore" devices to runtime-suspend during system-wide PM transitions, because they are subject to the same possible failure modes as any other devices in that respect. Accordingly, change device_prepare() and device_complete() to call pm_runtime_get_noresume() and pm_runtime_put(), respectively, for "syscore" devices too. Fixes: 057d51a1268f ("Merge branch 'pm-sleep'") Signed-off-by: Rafael J. Wysocki Cc: 3.10+ # 3.10+ Reviewed-by: Ulf Hansson diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index cbea78e79f3d..fca6eab871fc 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1051,7 +1051,7 @@ static void device_complete(struct device *dev, pm_message_t state) const char *info = NULL; if (dev->power.syscore) - return; + goto out; device_lock(dev); @@ -1081,6 +1081,7 @@ static void device_complete(struct device *dev, pm_message_t state) device_unlock(dev); +out: pm_runtime_put(dev); } @@ -1794,9 +1795,6 @@ static int device_prepare(struct device *dev, pm_message_t state) int (*callback)(struct device *) = NULL; int ret = 0; - if (dev->power.syscore) - return 0; - /* * If a device's parent goes into runtime suspend at the wrong time, * it won't be possible to resume the device. To prevent this we @@ -1805,6 +1803,9 @@ static int device_prepare(struct device *dev, pm_message_t state) */ pm_runtime_get_noresume(dev); + if (dev->power.syscore) + return 0; + device_lock(dev); dev->power.wakeup_path = false;