From patchwork Thu Jul 19 02:08:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Cross X-Patchwork-Id: 1214631 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1CE8D3FD4F for ; Thu, 19 Jul 2012 02:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175Ab2GSCIU (ORCPT ); Wed, 18 Jul 2012 22:08:20 -0400 Received: from mail-we0-f202.google.com ([74.125.82.202]:64057 "EHLO mail-we0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752322Ab2GSCIT (ORCPT ); Wed, 18 Jul 2012 22:08:19 -0400 Received: by weyr1 with SMTP id r1so112687wey.1 for ; Wed, 18 Jul 2012 19:08:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=V+9n/rCF7ukh/xdROO8mVazHbKP52ko4ulBFv6R6bg8=; b=JAubVnBir0t7L7JFEsglrDRqsx39glxzISMhekvlEHp9WJ0HfFUA+0veJGS0a7Npfy /1X+9ySTx8YKYfxRlTH5YF67AoxoICZ1VLcr4g5ySS8Ohm5AAYfNtSSAxD6YNGd7fKsd 1f4zHzZue4YsbHh1t/2OPbm/8NR9Q14J/zgAPhh8LH1OkatQBlkNXh1zzRbhhv/4VkWQ OSNBxRRSu7UtAvExIXJvNyLbfFSUS0d9tNxIfhndcfoSPJf51q61vdNATtneqU2Nixn7 LpMf+CPWheOfEpFoP1Rsx7wgCDy2V8LPMehCjdoz9rQy4GSwlylDb6U9gyoCjF1qven8 L4bw== Received: by 10.180.14.169 with SMTP id q9mr19810wic.0.1342663697826; Wed, 18 Jul 2012 19:08:17 -0700 (PDT) Received: by 10.180.14.169 with SMTP id q9mr19795wic.0.1342663697764; Wed, 18 Jul 2012 19:08:17 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id s44si964574eeo.0.2012.07.18.19.08.17 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 18 Jul 2012 19:08:17 -0700 (PDT) Received: from walnut.mtv.corp.google.com (walnut.mtv.corp.google.com [172.18.104.116]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 8B8D720004E; Wed, 18 Jul 2012 19:08:17 -0700 (PDT) Received: by walnut.mtv.corp.google.com (Postfix, from userid 99897) id CB0AA257B1A; Wed, 18 Jul 2012 19:08:16 -0700 (PDT) From: Colin Cross To: "Rafael J. Wysocki" Cc: Colin Cross , Pavel Machek , Len Brown , Greg Kroah-Hartman , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PM / Sleep: call early resume handlers when suspend_noirq fails Date: Wed, 18 Jul 2012 19:08:14 -0700 Message-Id: <1342663694-3645-1-git-send-email-ccross@android.com> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQkAhwrMC3RtwwuTTVO3tWqBLf8lNmPxD/tuyPZAS7+2FZuXBHy78yk/gXr7viFcfS3VS7dXDLQ8dwblN3ZtacEi6vKdnI8n+ew6bCM9lMG1yGI6/oZmas2pAaTQzGVSK0jzgWBardsE0gUqe6rbiyohcnaTuvvc1fKBP2sHKyVyxsYGLNEhcLT4d6KcCmpZp8w1KDjg Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Commit cf579dfb82550e34de7ccf3ef090d8b834ccd3a9 (PM / Sleep: Introduce "late suspend" and "early resume" of devices) introduced a bug where suspend_late handlers would be called, but if dpm_suspend_noirq returned an error the early_resume handlers would never be called. All devices would end up on the dpm_late_early_list, and would never be resumed again. Fix it by calling dpm_resume_early when dpm_suspend_noirq returns an error. Signed-off-by: Colin Cross --- drivers/base/power/main.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 9cb845e..742fcbe 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -989,8 +989,16 @@ static int dpm_suspend_late(pm_message_t state) int dpm_suspend_end(pm_message_t state) { int error = dpm_suspend_late(state); + if (error) + return error; - return error ? : dpm_suspend_noirq(state); + error = dpm_suspend_noirq(state); + if (error) { + dpm_resume_early(state); + return error; + } + + return 0; } EXPORT_SYMBOL_GPL(dpm_suspend_end);