Re: [PATCH] PM: add dpm_use_runtime_{suspend, resume} helper functions

Mark Brown
2010-02-27T10:43:09Z

On Fri, Feb 26, 2010 at 05:06:59PM -0500, Alan Stern wrote:
> On Fri, 26 Feb 2010, Rafael J. Wysocki wrote:

> > I have one problem with the design. Namely, dpm_invoke_runtime_*() can
> > run a callback from another subsystem. Say you are a device class and you
> > decide to use dpm_invoke_runtime_*(), but the device's bus type implements
> > the runtime PM callbacks, so they will be run as device class suspend and
> > resume callbacks. That doesn't look particularly clean to me.

> That is a valid point. I suppose there could be separate bus-type,
> device-type, and device-class versions of these functions, but that
> seems like excessive complication with little real benefit.

I do agree that it'd be good to avoid adding any further complexity here
- the use case I have is devices that only really have one suspend type
and don't want or need to know if it's a runtime, disk or memory suspend.

> Mark and Kevin, do you have any thoughts on this?

It seems to me that since people have to explicitly choose to invoke
this behaviour any such cross calls shouldn't be an issue. There's a
reasonable chance that class or bus callbacks are just straightforward
pass throughs which don't actually add anything except moving the
function from dev_pm_ops into the bus or class ops and changing the
parameter to a more specific structure type. Having to decide which
version of the functions to use wouldn't add anything for them.