* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion
@ 2009-08-03 16:33 Albin Tonnerre
2009-08-03 19:23 ` Rafael J. Wysocki
2009-08-03 19:23 ` Rafael J. Wysocki
0 siblings, 2 replies; 40+ messages in thread
From: Albin Tonnerre @ 2009-08-03 16:33 UTC (permalink / raw)
To: Frans Pop, Rafael J. Wysocki; +Cc: linux-kernel, Dmitry Torokhov
On Sat, Jul 25, 2009, Frans Pop wrote:
> Yes, I see that in drivers/base/platform.c (legacy) .suspend resp. .resume
> also got called for those cases?
> Ouch :-(
This really looks like it's error-prone (I made this mistake for atmel_serial
and wouldn't have noticed if Frans hadn't told me), and AFAICS, for a number of
drivers we'll have suspend = freeze = poweroff and resume = thaw = restore.
Maybe putting something like this in pm.h would help ?
#define PM_OPS(name, suspend, resume) \
struct dev_pm_ops name = { \
.suspend = suspend, \
.resume = resume, \
.freeze = suspend, \
.thaw = resume, \
.poweroff = suspend, \
.restore = resume, \
};
Cheers,
--
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-08-03 16:33 [PATCH V2] au1xmmc: dev_pm_ops conversion Albin Tonnerre @ 2009-08-03 19:23 ` Rafael J. Wysocki 2009-08-03 19:23 ` Rafael J. Wysocki 1 sibling, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-03 19:23 UTC (permalink / raw) To: Albin Tonnerre; +Cc: Frans Pop, Dmitry Torokhov, linux-kernel, Linux PM List On Monday 03 August 2009, Albin Tonnerre wrote: > On Sat, Jul 25, 2009, Frans Pop wrote: > > Yes, I see that in drivers/base/platform.c (legacy) .suspend resp. .resume > > also got called for those cases? > > Ouch :-( > > This really looks like it's error-prone (I made this mistake for atmel_serial > and wouldn't have noticed if Frans hadn't told me), and AFAICS, for a number of > drivers we'll have suspend = freeze = poweroff and resume = thaw = restore. > Maybe putting something like this in pm.h would help ? > > #define PM_OPS(name, suspend, resume) \ > struct dev_pm_ops name = { \ > .suspend = suspend, \ > .resume = resume, \ > .freeze = suspend, \ > .thaw = resume, \ > .poweroff = suspend, \ > .restore = resume, \ > }; That looks like a good idea, but please call that macro SIMPLE_PM_OPS (or something similar) and submit a patch. Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-08-03 16:33 [PATCH V2] au1xmmc: dev_pm_ops conversion Albin Tonnerre 2009-08-03 19:23 ` Rafael J. Wysocki @ 2009-08-03 19:23 ` Rafael J. Wysocki 2009-08-04 9:36 ` [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone Albin Tonnerre 2009-08-04 9:36 ` Albin Tonnerre 1 sibling, 2 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-03 19:23 UTC (permalink / raw) To: Albin Tonnerre; +Cc: Frans Pop, linux-kernel, Dmitry Torokhov, Linux PM List On Monday 03 August 2009, Albin Tonnerre wrote: > On Sat, Jul 25, 2009, Frans Pop wrote: > > Yes, I see that in drivers/base/platform.c (legacy) .suspend resp. .resume > > also got called for those cases? > > Ouch :-( > > This really looks like it's error-prone (I made this mistake for atmel_serial > and wouldn't have noticed if Frans hadn't told me), and AFAICS, for a number of > drivers we'll have suspend = freeze = poweroff and resume = thaw = restore. > Maybe putting something like this in pm.h would help ? > > #define PM_OPS(name, suspend, resume) \ > struct dev_pm_ops name = { \ > .suspend = suspend, \ > .resume = resume, \ > .freeze = suspend, \ > .thaw = resume, \ > .poweroff = suspend, \ > .restore = resume, \ > }; That looks like a good idea, but please call that macro SIMPLE_PM_OPS (or something similar) and submit a patch. Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-03 19:23 ` Rafael J. Wysocki @ 2009-08-04 9:36 ` Albin Tonnerre 2009-08-04 9:36 ` Albin Tonnerre 1 sibling, 0 replies; 40+ messages in thread From: Albin Tonnerre @ 2009-08-04 9:36 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Frans Pop, Dmitry Torokhov, linux-kernel, Linux PM List In a number of cases, the .suspend, .freeze, .poweroff and .resume, .thaw, .restore functions are identical. However, they all need to be assigned to avoid regressionsm as the previous code called .suspend resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with this case. Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> --- include/linux/pm.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index b3f7476..994a62f 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -184,6 +184,16 @@ struct dev_pm_ops { int (*restore_noirq)(struct device *dev); }; +#define SIMPLE_PM_OPS(name, suspend_fn, resume_fn) \ +struct dev_pm_ops name = { \ + .suspend = suspend_fn, \ + .resume = resume_fn, \ + .freeze = suspend_fn, \ + .thaw = resume_fn, \ + .poweroff = suspend_fn, \ + .resume = resume_fn, \ +} + /** * PM_EVENT_ messages * -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-03 19:23 ` Rafael J. Wysocki 2009-08-04 9:36 ` [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone Albin Tonnerre @ 2009-08-04 9:36 ` Albin Tonnerre 2009-08-05 4:55 ` Dmitry Torokhov 2009-08-05 4:55 ` Dmitry Torokhov 1 sibling, 2 replies; 40+ messages in thread From: Albin Tonnerre @ 2009-08-04 9:36 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Frans Pop, linux-kernel, Dmitry Torokhov, Linux PM List In a number of cases, the .suspend, .freeze, .poweroff and .resume, .thaw, .restore functions are identical. However, they all need to be assigned to avoid regressionsm as the previous code called .suspend resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with this case. Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> --- include/linux/pm.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index b3f7476..994a62f 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -184,6 +184,16 @@ struct dev_pm_ops { int (*restore_noirq)(struct device *dev); }; +#define SIMPLE_PM_OPS(name, suspend_fn, resume_fn) \ +struct dev_pm_ops name = { \ + .suspend = suspend_fn, \ + .resume = resume_fn, \ + .freeze = suspend_fn, \ + .thaw = resume_fn, \ + .poweroff = suspend_fn, \ + .resume = resume_fn, \ +} + /** * PM_EVENT_ messages * -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-04 9:36 ` Albin Tonnerre @ 2009-08-05 4:55 ` Dmitry Torokhov 2009-08-05 4:55 ` Dmitry Torokhov 1 sibling, 0 replies; 40+ messages in thread From: Dmitry Torokhov @ 2009-08-05 4:55 UTC (permalink / raw) To: Albin Tonnerre; +Cc: Frans Pop, linux-kernel, Linux PM List On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > .thaw, .restore functions are identical. However, they all need to be > assigned to avoid regressionsm as the previous code called .suspend > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > this case. > I'd much rather have conversions done with a bit more analysis now that our framework is more flexible and we can have specialized routines for hibernation and suspend. Maybe we should try changing from run-time to build time warning so that users are not overly concerned with it? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-04 9:36 ` Albin Tonnerre 2009-08-05 4:55 ` Dmitry Torokhov @ 2009-08-05 4:55 ` Dmitry Torokhov 2009-08-05 9:37 ` Albin Tonnerre 1 sibling, 1 reply; 40+ messages in thread From: Dmitry Torokhov @ 2009-08-05 4:55 UTC (permalink / raw) To: Albin Tonnerre; +Cc: Rafael J. Wysocki, Frans Pop, linux-kernel, Linux PM List On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > .thaw, .restore functions are identical. However, they all need to be > assigned to avoid regressionsm as the previous code called .suspend > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > this case. > I'd much rather have conversions done with a bit more analysis now that our framework is more flexible and we can have specialized routines for hibernation and suspend. Maybe we should try changing from run-time to build time warning so that users are not overly concerned with it? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-05 4:55 ` Dmitry Torokhov @ 2009-08-05 9:37 ` Albin Tonnerre 0 siblings, 0 replies; 40+ messages in thread From: Albin Tonnerre @ 2009-08-05 9:37 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Frans Pop, linux-kernel, Linux PM List On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > > .thaw, .restore functions are identical. However, they all need to be > > assigned to avoid regressionsm as the previous code called .suspend > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > > this case. > I'd much rather have conversions done with a bit more analysis now that > our framework is more flexible and we can have specialized routines for > hibernation and suspend. I still think that even though they can, quite a number of drivers won't /need/ to have different functions for this, but maybe I'm mistaken. > Maybe we should try changing from run-time to build time warning so that > users are not overly concerned with it? I'm not sure that solves the problem. The fact is that even for developers, it's easy to overlook that assiging only the .suspend and .resume fields is probably a mistake. Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone @ 2009-08-05 9:37 ` Albin Tonnerre 0 siblings, 0 replies; 40+ messages in thread From: Albin Tonnerre @ 2009-08-05 9:37 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Rafael J. Wysocki, Frans Pop, linux-kernel, Linux PM List On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > > .thaw, .restore functions are identical. However, they all need to be > > assigned to avoid regressionsm as the previous code called .suspend > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > > this case. > I'd much rather have conversions done with a bit more analysis now that > our framework is more flexible and we can have specialized routines for > hibernation and suspend. I still think that even though they can, quite a number of drivers won't /need/ to have different functions for this, but maybe I'm mistaken. > Maybe we should try changing from run-time to build time warning so that > users are not overly concerned with it? I'm not sure that solves the problem. The fact is that even for developers, it's easy to overlook that assiging only the .suspend and .resume fields is probably a mistake. Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-05 9:37 ` Albin Tonnerre (?) @ 2009-08-05 18:47 ` Rafael J. Wysocki 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki 2009-08-05 20:05 ` Rafael J. Wysocki -1 siblings, 2 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-05 18:47 UTC (permalink / raw) To: Albin Tonnerre; +Cc: Dmitry Torokhov, Frans Pop, linux-kernel, Linux PM List On Wednesday 05 August 2009, Albin Tonnerre wrote: > On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : > > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > > > .thaw, .restore functions are identical. However, they all need to be > > > assigned to avoid regressionsm as the previous code called .suspend > > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > > > this case. > > > > I'd much rather have conversions done with a bit more analysis now that > > our framework is more flexible and we can have specialized routines for > > hibernation and suspend. > > I still think that even though they can, quite a number of drivers won't > /need/ to have different functions for this, but maybe I'm mistaken. > > > Maybe we should try changing from run-time to build time warning so that > > users are not overly concerned with it? > > I'm not sure that solves the problem. The fact is that even for developers, it's > easy to overlook that assiging only the .suspend and .resume fields is probably > a mistake. I agree, so I'm going to take the patch. I'll add a comment describing what the macro is for, though. Thanks, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 18:47 ` Rafael J. Wysocki @ 2009-08-05 20:05 ` Rafael J. Wysocki 2009-08-05 20:17 ` pHilipp Zabel ` (3 more replies) 2009-08-05 20:05 ` Rafael J. Wysocki 1 sibling, 4 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-05 20:05 UTC (permalink / raw) To: Albin Tonnerre Cc: Dmitry Torokhov, Frans Pop, linux-kernel, Linux PM List, Daniel Mack On Wednesday 05 August 2009, Rafael J. Wysocki wrote: > On Wednesday 05 August 2009, Albin Tonnerre wrote: > > On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : > > > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > > > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > > > > .thaw, .restore functions are identical. However, they all need to be > > > > assigned to avoid regressionsm as the previous code called .suspend > > > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > > > > this case. > > > > > > > I'd much rather have conversions done with a bit more analysis now that > > > our framework is more flexible and we can have specialized routines for > > > hibernation and suspend. > > > > I still think that even though they can, quite a number of drivers won't > > /need/ to have different functions for this, but maybe I'm mistaken. > > > > > Maybe we should try changing from run-time to build time warning so that > > > users are not overly concerned with it? > > > > I'm not sure that solves the problem. The fact is that even for developers, it's > > easy to overlook that assiging only the .suspend and .resume fields is probably > > a mistake. > > I agree, so I'm going to take the patch. > > I'll add a comment describing what the macro is for, though. Strictly speaking, I'm going to add the appended patch to the linux-next branch of the suspend-2.6 tree. Thanks, Rafael --- From: Albin Tonnerre <albin.tonnerre@free-electrons.com> Subject: PM: Add convenience macro to make switching to dev_pm_ops less error-prone In a number of cases, the .suspend, .freeze, .poweroff and .resume, .thaw, .restore functions are identical. However, they all need to be assigned to avoid regressionsm as the previous code called .suspend resp. .resume in all those cases. SIMPLE_DEV_PM_OPS helps to deal with this case. [rjw: Changed the name of the macro and added the comment explaining its purpose.] Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> --- include/linux/pm.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Index: linux-2.6/include/linux/pm.h =================================================================== --- linux-2.6.orig/include/linux/pm.h +++ linux-2.6/include/linux/pm.h @@ -184,6 +184,20 @@ struct dev_pm_ops { int (*restore_noirq)(struct device *dev); }; +/* + * Use this if you want to use the same suspend and resume callbacks for suspend + * to RAM and hibernation. + */ +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ +struct dev_pm_ops name = { \ + .suspend = suspend_fn, \ + .resume = resume_fn, \ + .freeze = suspend_fn, \ + .thaw = resume_fn, \ + .poweroff = suspend_fn, \ + .resume = resume_fn, \ +} + /** * PM_EVENT_ messages * ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki @ 2009-08-05 20:17 ` pHilipp Zabel 2009-08-05 20:17 ` pHilipp Zabel ` (2 subsequent siblings) 3 siblings, 0 replies; 40+ messages in thread From: pHilipp Zabel @ 2009-08-05 20:17 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Albin Tonnerre, Dmitry Torokhov, Frans Pop, linux-kernel, Linux PM List, Daniel Mack On Wed, Aug 5, 2009 at 10:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote: > On Wednesday 05 August 2009, Rafael J. Wysocki wrote: >> On Wednesday 05 August 2009, Albin Tonnerre wrote: >> > On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : >> > > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: >> > > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, >> > > > .thaw, .restore functions are identical. However, they all need to be >> > > > assigned to avoid regressionsm as the previous code called .suspend >> > > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with >> > > > this case. >> > >> > >> > > I'd much rather have conversions done with a bit more analysis now that >> > > our framework is more flexible and we can have specialized routines for >> > > hibernation and suspend. >> > >> > I still think that even though they can, quite a number of drivers won't >> > /need/ to have different functions for this, but maybe I'm mistaken. >> > >> > > Maybe we should try changing from run-time to build time warning so that >> > > users are not overly concerned with it? >> > >> > I'm not sure that solves the problem. The fact is that even for developers, it's >> > easy to overlook that assiging only the .suspend and .resume fields is probably >> > a mistake. >> >> I agree, so I'm going to take the patch. >> >> I'll add a comment describing what the macro is for, though. > > Strictly speaking, I'm going to add the appended patch to the linux-next > branch of the suspend-2.6 tree. > > Thanks, > Rafael > > --- > From: Albin Tonnerre <albin.tonnerre@free-electrons.com> > Subject: PM: Add convenience macro to make switching to dev_pm_ops less error-prone > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > .thaw, .restore functions are identical. However, they all need to be > assigned to avoid regressionsm as the previous code called .suspend > resp. .resume in all those cases. SIMPLE_DEV_PM_OPS helps to deal > with this case. > > [rjw: Changed the name of the macro and added the comment explaining its > purpose.] > > Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> > --- > include/linux/pm.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > Index: linux-2.6/include/linux/pm.h > =================================================================== > --- linux-2.6.orig/include/linux/pm.h > +++ linux-2.6/include/linux/pm.h > @@ -184,6 +184,20 @@ struct dev_pm_ops { > int (*restore_noirq)(struct device *dev); > }; > > +/* > + * Use this if you want to use the same suspend and resume callbacks for suspend > + * to RAM and hibernation. > + */ > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > +struct dev_pm_ops name = { \ > + .suspend = suspend_fn, \ > + .resume = resume_fn, \ > + .freeze = suspend_fn, \ > + .thaw = resume_fn, \ > + .poweroff = suspend_fn, \ > + .resume = resume_fn, \ I think that second .resume was intended to be .restore instead. regards Philipp ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki 2009-08-05 20:17 ` pHilipp Zabel @ 2009-08-05 20:17 ` pHilipp Zabel 2009-08-05 20:22 ` Frans Pop 2009-08-05 20:22 ` Frans Pop 3 siblings, 0 replies; 40+ messages in thread From: pHilipp Zabel @ 2009-08-05 20:17 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Frans Pop, Dmitry Torokhov, linux-kernel, Daniel Mack, Linux PM List, Albin Tonnerre On Wed, Aug 5, 2009 at 10:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote: > On Wednesday 05 August 2009, Rafael J. Wysocki wrote: >> On Wednesday 05 August 2009, Albin Tonnerre wrote: >> > On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : >> > > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: >> > > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, >> > > > .thaw, .restore functions are identical. However, they all need to be >> > > > assigned to avoid regressionsm as the previous code called .suspend >> > > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with >> > > > this case. >> > >> > >> > > I'd much rather have conversions done with a bit more analysis now that >> > > our framework is more flexible and we can have specialized routines for >> > > hibernation and suspend. >> > >> > I still think that even though they can, quite a number of drivers won't >> > /need/ to have different functions for this, but maybe I'm mistaken. >> > >> > > Maybe we should try changing from run-time to build time warning so that >> > > users are not overly concerned with it? >> > >> > I'm not sure that solves the problem. The fact is that even for developers, it's >> > easy to overlook that assiging only the .suspend and .resume fields is probably >> > a mistake. >> >> I agree, so I'm going to take the patch. >> >> I'll add a comment describing what the macro is for, though. > > Strictly speaking, I'm going to add the appended patch to the linux-next > branch of the suspend-2.6 tree. > > Thanks, > Rafael > > --- > From: Albin Tonnerre <albin.tonnerre@free-electrons.com> > Subject: PM: Add convenience macro to make switching to dev_pm_ops less error-prone > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > .thaw, .restore functions are identical. However, they all need to be > assigned to avoid regressionsm as the previous code called .suspend > resp. .resume in all those cases. SIMPLE_DEV_PM_OPS helps to deal > with this case. > > [rjw: Changed the name of the macro and added the comment explaining its > purpose.] > > Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> > --- > include/linux/pm.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > Index: linux-2.6/include/linux/pm.h > =================================================================== > --- linux-2.6.orig/include/linux/pm.h > +++ linux-2.6/include/linux/pm.h > @@ -184,6 +184,20 @@ struct dev_pm_ops { > int (*restore_noirq)(struct device *dev); > }; > > +/* > + * Use this if you want to use the same suspend and resume callbacks for suspend > + * to RAM and hibernation. > + */ > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > +struct dev_pm_ops name = { \ > + .suspend = suspend_fn, \ > + .resume = resume_fn, \ > + .freeze = suspend_fn, \ > + .thaw = resume_fn, \ > + .poweroff = suspend_fn, \ > + .resume = resume_fn, \ I think that second .resume was intended to be .restore instead. regards Philipp ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki 2009-08-05 20:17 ` pHilipp Zabel 2009-08-05 20:17 ` pHilipp Zabel @ 2009-08-05 20:22 ` Frans Pop 2009-08-05 20:22 ` Frans Pop 3 siblings, 0 replies; 40+ messages in thread From: Frans Pop @ 2009-08-05 20:22 UTC (permalink / raw) To: Rafael J. Wysocki Cc: elendil, dmitry.torokhov, linux-kernel, daniel, linux-pm, albin.tonnerre Rafael J. Wysocki wrote: > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > +struct dev_pm_ops name = { \ > + .suspend = suspend_fn, \ > + .resume = resume_fn, \ > + .freeze = suspend_fn, \ > + .thaw = resume_fn, \ > + .poweroff = suspend_fn, \ > + .resume = resume_fn, \ That defines .resume twice. Guess the last should be restore. Cheers, FJP ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki ` (2 preceding siblings ...) 2009-08-05 20:22 ` Frans Pop @ 2009-08-05 20:22 ` Frans Pop 2009-08-05 21:30 ` Rafael J. Wysocki 2009-08-05 21:30 ` Rafael J. Wysocki 3 siblings, 2 replies; 40+ messages in thread From: Frans Pop @ 2009-08-05 20:22 UTC (permalink / raw) To: Rafael J. Wysocki Cc: albin.tonnerre, dmitry.torokhov, elendil, linux-kernel, linux-pm, daniel Rafael J. Wysocki wrote: > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > +struct dev_pm_ops name = { \ > + .suspend = suspend_fn, \ > + .resume = resume_fn, \ > + .freeze = suspend_fn, \ > + .thaw = resume_fn, \ > + .poweroff = suspend_fn, \ > + .resume = resume_fn, \ That defines .resume twice. Guess the last should be restore. Cheers, FJP ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 20:22 ` Frans Pop @ 2009-08-05 21:30 ` Rafael J. Wysocki 2009-08-06 8:51 ` Daniel Mack 2009-08-06 8:51 ` Daniel Mack 2009-08-05 21:30 ` Rafael J. Wysocki 1 sibling, 2 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-05 21:30 UTC (permalink / raw) To: Frans Pop, pHilipp Zabel Cc: albin.tonnerre, dmitry.torokhov, linux-kernel, linux-pm, daniel On Wednesday 05 August 2009, Frans Pop wrote: > Rafael J. Wysocki wrote: > > > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > > +struct dev_pm_ops name = { \ > > + .suspend = suspend_fn, \ > > + .resume = resume_fn, \ > > + .freeze = suspend_fn, \ > > + .thaw = resume_fn, \ > > + .poweroff = suspend_fn, \ > > + .resume = resume_fn, \ > > That defines .resume twice. Guess the last should be restore. Yes, thanks to you and Philipp for noticing that and sorry for the mistake. Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 21:30 ` Rafael J. Wysocki @ 2009-08-06 8:51 ` Daniel Mack 2009-08-06 8:51 ` Daniel Mack 1 sibling, 0 replies; 40+ messages in thread From: Daniel Mack @ 2009-08-06 8:51 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Frans Pop, dmitry.torokhov, linux-kernel, pHilipp Zabel, linux-pm, albin.tonnerre On Wed, Aug 05, 2009 at 11:30:07PM +0200, Rafael J. Wysocki wrote: > On Wednesday 05 August 2009, Frans Pop wrote: > > Rafael J. Wysocki wrote: > > > > > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > > > +struct dev_pm_ops name = { \ > > > + .suspend = suspend_fn, \ > > > + .resume = resume_fn, \ > > > + .freeze = suspend_fn, \ > > > + .thaw = resume_fn, \ > > > + .poweroff = suspend_fn, \ > > > + .resume = resume_fn, \ > > > > That defines .resume twice. Guess the last should be restore. > > Yes, thanks to you and Philipp for noticing that and sorry for the mistake. When is a good point to resend patches that use this macro? I guess they won't make it to .31 anyway, right? So I just wait for the next merge window? Daniel ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 21:30 ` Rafael J. Wysocki 2009-08-06 8:51 ` Daniel Mack @ 2009-08-06 8:51 ` Daniel Mack 2009-08-06 12:16 ` Rafael J. Wysocki 2009-08-06 12:16 ` Rafael J. Wysocki 1 sibling, 2 replies; 40+ messages in thread From: Daniel Mack @ 2009-08-06 8:51 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Frans Pop, pHilipp Zabel, albin.tonnerre, dmitry.torokhov, linux-kernel, linux-pm On Wed, Aug 05, 2009 at 11:30:07PM +0200, Rafael J. Wysocki wrote: > On Wednesday 05 August 2009, Frans Pop wrote: > > Rafael J. Wysocki wrote: > > > > > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > > > +struct dev_pm_ops name = { \ > > > + .suspend = suspend_fn, \ > > > + .resume = resume_fn, \ > > > + .freeze = suspend_fn, \ > > > + .thaw = resume_fn, \ > > > + .poweroff = suspend_fn, \ > > > + .resume = resume_fn, \ > > > > That defines .resume twice. Guess the last should be restore. > > Yes, thanks to you and Philipp for noticing that and sorry for the mistake. When is a good point to resend patches that use this macro? I guess they won't make it to .31 anyway, right? So I just wait for the next merge window? Daniel ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-06 8:51 ` Daniel Mack @ 2009-08-06 12:16 ` Rafael J. Wysocki 2009-08-06 13:10 ` Magnus Damm 2009-08-06 12:16 ` Rafael J. Wysocki 1 sibling, 1 reply; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-06 12:16 UTC (permalink / raw) To: Daniel Mack Cc: Frans Pop, pHilipp Zabel, albin.tonnerre, dmitry.torokhov, linux-kernel, linux-pm On Thursday 06 August 2009, Daniel Mack wrote: > On Wed, Aug 05, 2009 at 11:30:07PM +0200, Rafael J. Wysocki wrote: > > On Wednesday 05 August 2009, Frans Pop wrote: > > > Rafael J. Wysocki wrote: > > > > > > > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > > > > +struct dev_pm_ops name = { \ > > > > + .suspend = suspend_fn, \ > > > > + .resume = resume_fn, \ > > > > + .freeze = suspend_fn, \ > > > > + .thaw = resume_fn, \ > > > > + .poweroff = suspend_fn, \ > > > > + .resume = resume_fn, \ > > > > > > That defines .resume twice. Guess the last should be restore. > > > > Yes, thanks to you and Philipp for noticing that and sorry for the mistake. > > When is a good point to resend patches that use this macro? I guess they > won't make it to .31 anyway, right? So I just wait for the next merge > window? Yes, I think that would be the right thing to do. Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-06 12:16 ` Rafael J. Wysocki @ 2009-08-06 13:10 ` Magnus Damm 0 siblings, 0 replies; 40+ messages in thread From: Magnus Damm @ 2009-08-06 13:10 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Daniel Mack, Frans Pop, dmitry.torokhov, linux-kernel, pHilipp Zabel, linux-pm, albin.tonnerre On Thu, Aug 6, 2009 at 9:16 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote: > On Thursday 06 August 2009, Daniel Mack wrote: >> When is a good point to resend patches that use this macro? I guess they >> won't make it to .31 anyway, right? So I just wait for the next merge >> window? > > Yes, I think that would be the right thing to do. Is it a good idea to disable the warning before the final 2.6.31 release? Cheers, / magnus ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone @ 2009-08-06 13:10 ` Magnus Damm 0 siblings, 0 replies; 40+ messages in thread From: Magnus Damm @ 2009-08-06 13:10 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Daniel Mack, Frans Pop, pHilipp Zabel, albin.tonnerre, dmitry.torokhov, linux-kernel, linux-pm On Thu, Aug 6, 2009 at 9:16 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote: > On Thursday 06 August 2009, Daniel Mack wrote: >> When is a good point to resend patches that use this macro? I guess they >> won't make it to .31 anyway, right? So I just wait for the next merge >> window? > > Yes, I think that would be the right thing to do. Is it a good idea to disable the warning before the final 2.6.31 release? Cheers, / magnus ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-06 13:10 ` Magnus Damm (?) @ 2009-08-06 15:14 ` Rafael J. Wysocki -1 siblings, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-06 15:14 UTC (permalink / raw) To: Magnus Damm Cc: Daniel Mack, Frans Pop, pHilipp Zabel, albin.tonnerre, dmitry.torokhov, linux-kernel, linux-pm On Thursday 06 August 2009, Magnus Damm wrote: > On Thu, Aug 6, 2009 at 9:16 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote: > > On Thursday 06 August 2009, Daniel Mack wrote: > >> When is a good point to resend patches that use this macro? I guess they > >> won't make it to .31 anyway, right? So I just wait for the next merge > >> window? > > > > Yes, I think that would be the right thing to do. > > Is it a good idea to disable the warning before the final 2.6.31 release? I guess so. Let's disable it. Thanks, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-06 13:10 ` Magnus Damm (?) (?) @ 2009-08-06 15:14 ` Rafael J. Wysocki -1 siblings, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-06 15:14 UTC (permalink / raw) To: Magnus Damm Cc: Daniel Mack, Frans Pop, dmitry.torokhov, linux-kernel, pHilipp Zabel, linux-pm, albin.tonnerre On Thursday 06 August 2009, Magnus Damm wrote: > On Thu, Aug 6, 2009 at 9:16 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote: > > On Thursday 06 August 2009, Daniel Mack wrote: > >> When is a good point to resend patches that use this macro? I guess they > >> won't make it to .31 anyway, right? So I just wait for the next merge > >> window? > > > > Yes, I think that would be the right thing to do. > > Is it a good idea to disable the warning before the final 2.6.31 release? I guess so. Let's disable it. Thanks, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-06 8:51 ` Daniel Mack 2009-08-06 12:16 ` Rafael J. Wysocki @ 2009-08-06 12:16 ` Rafael J. Wysocki 1 sibling, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-06 12:16 UTC (permalink / raw) To: Daniel Mack Cc: Frans Pop, dmitry.torokhov, linux-kernel, pHilipp Zabel, linux-pm, albin.tonnerre On Thursday 06 August 2009, Daniel Mack wrote: > On Wed, Aug 05, 2009 at 11:30:07PM +0200, Rafael J. Wysocki wrote: > > On Wednesday 05 August 2009, Frans Pop wrote: > > > Rafael J. Wysocki wrote: > > > > > > > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > > > > +struct dev_pm_ops name = { \ > > > > + .suspend = suspend_fn, \ > > > > + .resume = resume_fn, \ > > > > + .freeze = suspend_fn, \ > > > > + .thaw = resume_fn, \ > > > > + .poweroff = suspend_fn, \ > > > > + .resume = resume_fn, \ > > > > > > That defines .resume twice. Guess the last should be restore. > > > > Yes, thanks to you and Philipp for noticing that and sorry for the mistake. > > When is a good point to resend patches that use this macro? I guess they > won't make it to .31 anyway, right? So I just wait for the next merge > window? Yes, I think that would be the right thing to do. Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 20:22 ` Frans Pop 2009-08-05 21:30 ` Rafael J. Wysocki @ 2009-08-05 21:30 ` Rafael J. Wysocki 1 sibling, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-05 21:30 UTC (permalink / raw) To: Frans Pop, pHilipp Zabel Cc: linux-pm, albin.tonnerre, dmitry.torokhov, linux-kernel, daniel On Wednesday 05 August 2009, Frans Pop wrote: > Rafael J. Wysocki wrote: > > > +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ > > +struct dev_pm_ops name = { \ > > + .suspend = suspend_fn, \ > > + .resume = resume_fn, \ > > + .freeze = suspend_fn, \ > > + .thaw = resume_fn, \ > > + .poweroff = suspend_fn, \ > > + .resume = resume_fn, \ > > That defines .resume twice. Guess the last should be restore. Yes, thanks to you and Philipp for noticing that and sorry for the mistake. Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH] PM: Add convenience macro to make switching to dev_pm_ops less error-prone 2009-08-05 18:47 ` Rafael J. Wysocki 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki @ 2009-08-05 20:05 ` Rafael J. Wysocki 1 sibling, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-05 20:05 UTC (permalink / raw) To: Albin Tonnerre Cc: Frans Pop, Dmitry Torokhov, linux-kernel, Daniel Mack, Linux PM List On Wednesday 05 August 2009, Rafael J. Wysocki wrote: > On Wednesday 05 August 2009, Albin Tonnerre wrote: > > On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : > > > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > > > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > > > > .thaw, .restore functions are identical. However, they all need to be > > > > assigned to avoid regressionsm as the previous code called .suspend > > > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > > > > this case. > > > > > > > I'd much rather have conversions done with a bit more analysis now that > > > our framework is more flexible and we can have specialized routines for > > > hibernation and suspend. > > > > I still think that even though they can, quite a number of drivers won't > > /need/ to have different functions for this, but maybe I'm mistaken. > > > > > Maybe we should try changing from run-time to build time warning so that > > > users are not overly concerned with it? > > > > I'm not sure that solves the problem. The fact is that even for developers, it's > > easy to overlook that assiging only the .suspend and .resume fields is probably > > a mistake. > > I agree, so I'm going to take the patch. > > I'll add a comment describing what the macro is for, though. Strictly speaking, I'm going to add the appended patch to the linux-next branch of the suspend-2.6 tree. Thanks, Rafael --- From: Albin Tonnerre <albin.tonnerre@free-electrons.com> Subject: PM: Add convenience macro to make switching to dev_pm_ops less error-prone In a number of cases, the .suspend, .freeze, .poweroff and .resume, .thaw, .restore functions are identical. However, they all need to be assigned to avoid regressionsm as the previous code called .suspend resp. .resume in all those cases. SIMPLE_DEV_PM_OPS helps to deal with this case. [rjw: Changed the name of the macro and added the comment explaining its purpose.] Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> --- include/linux/pm.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Index: linux-2.6/include/linux/pm.h =================================================================== --- linux-2.6.orig/include/linux/pm.h +++ linux-2.6/include/linux/pm.h @@ -184,6 +184,20 @@ struct dev_pm_ops { int (*restore_noirq)(struct device *dev); }; +/* + * Use this if you want to use the same suspend and resume callbacks for suspend + * to RAM and hibernation. + */ +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ +struct dev_pm_ops name = { \ + .suspend = suspend_fn, \ + .resume = resume_fn, \ + .freeze = suspend_fn, \ + .thaw = resume_fn, \ + .poweroff = suspend_fn, \ + .resume = resume_fn, \ +} + /** * PM_EVENT_ messages * ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone 2009-08-05 9:37 ` Albin Tonnerre (?) (?) @ 2009-08-05 18:47 ` Rafael J. Wysocki -1 siblings, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-08-05 18:47 UTC (permalink / raw) To: Albin Tonnerre; +Cc: Frans Pop, Dmitry Torokhov, linux-kernel, Linux PM List On Wednesday 05 August 2009, Albin Tonnerre wrote: > On Tue, Aug 04, 2009 at 09:55:33PM -0700, Dmitry Torokhov wrote : > > On Tue, Aug 04, 2009 at 11:36:12AM +0200, Albin Tonnerre wrote: > > > In a number of cases, the .suspend, .freeze, .poweroff and .resume, > > > .thaw, .restore functions are identical. However, they all need to be > > > assigned to avoid regressionsm as the previous code called .suspend > > > resp. .resume in all those cases. SIMPLE_PM_OPS allows to deal with > > > this case. > > > > I'd much rather have conversions done with a bit more analysis now that > > our framework is more flexible and we can have specialized routines for > > hibernation and suspend. > > I still think that even though they can, quite a number of drivers won't > /need/ to have different functions for this, but maybe I'm mistaken. > > > Maybe we should try changing from run-time to build time warning so that > > users are not overly concerned with it? > > I'm not sure that solves the problem. The fact is that even for developers, it's > easy to overlook that assiging only the .suspend and .resume fields is probably > a mistake. I agree, so I'm going to take the patch. I'll add a comment describing what the macro is for, though. Thanks, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH V2] au1xmmc: dev_pm_ops conversion @ 2009-07-22 15:18 Manuel Lauss 2009-07-25 17:44 ` Dmitry Torokhov 0 siblings, 1 reply; 40+ messages in thread From: Manuel Lauss @ 2009-07-22 15:18 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mips, Manuel Lauss, Frans Pop Cc: Frans Pop <elendil@planet.nl> Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> --- V1->V2: don't remove CONFIG_PM drivers/mmc/host/au1xmmc.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index d3f5561..2d4e20f 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1132,12 +1132,12 @@ static int __devexit au1xmmc_remove(struct platform_device *pdev) } #ifdef CONFIG_PM -static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state) +static int au1xmmc_suspend(struct device *dev) { - struct au1xmmc_host *host = platform_get_drvdata(pdev); + struct au1xmmc_host *host = dev_get_drvdata(dev); int ret; - ret = mmc_suspend_host(host->mmc, state); + ret = mmc_suspend_host(host->mmc, PMSG_SUSPEND); if (ret) return ret; @@ -1150,27 +1150,33 @@ static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int au1xmmc_resume(struct platform_device *pdev) +static int au1xmmc_resume(struct device *dev) { - struct au1xmmc_host *host = platform_get_drvdata(pdev); + struct au1xmmc_host *host = dev_get_drvdata(dev); au1xmmc_reset_controller(host); return mmc_resume_host(host->mmc); } + +static struct dev_pm_ops au1xmmc_pmops = { + .resume = au1xmmc_resume, + .suspend = au1xmmc_suspend, +}; + +#define AU1XMMC_PMOPS &au1xmmc_pmops + #else -#define au1xmmc_suspend NULL -#define au1xmmc_resume NULL +#define AU1XMMC_PMOPS NULL #endif static struct platform_driver au1xmmc_driver = { .probe = au1xmmc_probe, .remove = au1xmmc_remove, - .suspend = au1xmmc_suspend, - .resume = au1xmmc_resume, .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, + .pm = AU1XMMC_PMOPS, }, }; -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-22 15:18 [PATCH V2] au1xmmc: dev_pm_ops conversion Manuel Lauss @ 2009-07-25 17:44 ` Dmitry Torokhov 2009-07-25 18:15 ` Manuel Lauss 2009-07-25 18:18 ` Frans Pop 0 siblings, 2 replies; 40+ messages in thread From: Dmitry Torokhov @ 2009-07-25 17:44 UTC (permalink / raw) To: Manuel Lauss; +Cc: linux-kernel, linux-mips, Manuel Lauss, Frans Pop Hi Manuel, On Wed, Jul 22, 2009 at 05:18:39PM +0200, Manuel Lauss wrote: > Cc: Frans Pop <elendil@planet.nl> > Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> > > + > +static struct dev_pm_ops au1xmmc_pmops = { > + .resume = au1xmmc_resume, > + .suspend = au1xmmc_suspend, > +}; > + Was suspend to disk tested? It requires freeze()/thaw(). -- Dmitry ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 17:44 ` Dmitry Torokhov @ 2009-07-25 18:15 ` Manuel Lauss 2009-07-25 18:18 ` Frans Pop 1 sibling, 0 replies; 40+ messages in thread From: Manuel Lauss @ 2009-07-25 18:15 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-kernel, linux-mips, Manuel Lauss, Frans Pop On Sat, Jul 25, 2009 at 7:44 PM, Dmitry Torokhov<dmitry.torokhov@gmail.com> wrote: > Hi Manuel, > > On Wed, Jul 22, 2009 at 05:18:39PM +0200, Manuel Lauss wrote: >> Cc: Frans Pop <elendil@planet.nl> >> Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> >> >> + >> +static struct dev_pm_ops au1xmmc_pmops = { >> + .resume = au1xmmc_resume, >> + .suspend = au1xmmc_suspend, >> +}; >> + > > Was suspend to disk tested? It requires freeze()/thaw(). No, only suspend-to-ram, but that's good to know. Currently for me only STR is important (and testable), I'll have to check wheter STD works on MIPS with my test hardware. Thank you! Manuel Lauss ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 17:44 ` Dmitry Torokhov 2009-07-25 18:15 ` Manuel Lauss @ 2009-07-25 18:18 ` Frans Pop 2009-07-25 19:10 ` Dmitry Torokhov 1 sibling, 1 reply; 40+ messages in thread From: Frans Pop @ 2009-07-25 18:18 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss On Saturday 25 July 2009, Dmitry Torokhov wrote: > On Wed, Jul 22, 2009 at 05:18:39PM +0200, Manuel Lauss wrote: > > Cc: Frans Pop <elendil@planet.nl> > > Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> > > > > + > > +static struct dev_pm_ops au1xmmc_pmops = { > > + .resume = au1xmmc_resume, > > + .suspend = au1xmmc_suspend, > > +}; > > + > > Was suspend to disk tested? It requires freeze()/thaw(). Is that a regression introduced by this patch then? If so, many more of the recent dev_pm_ops conversion patches would need to be revisited. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 18:18 ` Frans Pop @ 2009-07-25 19:10 ` Dmitry Torokhov 2009-07-25 19:39 ` Rafael J. Wysocki 0 siblings, 1 reply; 40+ messages in thread From: Dmitry Torokhov @ 2009-07-25 19:10 UTC (permalink / raw) To: Frans Pop Cc: Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss, Rafael J. Wysocki On Sat, Jul 25, 2009 at 08:18:58PM +0200, Frans Pop wrote: > On Saturday 25 July 2009, Dmitry Torokhov wrote: > > On Wed, Jul 22, 2009 at 05:18:39PM +0200, Manuel Lauss wrote: > > > Cc: Frans Pop <elendil@planet.nl> > > > Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> > > > > > > + > > > +static struct dev_pm_ops au1xmmc_pmops = { > > > + .resume = au1xmmc_resume, > > > + .suspend = au1xmmc_suspend, > > > +}; > > > + > > > > Was suspend to disk tested? It requires freeze()/thaw(). > > Is that a regression introduced by this patch then? If so, many more of > the recent dev_pm_ops conversion patches would need to be revisited. Yes, as far as I understand they would. Let's ask Rafael to confirm... -- Dmitry ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 19:10 ` Dmitry Torokhov @ 2009-07-25 19:39 ` Rafael J. Wysocki 2009-07-25 20:21 ` Frans Pop 2009-07-26 15:08 ` Mark Brown 0 siblings, 2 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-07-25 19:39 UTC (permalink / raw) To: Dmitry Torokhov, Frans Pop Cc: Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss On Saturday 25 July 2009, Dmitry Torokhov wrote: > On Sat, Jul 25, 2009 at 08:18:58PM +0200, Frans Pop wrote: > > On Saturday 25 July 2009, Dmitry Torokhov wrote: > > > On Wed, Jul 22, 2009 at 05:18:39PM +0200, Manuel Lauss wrote: > > > > Cc: Frans Pop <elendil@planet.nl> > > > > Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> > > > > > > > > + > > > > +static struct dev_pm_ops au1xmmc_pmops = { > > > > + .resume = au1xmmc_resume, > > > > + .suspend = au1xmmc_suspend, > > > > +}; > > > > + > > > > > > Was suspend to disk tested? It requires freeze()/thaw(). > > > > Is that a regression introduced by this patch then? If so, many more of > > the recent dev_pm_ops conversion patches would need to be revisited. > > Yes, as far as I understand they would. Let's ask Rafael to confirm... Yes, they would. In general, you'd probably want to do something like this: static struct dev_pm_ops au1xmmc_pmops = { .resume = au1xmmc_resume, .suspend = au1xmmc_suspend, .freeze = au1xmmc_resume, .thaw = au1xmmc_suspend, .restore = au1xmmc_resume, .poweroff = au1xmmc_suspend, }; but in this particular case it's probably better to define separate callbacks for .freeze() and .thaw() at least. During hibernation we call .freeze() and .thaw() before and after creating the image, respectively, and then .poweroff() is called right after the image has been saved. During resume .freeze() is called after the image has been loaded and before the control goes to the image kernel, which then calls .restore(). HTH I see I forgot about that myself. I'll fix up the floppy and hp-wmi patches. Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 19:39 ` Rafael J. Wysocki @ 2009-07-25 20:21 ` Frans Pop 2009-07-25 20:38 ` Frans Pop 2009-07-25 21:41 ` Dmitry Torokhov 2009-07-26 15:08 ` Mark Brown 1 sibling, 2 replies; 40+ messages in thread From: Frans Pop @ 2009-07-25 20:21 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Dmitry Torokhov, Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss, Arnaud Faucher, Erik Ekman, Mark Brown On Saturday 25 July 2009, Rafael J. Wysocki wrote: > > > > Was suspend to disk tested? It requires freeze()/thaw(). > > > > > > Is that a regression introduced by this patch then? If so, many > > > more of the recent dev_pm_ops conversion patches would need to be > > > revisited. > > Yes, they would. In general, you'd probably want to do something like > this: > > static struct dev_pm_ops au1xmmc_pmops = { > .resume = au1xmmc_resume, > .suspend = au1xmmc_suspend, > .freeze = au1xmmc_resume, > .thaw = au1xmmc_suspend, > .restore = au1xmmc_resume, > .poweroff = au1xmmc_suspend, > }; > > but in this particular case it's probably better to define separate > callbacks for .freeze() and .thaw() at least. > > During hibernation we call .freeze() and .thaw() before and after > creating the image, respectively, and then .poweroff() is called right > after the image has been saved. During resume .freeze() is called > after the image has been loaded and before the control goes to the > image kernel, which then calls .restore(). Yes, I see that in drivers/base/platform.c (legacy) .suspend resp. .resume also got called for those cases? Ouch :-( I've added others who've submitted dev_pm_ops patches in CC. > I'll fix up the floppy and hp-wmi patches. Note that those are already in mainline, as is pcspkr. Thanks, FJP ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 20:21 ` Frans Pop @ 2009-07-25 20:38 ` Frans Pop 2009-07-25 21:06 ` Rafael J. Wysocki 2009-07-25 21:41 ` Dmitry Torokhov 1 sibling, 1 reply; 40+ messages in thread From: Frans Pop @ 2009-07-25 20:38 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Dmitry Torokhov, Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss, Arnaud Faucher, Erik Ekman, Mark Brown, Paul Mundt On Saturday 25 July 2009, you wrote: > > I'll fix up the floppy and hp-wmi patches. > > Note that those are already in mainline, as is pcspkr. Here's an overview of commits (that I could find) already in mainline that look to have gotten it wrong: 6daa79b3 drivers/serial/sh-sci.c (Paul Mundt) 2dbc8a23 drivers/video/hitfb.c (Paul Mundt) 35db715b drivers/input/misc/pcspkr.c (/me) 2702403c drivers/platform/x86/hp-wmi.c (/me) 142a735b drivers/block/floppy.c (/me) ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 20:38 ` Frans Pop @ 2009-07-25 21:06 ` Rafael J. Wysocki 2009-07-25 21:30 ` Frans Pop 0 siblings, 1 reply; 40+ messages in thread From: Rafael J. Wysocki @ 2009-07-25 21:06 UTC (permalink / raw) To: Frans Pop Cc: Dmitry Torokhov, Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss, Arnaud Faucher, Erik Ekman, Mark Brown, Paul Mundt On Saturday 25 July 2009, Frans Pop wrote: > On Saturday 25 July 2009, you wrote: > > > I'll fix up the floppy and hp-wmi patches. > > > > Note that those are already in mainline, as is pcspkr. > > Here's an overview of commits (that I could find) already in mainline that > look to have gotten it wrong: > > 6daa79b3 drivers/serial/sh-sci.c (Paul Mundt) > 2dbc8a23 drivers/video/hitfb.c (Paul Mundt) > 35db715b drivers/input/misc/pcspkr.c (/me) > 2702403c drivers/platform/x86/hp-wmi.c (/me) > 142a735b drivers/block/floppy.c (/me) Are you sure they're all in mainline? The last change in mainline floppy.c happened on Jun 30 and I have the last two (fixed up already) in my linux-next branch. Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 21:06 ` Rafael J. Wysocki @ 2009-07-25 21:30 ` Frans Pop 0 siblings, 0 replies; 40+ messages in thread From: Frans Pop @ 2009-07-25 21:30 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Dmitry Torokhov, Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss, Arnaud Faucher, Erik Ekman, Mark Brown, Paul Mundt On Saturday 25 July 2009, Rafael J. Wysocki wrote: > On Saturday 25 July 2009, Frans Pop wrote: > > On Saturday 25 July 2009, you wrote: > > > > I'll fix up the floppy and hp-wmi patches. > > > > > > Note that those are already in mainline, as is pcspkr. > > > > Here's an overview of commits (that I could find) already in mainline > > that look to have gotten it wrong: > > > > 6daa79b3 drivers/serial/sh-sci.c (Paul Mundt) > > 2dbc8a23 drivers/video/hitfb.c (Paul Mundt) > > 35db715b drivers/input/misc/pcspkr.c (/me) > > 2702403c drivers/platform/x86/hp-wmi.c (/me) > > 142a735b drivers/block/floppy.c (/me) > > Are you sure they're all in mainline? Ugh, you're right. Only the first three are. For the last two I was confused by the mails from akm that he'd dropped them from his queue. I'd not realized that was because you took them. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 20:21 ` Frans Pop 2009-07-25 20:38 ` Frans Pop @ 2009-07-25 21:41 ` Dmitry Torokhov 1 sibling, 0 replies; 40+ messages in thread From: Dmitry Torokhov @ 2009-07-25 21:41 UTC (permalink / raw) To: Frans Pop Cc: Rafael J. Wysocki, Manuel Lauss, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Manuel Lauss, Arnaud Faucher, Erik Ekman, Mark Brown On Jul 25, 2009, at 1:21 PM, Frans Pop <elendil@planet.nl> wrote: > On Saturday 25 July 2009, Rafael J. Wysocki wrote: >>>>> Was suspend to disk tested? It requires freeze()/thaw(). >>>> >>>> Is that a regression introduced by this patch then? If so, many >>>> more of the recent dev_pm_ops conversion patches would need to be >>>> revisited. >> >> Yes, they would. In general, you'd probably want to do something >> like >> this: >> >> static struct dev_pm_ops au1xmmc_pmops = { >> .resume = au1xmmc_resume, >> .suspend = au1xmmc_suspend, >> .freeze = au1xmmc_resume, >> .thaw = au1xmmc_suspend, >> .restore = au1xmmc_resume, >> .poweroff = au1xmmc_suspend, >> }; >> >> but in this particular case it's probably better to define separate >> callbacks for .freeze() and .thaw() at least. >> >> During hibernation we call .freeze() and .thaw() before and after >> creating the image, respectively, and then .poweroff() is called >> right >> after the image has been saved. During resume .freeze() is called >> after the image has been loaded and before the control goes to the >> image kernel, which then calls .restore(). > > Yes, I see that in drivers/base/platform.c (legacy) .suspend > resp. .resume > also got called for those cases? > Ouch :-( > > I've added others who've submitted dev_pm_ops patches in CC. > >> I'll fix up the floppy and hp-wmi patches. > > Note that those are already in mainline, as is pcspkr. > Pcspkr should be fine as is since we just want to shut it off and with s2d it will happen automatically when we power down. -- Dmitry ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-25 19:39 ` Rafael J. Wysocki 2009-07-25 20:21 ` Frans Pop @ 2009-07-26 15:08 ` Mark Brown 2009-07-26 19:38 ` Rafael J. Wysocki 1 sibling, 1 reply; 40+ messages in thread From: Mark Brown @ 2009-07-26 15:08 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Dmitry Torokhov, Frans Pop, Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss On Sat, Jul 25, 2009 at 09:39:30PM +0200, Rafael J. Wysocki wrote: > Yes, they would. In general, you'd probably want to do something like this: > static struct dev_pm_ops au1xmmc_pmops = { > .resume = au1xmmc_resume, > .suspend = au1xmmc_suspend, > .freeze = au1xmmc_resume, > .thaw = au1xmmc_suspend, I'd have expected freeze and thaw to be the other way around here? ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH V2] au1xmmc: dev_pm_ops conversion 2009-07-26 15:08 ` Mark Brown @ 2009-07-26 19:38 ` Rafael J. Wysocki 0 siblings, 0 replies; 40+ messages in thread From: Rafael J. Wysocki @ 2009-07-26 19:38 UTC (permalink / raw) To: Mark Brown Cc: Dmitry Torokhov, Frans Pop, Manuel Lauss, linux-kernel, linux-mips, Manuel Lauss On Sunday 26 July 2009, Mark Brown wrote: > On Sat, Jul 25, 2009 at 09:39:30PM +0200, Rafael J. Wysocki wrote: > > > Yes, they would. In general, you'd probably want to do something like this: > > > static struct dev_pm_ops au1xmmc_pmops = { > > .resume = au1xmmc_resume, > > .suspend = au1xmmc_suspend, > > .freeze = au1xmmc_resume, > > .thaw = au1xmmc_suspend, > > I'd have expected freeze and thaw to be the other way around here? Sure, sorry. .suspend() corresponds to .freeze() and .poweroff(), while .resume() corresponds to .thaw() and .restore(). Best, Rafael ^ permalink raw reply [flat|nested] 40+ messages in thread
end of thread, other threads:[~2009-08-06 15:14 UTC | newest] Thread overview: 40+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-08-03 16:33 [PATCH V2] au1xmmc: dev_pm_ops conversion Albin Tonnerre 2009-08-03 19:23 ` Rafael J. Wysocki 2009-08-03 19:23 ` Rafael J. Wysocki 2009-08-04 9:36 ` [PATCH] Add SIMPLE_PM_OPS: make switching to dev_pm_ops less error-prone Albin Tonnerre 2009-08-04 9:36 ` Albin Tonnerre 2009-08-05 4:55 ` Dmitry Torokhov 2009-08-05 4:55 ` Dmitry Torokhov 2009-08-05 9:37 ` Albin Tonnerre 2009-08-05 9:37 ` Albin Tonnerre 2009-08-05 18:47 ` Rafael J. Wysocki 2009-08-05 20:05 ` [PATCH] PM: Add convenience macro to " Rafael J. Wysocki 2009-08-05 20:17 ` pHilipp Zabel 2009-08-05 20:17 ` pHilipp Zabel 2009-08-05 20:22 ` Frans Pop 2009-08-05 20:22 ` Frans Pop 2009-08-05 21:30 ` Rafael J. Wysocki 2009-08-06 8:51 ` Daniel Mack 2009-08-06 8:51 ` Daniel Mack 2009-08-06 12:16 ` Rafael J. Wysocki 2009-08-06 13:10 ` Magnus Damm 2009-08-06 13:10 ` Magnus Damm 2009-08-06 15:14 ` Rafael J. Wysocki 2009-08-06 15:14 ` Rafael J. Wysocki 2009-08-06 12:16 ` Rafael J. Wysocki 2009-08-05 21:30 ` Rafael J. Wysocki 2009-08-05 20:05 ` Rafael J. Wysocki 2009-08-05 18:47 ` [PATCH] Add SIMPLE_PM_OPS: " Rafael J. Wysocki -- strict thread matches above, loose matches on Subject: below -- 2009-07-22 15:18 [PATCH V2] au1xmmc: dev_pm_ops conversion Manuel Lauss 2009-07-25 17:44 ` Dmitry Torokhov 2009-07-25 18:15 ` Manuel Lauss 2009-07-25 18:18 ` Frans Pop 2009-07-25 19:10 ` Dmitry Torokhov 2009-07-25 19:39 ` Rafael J. Wysocki 2009-07-25 20:21 ` Frans Pop 2009-07-25 20:38 ` Frans Pop 2009-07-25 21:06 ` Rafael J. Wysocki 2009-07-25 21:30 ` Frans Pop 2009-07-25 21:41 ` Dmitry Torokhov 2009-07-26 15:08 ` Mark Brown 2009-07-26 19:38 ` Rafael J. Wysocki
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.