From patchwork Thu May 30 20:02:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julius Werner X-Patchwork-Id: 2638871 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 17041DF2A1 for ; Thu, 30 May 2013 20:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757840Ab3E3UCt (ORCPT ); Thu, 30 May 2013 16:02:49 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:54726 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756160Ab3E3UCs (ORCPT ); Thu, 30 May 2013 16:02:48 -0400 Received: by mail-pd0-f169.google.com with SMTP id y11so956866pdj.28 for ; Thu, 30 May 2013 13:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=3xFRPsOypv2UGnZcxsYIAFdRSFUmXLkjioVsof84BC8=; b=Jt5C1IEBS9r4dehq+tyHFQcfL47+QSJH2fAv14kH3ffVhcK3eo0tRw9pSnMz+HJuNk Btb5xLcT773Rky5iy4rwezHR6V6G36AVpirYvRhxC7xAtXOdFiWJw0G8JQWioWAt4/Xm hxbxUSKiTytuCgFIeq8zxh+J/8RLg0Hqi5XAc= 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=3xFRPsOypv2UGnZcxsYIAFdRSFUmXLkjioVsof84BC8=; b=ia74xTy6xsrpZyQqaoJNmbpI28vvTyDdyT2JuIpd/nR6c55KLWKXV3PK2We9cwmDo8 o6uloBrD4s7DTOXuaYtfkY/bqQUIvnJf5+mbXWJAZlICkZiKClpf1wATUCqaxd008nQo suJMEqd+PPMm7ae4bvDUmF6Zek6SZ2I61dAaaTu38y1j2d3+eZgA7cEunY+0z8/t5qdk 9G5uFHSBkontdxYxBUuDdbVqeNyvCRSKu6hnjLQjPn8vIWuIZIvLJkjsxobvaiFk8ftp jFLfHj38y8gsTC4fveiUkcJFVC+r9ejZG9utOQnNc6qwfkfALfOObsFokZt8NHe9as/s ou3g== X-Received: by 10.66.251.163 with SMTP id zl3mr10044487pac.174.1369944168042; Thu, 30 May 2013 13:02:48 -0700 (PDT) Received: from jwerner-linux.mtv.corp.google.com (jwerner-linux.mtv.corp.google.com [172.22.72.75]) by mx.google.com with ESMTPSA id qb1sm43243460pbb.33.2013.05.30.13.02.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 13:02:47 -0700 (PDT) From: Julius Werner To: "Rafael J. Wysocki" Cc: Len Brown , Pavel Machek , Todd Poynor , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Sameer Nanda , Julius Werner Subject: [PATCH] PM / Sleep: Print last wakeup source on failed wakeup_count write Date: Thu, 30 May 2013 13:02:17 -0700 Message-Id: <1369944137-30948-1-git-send-email-jwerner@chromium.org> X-Mailer: git-send-email 1.8.2.1 X-Gm-Message-State: ALoCoQmpgBxE52Ef61ICZdRrR8cXz4w2vtDtdBFZS6tqfwFxPHVp7T/8rl3Tb1fXjFxsgc9C3Erx Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Commit a938da06 introduced a useful little log message to tell users/debuggers which wakeup source aborted a suspend. However, this message is only printed if the abort happens during the in-kernel suspend path (after writing /sys/power/state). The full specification of the /sys/power/wakeup_count facility allows user-space power managers to double-check if wakeups have already happened before it actually tries to suspend (e.g. while it was running user-space pre-suspend hooks), by writing the last known wakeup_count value to /sys/power/wakeup_count. This patch changes the sysfs handler for that node to also print said log message if that write fails, so that we can figure out the offending wakeup source for both kinds of suspend aborts. Signed-off-by: Julius Werner --- drivers/base/power/wakeup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 79715e7..b0b7886 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -772,6 +772,8 @@ bool pm_save_wakeup_count(unsigned int count) events_check_enabled = true; } spin_unlock_irqrestore(&events_lock, flags); + if (!events_check_enabled) + print_active_wakeup_sources(); return events_check_enabled; }