From patchwork Mon Jul 22 22:33:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ravi Chandra Sadineni X-Patchwork-Id: 11053589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9DBE6C5 for ; Mon, 22 Jul 2019 22:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8792623D for ; Mon, 22 Jul 2019 22:33:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FE3B285B7; Mon, 22 Jul 2019 22:33:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 256A02623D for ; Mon, 22 Jul 2019 22:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728292AbfGVWdn (ORCPT ); Mon, 22 Jul 2019 18:33:43 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35902 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbfGVWdm (ORCPT ); Mon, 22 Jul 2019 18:33:42 -0400 Received: by mail-pf1-f194.google.com with SMTP id r7so18055365pfl.3 for ; Mon, 22 Jul 2019 15:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=WWFTKtpGRlvvtiWS/Mg0wAkpilGgkx7X1cSC4y5EWxE=; b=R2/O16xw6Vk/KNoxUlhUa5Y+bXgLiwKgbdav7p8y4DZGly/uyjCTGTMmALhIz+umS2 BzWjpf90ZaYSY/iJRimrYmRKxNKa5lfLyYlUtkqPpeXJE1zQboA2EQf93zE2W+kDjXt5 XiLOxoYWuYSBNhATVp5D+auF3i3e+jHCk2Ttg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WWFTKtpGRlvvtiWS/Mg0wAkpilGgkx7X1cSC4y5EWxE=; b=cqaRmDgYyj/zeHrZFPdkdTwj+o06CLg/9Jxp6iBw9AEMkN3SmRIdNF+hg7vFSDBcQY 2DP6HNvCXsYLXYofzfQZ8wzknrwo1DPGVrrSEBlplbOm5lT0E/hAn3iDwoAnrqKtChAw +Opan8JkYFBAD+/Pzdgg68HXe5HxyLXSHsq/JKXeIBFobq43qEkJpZ857L/CpCpPBbrV oI4gG6YSB6n9Dda09MgfBA+DGovlxVZII3IWE2XKHDEr+86lbIbxtv7k2hK1jtu04yzb PL878YoCObfwvCxKdrnx87TGDtIHrUkxvKMHg/aplbZdLJP2g83XapTNmXNSVicD3LIp GIdA== X-Gm-Message-State: APjAAAUH9ds07HLN9BAbl/k4kKxh8e1Nxwardhm/SWu8jPamIsLWIbVA SZZu1qZ3WdKhXhmxt33/1yh7Rg== X-Google-Smtp-Source: APXvYqzjNkKn9xJVfs5xGw8cpI55YmF3SpQ0/H+z0hmLe5p5Yj86uEZ+s3rh1vxlzdvzJ8lbYTj9ug== X-Received: by 2002:a17:90a:b011:: with SMTP id x17mr79797580pjq.113.1563834822065; Mon, 22 Jul 2019 15:33:42 -0700 (PDT) Received: from ravisadineni0.mtv.corp.google.com ([2620:15c:202:1:98d2:1663:78dd:3593]) by smtp.gmail.com with ESMTPSA id k186sm20614285pga.68.2019.07.22.15.33.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 15:33:41 -0700 (PDT) From: Ravi Chandra Sadineni To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, gregkh@linuxfoundation.org, ravisadineni@chromium.org, bhe@redhat.com, dyoung@redhat.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, tbroch@chromium.org Subject: [PATCH 1/2 V2] power: sysfs: Remove wakeup_abort_count attribute. Date: Mon, 22 Jul 2019 15:33:36 -0700 Message-Id: <20190722223337.36199-2-ravisadineni@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190722223337.36199-1-ravisadineni@chromium.org> References: <20190722182451.GB24412@kroah.com> <20190722223337.36199-1-ravisadineni@chromium.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP wakeup_abort_count and wakeup_count sysfs entries print the same (wakeup_count) attribute. This patch removes the duplicate wakeup_abort_count sysfs entry. Signed-off-by: Ravi Chandra Sadineni --- Documentation/ABI/testing/sysfs-devices-power | 25 ++++++------------- drivers/base/power/sysfs.c | 19 -------------- 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-devices-power b/Documentation/ABI/testing/sysfs-devices-power index 80a00f7b6667..1ca04b4f0489 100644 --- a/Documentation/ABI/testing/sysfs-devices-power +++ b/Documentation/ABI/testing/sysfs-devices-power @@ -81,12 +81,13 @@ What: /sys/devices/.../power/wakeup_count Date: September 2010 Contact: Rafael J. Wysocki Description: - The /sys/devices/.../wakeup_count attribute contains the number - of signaled wakeup events associated with the device. This - attribute is read-only. If the device is not capable to wake up - the system from sleep states, this attribute is not present. - If the device is not enabled to wake up the system from sleep - states, this attribute is empty. + The /sys/devices/.../wakeup_count attribute contains the + number of times the processing of a wakeup event associated with + the device might have aborted system transition into a sleep + state in progress. This attribute is read-only. If the device + is not capable to wake up the system from sleep states, this + attribute is not present. If the device is not enabled to wake + up the system from sleep states, this attribute is empty. What: /sys/devices/.../power/wakeup_active_count Date: September 2010 @@ -100,18 +101,6 @@ Description: the device is not enabled to wake up the system from sleep states, this attribute is empty. -What: /sys/devices/.../power/wakeup_abort_count -Date: February 2012 -Contact: Rafael J. Wysocki -Description: - The /sys/devices/.../wakeup_abort_count attribute contains the - number of times the processing of a wakeup event associated with - the device might have aborted system transition into a sleep - state in progress. This attribute is read-only. If the device - is not capable to wake up the system from sleep states, this - attribute is not present. If the device is not enabled to wake - up the system from sleep states, this attribute is empty. - What: /sys/devices/.../power/wakeup_expire_count Date: February 2012 Contact: Rafael J. Wysocki diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 1b9c281cbe41..f42044d9711c 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c @@ -375,24 +375,6 @@ static ssize_t wakeup_active_count_show(struct device *dev, static DEVICE_ATTR_RO(wakeup_active_count); -static ssize_t wakeup_abort_count_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - unsigned long count = 0; - bool enabled = false; - - spin_lock_irq(&dev->power.lock); - if (dev->power.wakeup) { - count = dev->power.wakeup->wakeup_count; - enabled = true; - } - spin_unlock_irq(&dev->power.lock); - return enabled ? sprintf(buf, "%lu\n", count) : sprintf(buf, "\n"); -} - -static DEVICE_ATTR_RO(wakeup_abort_count); - static ssize_t wakeup_expire_count_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -580,7 +562,6 @@ static struct attribute *wakeup_attrs[] = { &dev_attr_wakeup.attr, &dev_attr_wakeup_count.attr, &dev_attr_wakeup_active_count.attr, - &dev_attr_wakeup_abort_count.attr, &dev_attr_wakeup_expire_count.attr, &dev_attr_wakeup_active.attr, &dev_attr_wakeup_total_time_ms.attr, From patchwork Mon Jul 22 22:33:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ravi Chandra Sadineni X-Patchwork-Id: 11053587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3E9E6C5 for ; Mon, 22 Jul 2019 22:33:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94AE92623D for ; Mon, 22 Jul 2019 22:33:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88FCB285B7; Mon, 22 Jul 2019 22:33:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2696C2623D for ; Mon, 22 Jul 2019 22:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733178AbfGVWdp (ORCPT ); Mon, 22 Jul 2019 18:33:45 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:32805 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729358AbfGVWdp (ORCPT ); Mon, 22 Jul 2019 18:33:45 -0400 Received: by mail-pl1-f195.google.com with SMTP id c14so19708891plo.0 for ; Mon, 22 Jul 2019 15:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4lqL/2aAtzva5ONR2wYj8ExU6ts1LC8Et+7vo27oAws=; b=UgtJJ8+GEd2dn01GyvwLu7NPJ9l2xm/KPnrLgHH0dI9GzIlXWZkmA+N1KTUF7r0G1A 0MKQja2/FoG2oKE40jWNZvGiprQDfFP/jr/BSyVciwNIq95Iu6NjN3gB56GKdx0QgZky Kzg4GrGl+/m+dUUTzPW7iP/VH4CLaer9EdwLg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4lqL/2aAtzva5ONR2wYj8ExU6ts1LC8Et+7vo27oAws=; b=a//PmpzIDc7/i8Sbb2WQgijIbtyYsLdYpc3xVu/h1vgbCqS0O4apAvH5PZkoL4S5rg Bj0qs01Eb/jXP9vNuOy7owwv8t9dmjqVR7t0LVV+dt94JhPREceFEiQ/KdC4WhZGbgLz w9gvsj1sr+TRlNCbSbUPIWPdGzBZ9XimtBBJcG0IOWKZOe0XuCaUH5H7U5oswrgHVxGQ /IgWtFiSySNfQCPjdVfJ0tHREeTgZ/dl+Aow6jwvDQjCxBNJTh975Ls+OYc2S70VZxXS 9gcenSLUddjPL09/svqWbJUC+5lcNcCBTcRtNmLoftNGcJ2ibOzTTBmdFrr2ZRAbxO7X 6S1w== X-Gm-Message-State: APjAAAUt5FpWa6vfOHnHRUJdY47nW+vLL4f1SI7hpV3z0V+5H5xsytj+ dVmZiCRnaRzigLt/ExupgGmbMw== X-Google-Smtp-Source: APXvYqzm077YSy2G+QdxitaH1+UlqZ1igV+SV0DodJuzFm5hgnjFzjAwgaEvzXmLoOOyFMHuzWkCyA== X-Received: by 2002:a17:902:8ec3:: with SMTP id x3mr76220816plo.313.1563834824000; Mon, 22 Jul 2019 15:33:44 -0700 (PDT) Received: from ravisadineni0.mtv.corp.google.com ([2620:15c:202:1:98d2:1663:78dd:3593]) by smtp.gmail.com with ESMTPSA id k186sm20614285pga.68.2019.07.22.15.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 15:33:43 -0700 (PDT) From: Ravi Chandra Sadineni To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, gregkh@linuxfoundation.org, ravisadineni@chromium.org, bhe@redhat.com, dyoung@redhat.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, tbroch@chromium.org Subject: [PATCH 2/2 V2] power:sysfs: Expose device wakeup_event_count. Date: Mon, 22 Jul 2019 15:33:37 -0700 Message-Id: <20190722223337.36199-3-ravisadineni@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190722223337.36199-1-ravisadineni@chromium.org> References: <20190722182451.GB24412@kroah.com> <20190722223337.36199-1-ravisadineni@chromium.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Device level event_count can help user level daemon to track if a praticular device has seen an wake interrupt during a suspend resume cycle. Thus expose it via sysfs. Signed-off-by: Ravi Chandra Sadineni --- V2: Address comments from patchset 1. Documentation/ABI/testing/sysfs-devices-power | 11 ++++++++++ drivers/base/power/sysfs.c | 21 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-devices-power b/Documentation/ABI/testing/sysfs-devices-power index 1ca04b4f0489..abae0e8106d2 100644 --- a/Documentation/ABI/testing/sysfs-devices-power +++ b/Documentation/ABI/testing/sysfs-devices-power @@ -89,6 +89,17 @@ Description: attribute is not present. If the device is not enabled to wake up the system from sleep states, this attribute is empty. +What: /sys/devices/.../power/wakeup_event_count +Date: July 2019 +Contact: Ravi Chandra sadineni +Description: + The /sys/devices/.../wakeup_event_count attribute contains the + number of signaled wakeup events associated with the device. + This attribute is read-only. If the device is not capable to + wake up the system from sleep states, this attribute is not + present. If the device is not enabled to wake up the system + from sleep states, this attribute returns an empty line. + What: /sys/devices/.../power/wakeup_active_count Date: September 2010 Contact: Rafael J. Wysocki diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index f42044d9711c..cbb9768b10e8 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c @@ -357,6 +357,26 @@ static ssize_t wakeup_count_show(struct device *dev, static DEVICE_ATTR_RO(wakeup_count); +static ssize_t wakeup_event_count_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned long count = 0; + bool enabled = false; + + spin_lock_irq(&dev->power.lock); + if (dev->power.wakeup) { + count = dev->power.wakeup->event_count; + enabled = true; + } + spin_unlock_irq(&dev->power.lock); + if (enabled) + return sprintf(buf, "%lu\n", count); + else + return sprintf(buf, "\n"); +} + +static DEVICE_ATTR_RO(wakeup_event_count); + static ssize_t wakeup_active_count_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -561,6 +581,7 @@ static struct attribute *wakeup_attrs[] = { #ifdef CONFIG_PM_SLEEP &dev_attr_wakeup.attr, &dev_attr_wakeup_count.attr, + &dev_attr_wakeup_event_count.attr, &dev_attr_wakeup_active_count.attr, &dev_attr_wakeup_expire_count.attr, &dev_attr_wakeup_active.attr,