linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tri Vo <trong@android.com>
To: Stephen Boyd <swboyd@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Hridya Valsaraju <hridya@google.com>,
	Sandeep Patil <sspatil@google.com>,
	Kalesh Singh <kaleshsingh@google.com>,
	Ravi Chandra Sadineni <ravisadineni@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	"Cc: Android Kernel" <kernel-team@android.com>
Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs
Date: Thu, 1 Aug 2019 12:50:25 -0700	[thread overview]
Message-ID: <CANA+-vCoCuMtSKCfnav9NSwrzX7of9iLbppNX+pcymBp19kgQQ@mail.gmail.com> (raw)
In-Reply-To: <5d42281c.1c69fb81.bcda1.71f5@mx.google.com>

On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Rafael J. Wysocki (2019-07-31 16:10:38)
> > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo <trong@android.com> wrote:
> > >
> > > On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > > >
> > > > That's not my point (see below).
> > > >
> > > > > > > > +       if (id < 0)
> > > > > > > > +               return id;
> > > > > > > > +       ws->id = id;
> > > > > > > > +
> > > > > > > > +       dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws,
> > > > > > > > +                                       wakeup_source_groups, "ws%d",
> > > > > > >
> > > > > > > I thought the name was going to still be 'wakeupN'?
> > > > > >
> > > > > > So can't we prefix the wakeup source name with something like "wakeup:" or similar here?
> > > > >
> > > > > "ws%d" here is the name in the sysfs path rather than the name of the
> > > > > wakeup source. Wakeup source name is not altered in this patch.
> > > > >
> > > >
> > > > So why wouldn't something like this suffice:
> > > >
> > > > dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws,
> > > >                                 wakeup_source_groups, "wakeup:%s", ws->name);
> > > >
> > > > ?
> > >
> > > ws->name is inherited from the device name. IIUC device names are not
> > > guaranteed to be unique. So if different devices with the same name
> > > register wakeup sources, there is an error.
> >
> > OK
> >
> > So I guess the names are retained for backwards compatibility with
> > existing user space that may be using them?
> >
> > That's kind of fair enough, but having two different identification
> > schemes for wakeup sources will end up confusing.
>
> I understand your concern about the IDA now. Thanks for clarifying.
>
> How about we name the devices 'wakeupN' with the IDA when they're
> registered with a non-NULL device pointer and then name them whatever
> the name argument is when the device pointer is NULL. If we have this,
> we should be able to drop the name attribute in sysfs and figure out the
> name either by looking at the device name in /sys/class/wakeup/ if it
> isn't 'wakeupN', or follow the symlink to the device in /sys/devices/
> and look at the parent device name there.

This makes it difficult for userspace to query the name a wakeup
source, as it now has to first figure out if a wakeup source is
associated with a device or not. The criteria for that is also
awkward, userspase has to check if directory path contains "wakeupN",
then it's a virtual wakeup source.

IMO it's cleaner to consistently have /sys/class/wakeup/wakeupN/name
for every wakeup source.

  parent reply	other threads:[~2019-08-01 19:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 21:55 [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs Tri Vo
2019-07-31 21:59 ` Stephen Boyd
2019-07-31 22:16   ` Tri Vo
2019-07-31 22:17   ` Rafael J. Wysocki
2019-07-31 22:31     ` Tri Vo
2019-07-31 22:42       ` Rafael J. Wysocki
2019-07-31 22:58         ` Tri Vo
2019-07-31 23:10           ` Rafael J. Wysocki
2019-07-31 23:27             ` Tri Vo
2019-07-31 23:45             ` Stephen Boyd
2019-08-01  0:45               ` Stephen Boyd
2019-08-01  8:09                 ` Rafael J. Wysocki
2019-08-01 15:31                   ` Stephen Boyd
2019-08-01 17:21                     ` Rafael J. Wysocki
2019-08-01 19:25                       ` Stephen Boyd
2019-08-01 19:36                         ` Greg Kroah-Hartman
2019-08-01 19:50               ` Tri Vo [this message]
2019-08-01 20:22                 ` Stephen Boyd
2019-08-01 21:44                   ` Tri Vo
2019-08-01 22:10                     ` Rafael J. Wysocki
2019-08-03 22:40                       ` Tri Vo
2019-08-05  8:32                         ` Rafael J. Wysocki
2019-08-01 22:11                     ` Stephen Boyd
2019-08-01 22:44                       ` Tri Vo
2019-08-01 23:37                         ` Stephen Boyd
2019-08-01 22:46                       ` Rafael J. Wysocki
2019-08-01 23:40                         ` Stephen Boyd
2019-07-31 23:00         ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANA+-vCoCuMtSKCfnav9NSwrzX7of9iLbppNX+pcymBp19kgQQ@mail.gmail.com \
    --to=trong@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hridya@google.com \
    --cc=kaleshsingh@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=ravisadineni@chromium.org \
    --cc=rjw@rjwysocki.net \
    --cc=sspatil@google.com \
    --cc=swboyd@chromium.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).