Re: [RFC 1/5] devcore introduce wakeup_event callback

Shaohua Li
2008-10-22T05:23:18Z

On Mon, Oct 20, 2008 at 03:04:16AM +0800, Rafael J. Wysocki wrote:
> On Thursday, 11 of September 2008, Shaohua Li wrote:
> > Introduce .wakeup_event(). When a device gets a wakeup event,
> > the callback is called. The callback usually should disable wakeup event.
> >
> > ---
> > include/linux/pm.h | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > Index: linux/include/linux/pm.h
> > ===================================================================
> > --- linux.orig/include/linux/pm.h 2008-09-11 10:56:27.000000000 +0800
> > +++ linux/include/linux/pm.h 2008-09-11 10:56:29.000000000 +0800
> > @@ -125,6 +125,12 @@ typedef struct pm_message {
> > * make ANY assumptions about the hardware state right prior to @restore().
> > * On most platforms, there are no restrictions on availability of
> > * resources like clocks during @restore().
> > + * @wakeup_event: Checks if a wakeup event occurs. In bus level, the op might
> > + * check all devices under the bus and call device_receive_wakeup_event()
> > + * for devices which invoke wakeup event. In device level, the op just
> > + * returns if a wakeup event occurs. Note, if device follows standard
> > + * mechanism for wakeup which bus level can handle, device level op can be
> > + * empty.
> > *
> > * All of the above callbacks, except for @complete(), return error codes.
> > * However, the error codes returned by the resume operations, @resume(),
> > @@ -151,6 +157,7 @@ struct pm_ops {
> > int (*thaw)(struct device *dev);
> > int (*poweroff)(struct device *dev);
> > int (*restore)(struct device *dev);
> > + bool (*wakeup_event)(struct device *dev);
> > };
> >
> > /**
>
> I think it will be better to place wakeup_event() in 'struct device' itself
> rather than here.
>
> Generally, the 'struct pm_ops' thing (after the simplification patch queued up
> for .29 that will be 'struct dev_pm_ops') will depend on PM_SLEEP and
> wakeup_event() is a run-time thing.
ok