From patchwork Wed Nov 13 16:29:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21490 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B9623202E2 for ; Wed, 13 Nov 2013 16:29:55 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id q4sf1065142vbe.9 for ; Wed, 13 Nov 2013 08:29:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=oiwgueoMonPbxwOg07Qick4v/JTYvs23sfF71NtSXcY=; b=glnu9EAgNPHa8lD0sO9+SD6sqkS95+N+iTjNYX/PL46VX3Kf2aBcjtQ3FVJaub9Flp qEMXofn8VrAwhASpmstLCcvDF147vkCAvh81KOPHrS51xh3PktOvCQKPUe6DrcZcBHhL erxQgdXrSg5LalVi6YYJdeCaIDwsRjeKv3wN3n74nsA2PqgsyyFNGt+2Hlg9ZCjt/879 3qv2MD85FvWuCuUV96Svh0actiJ/+LSktPj7DklXtfm4iPVgzAYBXKht1NeUIrgn0jOf 6Dchl2N53UPbND4nEHHuWQ85XvHRcShHNPLu2I0pAoYHDxu5K4xuDaXtVVhQvI0mpwXb zGtQ== X-Gm-Message-State: ALoCoQnWly/zQOltJSAUqB8A+RFG5zLAMqT9BCzRCrAT5rAIky3UGxoC5cPFGaZyhJWBSbVlPKmI X-Received: by 10.52.69.198 with SMTP id g6mr17906886vdu.6.1384360195340; Wed, 13 Nov 2013 08:29:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.2.102 with SMTP id 6ls560697qet.69.gmail; Wed, 13 Nov 2013 08:29:55 -0800 (PST) X-Received: by 10.220.144.18 with SMTP id x18mr34959907vcu.15.1384360195243; Wed, 13 Nov 2013 08:29:55 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id wp10si14763735vdb.110.2013.11.13.08.29.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 08:29:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id o19so444976vbm.8 for ; Wed, 13 Nov 2013 08:29:55 -0800 (PST) X-Received: by 10.52.177.166 with SMTP id cr6mr12307867vdc.26.1384360194933; Wed, 13 Nov 2013 08:29:54 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp251007vcz; Wed, 13 Nov 2013 08:29:54 -0800 (PST) X-Received: by 10.180.206.78 with SMTP id lm14mr2298822wic.30.1384360193887; Wed, 13 Nov 2013 08:29:53 -0800 (PST) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mx.google.com with ESMTPS id jb15si7449765wic.51.2013.11.13.08.29.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 08:29:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.169 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.212.169; Received: by mail-wi0-f169.google.com with SMTP id hi5so237835wib.0 for ; Wed, 13 Nov 2013 08:29:53 -0800 (PST) X-Received: by 10.180.39.212 with SMTP id r20mr21421453wik.13.1384360193144; Wed, 13 Nov 2013 08:29:53 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id qc10sm57015554wic.9.2013.11.13.08.29.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 08:29:52 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Kevin Hilman , Alan Stern Subject: [RFC PATCH] PM / Runtime: Allow to inactivate devices during system suspend Date: Wed, 13 Nov 2013 17:29:38 +0100 Message-Id: <1384360178-333-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The PM core was preventing devices from going inactive during system suspend. Remove this constraint and moreover try to inactivate devices by invoking pm_runtime_idle() before proceeding with device's suspend_late callbacks. A great amount of drivers that uses runtime PM will benefit from this. Drivers that implements some of the system ->suspend* callbacks for the only reason of making sure the runtime PM resourses gets inactive, can now solely instead rely on the PM core to handle this. In the case were drivers needs there runtime resourses to be activated to be able to handle their system suspend tasks, those can easily just restore the runtime PM usage count, pm_runtime_put_sync(), once done with it's suspend operations, which then will inactivate the device. Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- There are a quite long history for how the PM core behaves around this topic. Changes has been iterated, back for forward, you might even think that it should have been settled at this point. So, forgive me for bringing this up, again. This patch shall obviously not be merged as is, it will cause regressions for several drivers and subsystems. The intent is instead to try to follow up on previous discussions to see if we might end up closer to the sequence, which my RFC PATCH suggests, or if I am just bothering you completely unnecessary. --- drivers/base/power/main.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index ee039af..670b1d5 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -832,7 +832,7 @@ static void device_complete(struct device *dev, pm_message_t state) device_unlock(dev); - pm_runtime_put(dev); + pm_request_idle(dev); } /** @@ -1004,6 +1004,7 @@ static int device_suspend_late(struct device *dev, pm_message_t state) pm_callback_t callback = NULL; char *info = NULL; + pm_runtime_idle(dev); __pm_runtime_disable(dev, false); if (dev->power.syscore) @@ -1312,14 +1313,6 @@ static int device_prepare(struct device *dev, pm_message_t state) 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 - * block runtime suspend here, during the prepare phase, and allow - * it again during the complete phase. - */ - pm_runtime_get_noresume(dev); - device_lock(dev); dev->power.wakeup_path = device_may_wakeup(dev);