Message ID | 1363161681-13878-3-git-send-email-lig.fnst@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
Am 13.03.2013 09:01, schrieb liguang: > In fact, every devices have to be aware of > it's power management, so it can decide what > to do when platform board switch it's power > state between on/off/suspend/wakeup. > > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> > --- > hw/qdev-core.h | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/hw/qdev-core.h b/hw/qdev-core.h > index 2486f36..e69c50b 100644 > --- a/hw/qdev-core.h > +++ b/hw/qdev-core.h > @@ -85,6 +85,12 @@ typedef struct DeviceClass { > Property *props; > int no_user; > > + /* power management */ > + void (*on)(DeviceState *dev); > + void (*off)(DeviceState *dev); > + void (*suspend)(DeviceState *dev); > + void (*wakeup)(DeviceState *dev); > + > /* callbacks */ > void (*reset)(DeviceState *dev); > DeviceRealize realize; Whatever callbacks get added, they should be added down here and get gtk-doc documentation above the struct. That should also include some guidelines on how new devices should implement these (hint: we'd want to avoid code duplication). I have the feeling your hooks may be rather x86-specific - have you checked against any other architecture? Andreas
Thanks! 在 2013-03-18一的 09:25 +0100,Andreas Färber写道: > Am 13.03.2013 09:01, schrieb liguang: > > In fact, every devices have to be aware of > > it's power management, so it can decide what > > to do when platform board switch it's power > > state between on/off/suspend/wakeup. > > > > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> > > --- > > hw/qdev-core.h | 6 ++++++ > > 1 files changed, 6 insertions(+), 0 deletions(-) > > > > diff --git a/hw/qdev-core.h b/hw/qdev-core.h > > index 2486f36..e69c50b 100644 > > --- a/hw/qdev-core.h > > +++ b/hw/qdev-core.h > > @@ -85,6 +85,12 @@ typedef struct DeviceClass { > > Property *props; > > int no_user; > > > > + /* power management */ > > + void (*on)(DeviceState *dev); > > + void (*off)(DeviceState *dev); > > + void (*suspend)(DeviceState *dev); > > + void (*wakeup)(DeviceState *dev); > > + > > /* callbacks */ > > void (*reset)(DeviceState *dev); > > DeviceRealize realize; > > Whatever callbacks get added, they should be added down here and get > gtk-doc documentation above the struct. That should also include some > guidelines on how new devices should implement these (hint: we'd want to > avoid code duplication). OK > > I have the feeling your hooks may be rather x86-specific - have you > checked against any other architecture? > I'm considering to be generic > Andreas >
diff --git a/hw/qdev-core.h b/hw/qdev-core.h index 2486f36..e69c50b 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -85,6 +85,12 @@ typedef struct DeviceClass { Property *props; int no_user; + /* power management */ + void (*on)(DeviceState *dev); + void (*off)(DeviceState *dev); + void (*suspend)(DeviceState *dev); + void (*wakeup)(DeviceState *dev); + /* callbacks */ void (*reset)(DeviceState *dev); DeviceRealize realize;
In fact, every devices have to be aware of it's power management, so it can decide what to do when platform board switch it's power state between on/off/suspend/wakeup. Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> --- hw/qdev-core.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)