On Fri, Apr 28, 2017 at 3:16 PM, Jason Gunthorpe
<[email protected]> wrote:
> On Fri, Apr 28, 2017 at 11:45:53PM +0200, Rafael J. Wysocki wrote:
>
>> > The trouble is how to consistently get the machine shutdown callback
>> > from the driver core.
>>
>> It is not particularly clear what you mean here. Care to elaborate?
>
> The request is to have a way for the generic tpm code to be called
> before struct device_driver -> shutdown()
>
> Presumably by adding shutdown() to struct class like the
> suspend/resume PM methods?
I've seen some reference to the existing `suspend` method as being
legacy. e.g., drivers/base/power/main.c:__device_suspend:
if (dev->class) {
if (dev->class->pm) {
info = "class ";
callback = pm_op(dev->class->pm, state);
goto Run;
} else if (dev->class->suspend) {
pm_dev_dbg(dev, state, "legacy class ");
error = legacy_suspend(dev, state, dev->class->suspend,
"legacy class ");
goto End;
}
}
In addition, it's not clear to me that the tpm codebase is using
class->suspend right now; it looks like for the most part each device
uses STATIC_DEV_PM_OPS and sets up the common suspend function to be
called independently. (this is based on grepping the tpm driver for
"suspend" so it's possible I'm missing some clever macro hacks, but I
did dig in somewhat thoroughly and don't believe I'm missing anything
like that)
Is there some reason a similar approach of having each driver type
register its own shutdown function pointer (that might just all be the
same function, much like tpm_pm_suspend) would not be acceptable?
Josh
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel