From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2C10C31E40 for ; Tue, 6 Aug 2019 21:32:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91C5C217F4 for ; Tue, 6 Aug 2019 21:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565127161; bh=frBRW98Gphsjm7khOnwDtnCiYYJEpmxxx35acMgCkB8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=zLhWePWSWigA3+HzG2gERZAEyaI5Q4Gc6rf6B2fBLvOBve76/YMKEJwFS7EOVunXh zqklNEsz2i52YLVo3FUkGGvr5kwrzOsCMqWysMuJyGouABV2DlISBsuCYPQWoWk3rp OB4+HN6H9aBnX849lTV5IocNO8NuLR7sA8RLV+Jw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726238AbfHFVcl (ORCPT ); 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-Google-Smtp-Source: APXvYqz5InPmzAE9CcFUiwV8OQSK3Rfqze+93pwnQo2dyWs4n8mTKQoIhMVewx9cL+IVA1slbun5a7mS7PvjzPnLM8g= 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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.