Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4449477ybh; Tue, 6 Aug 2019 11:52:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNWuYK3JSx9ZXxokt1gEiQDACi6/zPKDYjAj9w4ixSiCNfHW7gMF11pDZVorXCPsgQCIYz X-Received: by 2002:a17:90a:80c4:: with SMTP id k4mr4698692pjw.74.1565117577366; Tue, 06 Aug 2019 11:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565117577; cv=none; d=google.com; s=arc-20160816; b=q6L6aBtbPOtjak8hc9UUV/yeD5BdMK6vSkJ/+gPPjXgMeaWX3zbMegi/gT1DsuAFyd nIBZrrtmEoZiYdFMjarZqjaKNBRu+IFKMjoYFxnIZBKikTkIj3rpDNa7gAllQ1d5wADL r2qbUG5yA9W5oF4Q9GZUXeCeER03bprqN3NsqbFGL75u+qUAOUo5QpvmVJ8QbsSGhEal suo0ELyr35tfzoj42HhC7f1umMSPFc52DgL9K2vSz0RSiyzysnoPYA2+BcmGOIGXXcDA GSZL0HB/5fLRls9eSRU3yGbRXdDAtTcfmIbdneArUQoavymhb35T/kTKzEOgyszUKcAq j4MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=aGCcLtK25GuveYiFjhwocqTOqxw5HIZH0JbQl66UTl8=; b=DtAkjI8LD6iDNR+b24JrIFTUcInmie9PUg7SrAurlQo4OIztx1T67IloUcg2urgpbK uB5vjTWNvf4usTKidqVshXrqlQaabKO+MOrF3wlfk+Q3xStZtcJye6pqtc+KjGZ4LE63 apV4uM7EhCwEgqkRFNWsQGIkTt+UcuIusGCoEmIWcFdWPet77AxCbgcKtNrXym5rkJpB zk/YtqG6NSyQ4xXZf+vrtwBOKVBPxHs3fximFnqIrItK3SlFLb4c4zDiTIZ/6DxpdS8s 3xqHMt1XISFKicrPl3q9aIvQzZSdlc/xcR++e/RL80ir34eEYoQYjylyQbsCULs36pbm OizQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=q5a6Wu2J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si36709338pga.407.2019.08.06.11.52.41; Tue, 06 Aug 2019 11:52:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=q5a6Wu2J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbfHFSv6 (ORCPT + 99 others); Tue, 6 Aug 2019 14:51:58 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:38087 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbfHFSv5 (ORCPT ); Tue, 6 Aug 2019 14:51:57 -0400 Received: by mail-ot1-f66.google.com with SMTP id d17so95169935oth.5 for ; Tue, 06 Aug 2019 11:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aGCcLtK25GuveYiFjhwocqTOqxw5HIZH0JbQl66UTl8=; b=q5a6Wu2JffaVHSnXg3X5NgLo7sEfrMh4H/pE7ZTJenizHNyZziPaDY+sKY4OALTbdm wWeUsPsuiAD7aiR2FOdge5bw9vBJkZpbZK/ApWIjWB3eOGut9lYi7v626S/DWLkuG+Fr HsqzZuekniCMpYkDgy/V6P9lbnq9eSJXNuVH7/+d+SlnrhpWcjGn3c8gqHa1e6jPm2He 44FW/xjQAlIzFwFgX6j548WyXfkKSDNpble5Vw2lfIJHPA2Lb5ZWUjBDWaxgMWCRMb6J H2FW8SGNPvor8jaYMjskiuEJCJSfaC57nPSIZVEgYfTfpuFwxmHWH3nSpAXN/go/VPiE D0Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aGCcLtK25GuveYiFjhwocqTOqxw5HIZH0JbQl66UTl8=; b=IvA7/LG2ibAydV36Xav91MWrynWB0Wh0ZDhJQxfeqpFIUSPtTOytITeF/gsu8mshFu fUeMwaugRF9XlYRaESKnceaa4MTcUaORGqzIGD0ray8lXEvZZnjm/yYkRv9QBToUXclV N+WIBa6aC5/LawR1Xsoay2Fv+s6cfjG69tPktgF1Eklt02UfuYFw6wYcxqoMBioQdowD t1N2TtphFXJaouf/wfOXH3ndValHWjxbmrJLRQ0X6FWYKSnlXeXkQl0bnz7XYsQr3RVs sNjCHSOWi8U0+0A641fhzEcCr0tyuUk5YZx8L0/vIwUMcpGdHPHT8zp75gFRffDTRutB EI3Q== X-Gm-Message-State: APjAAAXrNEHY54vYBgdry+dHRP7t+QfOPPaRDAeQVuZ0vDgxXPabtBzf ehWCT6nyJTjs6mmUGzWLClWk2K5NAcaNPMow2IYzSQ== X-Received: by 2002:a05:6830:13d9:: with SMTP id e25mr4622173otq.197.1565117516786; Tue, 06 Aug 2019 11:51:56 -0700 (PDT) MIME-Version: 1.0 References: <20190805175848.163558-1-trong@android.com> <20190805175848.163558-4-trong@android.com> <5d48bbc2.1c69fb81.62114.5473@mx.google.com> In-Reply-To: <5d48bbc2.1c69fb81.62114.5473@mx.google.com> From: Tri Vo Date: Tue, 6 Aug 2019 11:51:45 -0700 Message-ID: Subject: Re: [PATCH v7 3/3] PM / wakeup: Show wakeup sources stats in sysfs To: Stephen Boyd Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Viresh Kumar , "Rafael J. Wysocki" , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , LKML , Linux PM , "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 5, 2019 at 4:29 PM Stephen Boyd wrote: > > Quoting Tri Vo (2019-08-05 10:58:48) > > diff --git a/drivers/base/power/wakeup_stats.c b/drivers/base/power/wakeup_stats.c > > new file mode 100644 > > index 000000000000..3a4f55028e27 > > --- /dev/null > > +++ b/drivers/base/power/wakeup_stats.c > > @@ -0,0 +1,161 @@ > [...] > > +/** > > + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs. > > + * @parent: Device given wakeup source is associated with (or NULL if virtual). > > + * @ws: Wakeup source to be added in sysfs. > > + */ > > +int wakeup_source_sysfs_add(struct device *parent, struct wakeup_source *ws) > > +{ > > + struct device *dev; > > + > > + dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws, > > + wakeup_source_groups, "wakeup%d", > > + ws->id); > > + if (IS_ERR(dev)) > > + return PTR_ERR(dev); > > + ws->dev = dev; > > + pm_runtime_no_callbacks(ws->dev); > > Does this only avoid adding runtime PM attributes? > > I thought we would call device_set_pm_not_required() on the device here. > Probably requiring a bit of copy/paste from device_create_with_groups() > so that it can be set before the device is registered. Or another > version of device_create_with_groups() that does everything besides call > device_add(). Comments on pm_runtime_no_callbacks() say, "Set the power.no_callbacks flag, which tells the PM core that this device is power-managed through its parent and has no runtime PM callbacks of its own. The runtime sysfs attributes will be removed." Sound like it's appropriate to apply this function to the wakeup source.