Messages in this thread | | | From | "Rafael J. Wysocki" <> | Date | Tue, 6 Aug 2019 23:32:27 +0200 | Subject | Re: [PATCH v7 3/3] PM / wakeup: Show wakeup sources stats in sysfs |
| |
On Tue, Aug 6, 2019 at 8:51 PM Tri Vo <trong@android.com> wrote: > > On Mon, Aug 5, 2019 at 4:29 PM Stephen Boyd <swboyd@chromium.org> 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.
| |