linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Stephen Boyd <swboyd@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Tri Vo <trong@android.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	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 21:36:56 +0200	[thread overview]
Message-ID: <20190801193656.GB24916@kroah.com> (raw)
In-Reply-To: <5d433c91.1c69fb81.93f13.febc@mx.google.com>

On Thu, Aug 01, 2019 at 12:25:04PM -0700, Stephen Boyd wrote:
> Quoting Rafael J. Wysocki (2019-08-01 10:21:44)
> > On Thu, Aug 1, 2019 at 5:31 PM Stephen Boyd <swboyd@chromium.org> wrote:
> > >
> > > BTW, paths in /sys/devices aren't supposed to matter too much. In this
> > > case, I'd expect to see userspace looking at the /sys/class/wakeup path
> > > to follow the symlink to figure out what device triggered a wakeup. It
> > > can look at the 'device' symlink inside the directory for the wakeup
> > > device to figure out which one it is.
> > 
> > But if you go from the device, it would be good to be able to figure
> > out which wakeup sources are associated with it and in the alarmtimer
> > example you don't even see that it is a wakeup source without
> > following the link.
> 
> Userspace shouldn't go from the device path (/sys/devices/.../rtc0 in
> this example). That's incorrect. Instead, userspace should go from the
> /sys/class/wakeup/... path. It should iterate over all the devices in
> the class path and look at the device pointers instead.
> 
> # ls /sys/class/wakeup/*/device -l
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/alarmtimer/device -> ../../rtc0
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup0/device -> ../../../a6f8800.usb
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup1/device -> ../../../a8f8800.usb
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup2/device -> ../../../cros-ec-rtc.1.auto
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup3/device -> ../../sbs-16-000b
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup4/device -> ../../../a88000.spi:ec@0:keyboard-controller
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup5/device -> ../../../spi10.0
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup6/device -> ../../../gpio-keys
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup7/device -> ../../../1-1.1
> lrwxrwxrwx. 1 root root 0 Aug  1 12:13 /sys/class/wakeup/wakeup8/device -> ../../../1-1.2.4.1
> 
> > 
> > So the "wakeupN" virtual dev names for all wakeup source objects are
> > less confusing IMO.
> > 
> > It would be good to avoid the glue dir creation in all cases somehow too.
> 
> I recall some differences between a bus_type and a class. Are you
> suggesting to use a bus_type for the wakeup sources? I like the class
> approach taken here to use different device names because it avoids the
> name collisions, avoids making another attribute to express the name of
> the wakeup source, and doesn't make a more heavyweight driver
> abstraction on top of wakeup sources.

This should be a class, as-is, not a bus type as these are all the same
type of "interface" for many different individual devices.

The difference between bus type and class is:
	- class is almost always how userspace sees the device, and cuts
	  across types of devices.  For example, a keyboard is a type of
	  an input device, and it can be a serial, PS/2, bluetooth, or
	  USB type of device.
	- a bus is a common type of devices usually at the hardware
	  level, where a driver is needed to send class-specific
	  commands down to a specific hardware device.  Busses have
	  drivers that bind a specific class to a specific device.
	  For example, there is a USB bus, and it has USB drivers for
	  things like a keyboard.  That USB keyboard driver knows how to
	  talk to the specific USB commands for the hardware and
	  translate them into specific input calls for the input class.

Hope this helps explain things better.

thanks,

greg k-h

  reply	other threads:[~2019-08-01 19:36 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 [this message]
2019-08-01 19:50               ` Tri Vo
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=20190801193656.GB24916@kroah.com \
    --to=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=trong@android.com \
    --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).