From patchwork Thu Feb 25 00:22:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 8415401 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8FA399F2F0 for ; Thu, 25 Feb 2016 00:23:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A667A2034A for ; Thu, 25 Feb 2016 00:23:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CCC1B202EC for ; Thu, 25 Feb 2016 00:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758868AbcBYAWh (ORCPT ); Wed, 24 Feb 2016 19:22:37 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33416 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758793AbcBYAWd (ORCPT ); Wed, 24 Feb 2016 19:22:33 -0500 Received: by mail-pa0-f45.google.com with SMTP id fl4so21589674pad.0 for ; Wed, 24 Feb 2016 16:22:33 -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=Zx9n/J/xN76xmzFml2qmkBC/l1XEFpCYGJeh1JONgqTyNsFam86J5asZLmCuU0uha7 uUbP25GriSSnL2odnPWVvThdtOmSmMqR5Nq0w2DAHu/9CbI2RefHyoYsYYqE6SGHNfIX m0+a1vk0EWTSphJlJRpMLqurPPdsxgZVPysHw= 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=lEXfhNzmw462al+MfEcxFk3Z1BTbnBGYbQ6G2wagaXSJ9SrRgMJXDID9VZiNGBUg0C TFJoS4vrPv18EiIa8vfN0K+AlC4BbpMjkzHbAStEzaAv37OlyN3WLLfUzk1GBZFLkySu +/Hi9cfhDwYn+lQTSYaOrQrPahzRjWRGte3U/Zclo0KYWclfK03tp6WVrwgmw9JD9dEF 50wP1lMbxcM3QFjOoUYTehL5WmqjKNwsyahpGJjISEt3PzlLFdhhAb0pspKbsjw+VmFG lvxGDQ08EgLpLHjcoYxafyUZQvqlcCGr7tjUAthzBQWYj10+PS3GRTXOy3nzfr09yO4+ QoyQ== X-Gm-Message-State: AG10YOS/QYe2IILkJEFz1m6g8QARda1RTdH7HC9ZLZSXDaPKGdLLnC6WmrAcKKBvZE1t2g== X-Received: by 10.66.122.3 with SMTP id lo3mr58310794pab.25.1456359753017; Wed, 24 Feb 2016 16:22:33 -0800 (PST) Received: from ketosis.mtv.corp.google.com ([172.22.65.104]) by smtp.gmail.com with ESMTPSA id m87sm7519956pfj.38.2016.02.24.16.22.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 16:22:32 -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, "Martin K . Petersen" , linux-scsi@vger.kernel.org, Derek Basehore Subject: [PATCH v2 2/3] PM / sleep: try to runtime suspend for direct complete Date: Wed, 24 Feb 2016 16:22:27 -0800 Message-Id: <1456359748-22838-2-git-send-email-dbasehore@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456359748-22838-1-git-send-email-dbasehore@chromium.org> References: <1456359748-22838-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;