Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 845f6437 authored by Stephen Boyd's avatar Stephen Boyd Committed by Tri Vo
Browse files

UPSTREAM: PM / wakeup: Register wakeup class kobj after device is added



The device_set_wakeup_enable() function can be called on a device that
hasn't been registered with device_add() yet. This allows the device to
be in a state where wakeup is enabled for it but the device isn't
published to userspace in sysfs yet.

After commit c8377adfa781 ("PM / wakeup: Show wakeup sources stats in
sysfs"), calling device_set_wakeup_enable() will fail for a device that
hasn't been registered with the driver core via device_add(). This is
because we try to create sysfs entries for the device and associate a
wakeup class kobject with it before the device has been registered.
Let's follow a similar approach that device_set_wakeup_capable() takes
here and register the wakeup class either from
device_set_wakeup_enable() when the device is already registered, or
from dpm_sysfs_add() when the device is being registered with the driver
core via device_add().

Fixes: c8377adfa781 ("PM / wakeup: Show wakeup sources stats in sysfs")
Reported-by: default avatarQian Cai <cai@lca.pw>
Reviewed-by: default avatarTri Vo <trong@android.com>
Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 2ca3d1ecb8c432ee212d80fa7615cdd5d1df62e3)
Bug: 129087298
Signed-off-by: default avatarTri Vo <trong@google.com>
Change-Id: I4851193b23a16a174d3b49c590d7fe7fce30e0f8
parent b5e87d65
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment