Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4597090ybh; Tue, 6 Aug 2019 14:33:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHH8fUMgj3H19wtPKUuABWD0w9LDc+STqt6L+ebOdkVOF/w65n71uZnpOIXNdOoRqvWLGW X-Received: by 2002:aa7:858b:: with SMTP id w11mr5597177pfn.68.1565127235670; Tue, 06 Aug 2019 14:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565127235; cv=none; d=google.com; s=arc-20160816; b=EIPCp1x4nqreyrO40w2x9DOVAxlSwRn5l83tN7BQVUS8VJaYNdmGt1i3ptlGaBGHxY o6Mtq0AZI9pCHofze7+ZzC0CFoVZHVkhrRs/wCBOF8Fa4hNAsH4LLL4KdWdkw+RXMjMF XYluDHxvOXxfdLWB2LXAwaRz3LEkT1Fy5hh967otyvB43IiapWheZW21Yi5B/Ed33uLW FQKxT3WhENrLZTm7ZPpSops4kh1oC+xtpenstUSGMmwmCs5/QKxNgp6r70Hc1sSh8Alv PX0k842jFJeTSD9Wu7RqGrZf6kN7P4iwg4MBiht7kIXfhV5Ce8o36eGBUuRdeUJANDGw rYhg== 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; bh=Ef8vY14IPg+ARIOj2VrrOApE5VT46udp6YkWmmIY8Ms=; b=aiWtRHY05ha1c1zcAX3G5XuXUiRs6zokdqf+WG2k3nv/Oa8/nnw1XKS5O0Dq0s4GUM uRA4bQdkUp8DwA5GR/HotZqLSU6GazSLAmigbV1zxczakT1IE3Ov6nlcuEAKDnihh/u6 p4D3Al5wyTNZL2Qdto8m5T+/CiE+1b4Xx2Nhb/zah54LczkFqPn6MF2WB5SPltXu/wVA JKrtZN7QjL39FWyzRYVIxX96CaSQeIR3uVMMQ4QjkznC6uC41pBPYjUdSgGsNLFlv623 hBqQTVco19oRJ1+0xChBrQpyp+KcaDPKwNgGoNKieRM1wojJNccD6a88bnH5vSOdpurk JD6w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si48491337pfc.179.2019.08.06.14.33.39; Tue, 06 Aug 2019 14:33:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726529AbfHFVcl (ORCPT + 99 others); Tue, 6 Aug 2019 17:32:41 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:36349 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbfHFVck (ORCPT ); Tue, 6 Aug 2019 17:32:40 -0400 Received: by mail-oi1-f195.google.com with SMTP id c15so13424236oic.3; Tue, 06 Aug 2019 14:32:40 -0700 (PDT) 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=Ef8vY14IPg+ARIOj2VrrOApE5VT46udp6YkWmmIY8Ms=; b=C9tpcqn2Gg1FkvdmKFSoHZzZpu7xwyVY7lSOlgHozEIMXdpQGdGjlFZGhNTo//CHGA z0f0OyVtxGZwCgGGqEoT18sEkm7LGTENIZT1LAQv4vfJ7JSwSo9E6RQQ1MKfqBs93EMn g5a4SyThQ8EI9MEW8/Jt8qlcmlCrqEGnTUtrjCbzBwrN5nbvMh6Lpimd4h/kuGPYn4S8 MItErD+nfNesXZG+uUt4+82N6BHomyH0SloZH2cXNYZMnbbxKZYqMB8ty8dvakV4WOwm 4Bu2U/9jZ3mq/uVfhKl/XEsRIlrbVzO667+PiDpVWfxAcckczXaoxo2icywo+divFWLy J9sw== X-Gm-Message-State: APjAAAWOvh9d7SKKkN5v2Np35ZG534woE8xnhYbEDoDa2lqbAAuHy2+5 dXIV0iJRZn4FaguH5zRAriNSmjUcuXvNf03RuHg= X-Received: by 2002:aca:cdd3:: with SMTP id d202mr3451399oig.115.1565127159601; Tue, 06 Aug 2019 14:32:39 -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: From: "Rafael J. Wysocki" Date: Tue, 6 Aug 2019 23:32:27 +0200 Message-ID: Subject: Re: [PATCH v7 3/3] PM / wakeup: Show wakeup sources stats in sysfs To: Tri Vo Cc: Stephen Boyd , 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 Tue, Aug 6, 2019 at 8:51 PM Tri Vo wrote: > > 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. This is only useful if you ever enable PM-runtime for this device. Which you won't do. You could use device_set_pm_not_required(), though.