Messages in this thread Patch in this message | | | From | Stephen Boyd <> | Subject | Re: [PATCH] PM / wakeup: Avoid dev_name collisions in wakeup class | Date | Mon, 29 Jul 2019 07:07:19 -0700 |
| |
Quoting Rafael J. Wysocki (2019-07-27 06:10:00) > On Sat, Jul 27, 2019 at 3:11 AM Stephen Boyd <swboyd@chromium.org> wrote: > > > > If a device is wakeup capable and the driver calls device_wakeup_init() > > on it during probe and then userspace writes 'enabled' to that device's > > power/wakeup file in sysfs we'll try to create the same named wakeup > > device in sysfs. The kernel will complain about duplicate file names. > > > > sysfs: cannot create duplicate filename '/devices/virtual/wakeup/1-1.1' > > kobject_add_internal failed for 1-1.1 with -EEXIST, don't try to register things with the same name in the same directory. > > > > It may be advantageous to not write 'enabled' to the wakeup file (see > > wakeup_store()) from userspace for these devices because we allocate > > devices and register them and then throw them all away later on if the > > device driver has already initialized the wakeup attribute. The > > implementation currently tries to avoid taking locks here so it seems > > best to optimize that path in a separate patch. > > > > Let's rename the wakeup class devices as 'wakeupN' with an IDA that's > > simple enough to just return some sort of number. In addition, let's > > make the device registering the wakeup the parent and include a 'name' > > attribute in case userspace wants to figure out the type of wakeup it is > > (in the case of virtual wakeups) or the device associated with the > > wakeup. This makes it easier for userspace to go from /sys/class/wakeup > > to a place in the device hierarchy where the wakeup is generated from > > like an input device. > > > > Cc: Tri Vo <trong@android.com> > > Cc: Kalesh Singh <kaleshsingh@google.com> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Cc: Ravi Chandra Sadineni <ravisadineni@chromium.org> > > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > > I'd rather change the commit that introduced this issue which is only > in linux-next for now.
Feel free to squash the two patches together and throw my signed-off-by on it. I forgot to add 'name' to the Documentation directory. Here's something to that effect.
-----8<----- diff --git a/Documentation/ABI/testing/sysfs-class-wakeup b/Documentation/ABI/testing/sysfs-class-wakeup index 30fb23eb9112..b83a87380d2c 100644 --- a/Documentation/ABI/testing/sysfs-class-wakeup +++ b/Documentation/ABI/testing/sysfs-class-wakeup @@ -5,6 +5,13 @@ Description: The /sys/class/wakeup/ directory contains pointers to all wakeup sources in the kernel at that moment in time. +What: /sys/class/wakeup/.../name +Date: June 2019 +Contact: Tri Vo <trong@android.com> +Description: + This file contains the name of the wakeup source when + it was created. + What: /sys/class/wakeup/.../active_count Date: June 2019 Contact: Tri Vo <trong@android.com>
| |