From patchwork Thu Feb 25 00:11:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 8415231 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 212D4C0553 for ; Thu, 25 Feb 2016 00:12:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A4CC202EC for ; Thu, 25 Feb 2016 00:12:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AF6C202E6 for ; Thu, 25 Feb 2016 00:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758910AbcBYALp (ORCPT ); Wed, 24 Feb 2016 19:11:45 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34417 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756685AbcBYALl (ORCPT ); Wed, 24 Feb 2016 19:11:41 -0500 Received: by mail-pf0-f178.google.com with SMTP id x65so21902650pfb.1 for ; Wed, 24 Feb 2016 16:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CGtMgNW9D7m5N4MZJPt0M8TVniIo0Yd5jm/b3weDp0M=; b=VOUVziZy7RRFxXjQXt7VdhlqzffYs+K/uBDabBXZT0p03AsXAiZoc7aVvb6AtbAeyo AZdTpelpklaPiTdnV+GrnQHuSsGU2WAAtRjTRR/c5d9cOH54kOTrN8Lx7yAHbb0aDnLs mOH1SeQ9N2rRruhUVemTMT3FNbtdBnFzyJ8YU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CGtMgNW9D7m5N4MZJPt0M8TVniIo0Yd5jm/b3weDp0M=; b=P5LILns1pJkFbd7eq1Ihdf7OHPaQF2xE4iy4hjwfL/gCoW4l08ZkCOWb7Cvx0zFgoJ iZOZt1LKnVEuarbU1lyzOmVNhxGvJx9It7WIdgh2FJhWCPSX2cVLnW8DmxKOIBa6Q9il oq0E2yfDP72TsjSl8vX1hlGa2gD27npwxIh9nEW57EdBgBQYeTExChAf4pYtWgnRITWL qup28eksVWscIlQuuNECwFriIhMgdSEJSj+ncQMboRFBPEgWbcDDUeEDo860Y1FrCDpy zkRKPsDIzvddIHFQpJosdZL6qFcA++0XVCfkxbCJq72FvjYCyJGk3rpmmsHgi0TK3IUI iE/g== X-Gm-Message-State: AG10YOSWjTKAYK/U/B2mI6lIRT0r7xXOp7jx9I3oB3JxchS9/wVH9Ifqj9EFclSI9GN35Q== X-Received: by 10.98.68.212 with SMTP id m81mr58570172pfi.135.1456359100531; Wed, 24 Feb 2016 16:11:40 -0800 (PST) Received: from ketosis.mtv.corp.google.com ([172.22.65.104]) by smtp.gmail.com with ESMTPSA id y15sm7497671pfi.16.2016.02.24.16.11.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 16:11:40 -0800 (PST) From: Derek Basehore To: linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, Derek Basehore Subject: [PATCH v1 2/3] PM / sleep: try to runtime suspend for direct complete Date: Wed, 24 Feb 2016 16:11:28 -0800 Message-Id: <1456359089-19807-2-git-send-email-dbasehore@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456359089-19807-1-git-send-email-dbasehore@chromium.org> References: <1456359089-19807-1-git-send-email-dbasehore@chromium.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This tries to runtime suspend devices that are still active for direct complete. This is for cases such as autosuspend delays which leaves devices able to runtime suspend but still active. It's beneficial in this case to runtime suspend the device to take advantage of direct complete when possible. Signed-off-by: Derek Basehore Reviewed-by: Eric Caruso --- drivers/base/power/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index e0017d9..9693032 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1380,7 +1380,12 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) goto Complete; if (dev->power.direct_complete) { - if (pm_runtime_status_suspended(dev)) { + /* + * Check if we're runtime suspended. If not, try to runtime + * suspend for autosuspend cases. + */ + if (pm_runtime_status_suspended(dev) || + !pm_runtime_suspend(dev)) { pm_runtime_disable(dev); if (pm_runtime_status_suspended(dev)) goto Complete;