Re: [RFC][PATCH] PM: Introduce new top level suspend and hibernation callbacks (rev. 6)

From: Rafael J. Wysocki
Date: Tue Apr 01 2008 - 17:50:36 EST


On Tuesday, 1 of April 2008, Alan Stern wrote:
> On Tue, 1 Apr 2008, Rafael J. Wysocki wrote:
>
> > > Does ..._ext_... mean extended? (external?) If 'extended' (or if not),
> > > does that imply that they're mutually exclusive alternatives for drivers
> > > to use?
> >
> > 'ext' means 'extended'. The idea is that the 'extended' version will be used
> > by bus types / driver types that don't need to implement the _noirq callbacks.
>
> Something's wrong here. This seems to say that the "extended" version
> has _fewer_ method pointers -- in which case it should be called
> "restricted" instead.

No, it has more pointers. Specifically, it is like

struct pm_ext_ops {
struct pm_ops base;
--additional pointers go here--
}

> > > So drivers can never validly fail to resume. That sounds fair enough. If
> > > the hardware has gone away while in lower power mode (USB, say), should
> > > the driver then just printk an error and return success?
> >
> > I think so.
> >
> > IMO, an error code returned by a driver's ->resume() should mean "the device
> > hasn't resumed and is presumably dead". Otherwise, ->resume() should return
> > success.
>
> If the device is gone, it doesn't much matter what resume() returns.

Yes, it does. In that cases, the error code would tell the PM core not to attempt
to resume the device's children etc. Otherwise, it's quite meaningless to the
PM core, because it really can mean anything and how's the PM core supposed
to handle _that_?

Either we decide that the error codes returned by ->resume() mean critical
errors or there's no point in returning error codes from ->resume() at all
(other than logging the errors by the core).

Well, that's getting confused. I think I'll have to rework the patch not to
really handle the errors returned by ->resume() and friends, after all, but
I'll keep the reporting of them.

However, I'd like to add a recommendation that the _new_ "resume" callbacks
should only return errors in critical situations as the indication to the PM
core that something went _really_ wrong and the device in question is quite
surely unusable.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/