On Thu, Sep 10, 2009 at 09:23:51PM +0900, Izumi Tsutsui wrote: > Well, my first question is: > >> XXX: should these pmf(9) calls be moved into MI attach functions > >> XXX: using function pointers for suspend and resume passed via softc? > > ex(4) does it in the MI attachment for a shutdown hook (no suspend/resume). > fxp(4) does it in each backend for resume handlers (no shutdown hook). > > Currently many drivers don't have suspend/resume handlers > but shutdown hooks, so I just wonder *which* is better.
I would suggest to split suspend/resume and shutdown. The original API didn't include the shutdown hooks and suspend/resume are tightly related, so implementing the functionality has to consider both parts. I would have said that the suspend/resume and shutdown hooks could be part of device_t directly, but we already have way too many different declaration macros. Maybe it is time to move to using C99 inits directly. Whether the attachment is done in the frontend or backend directly depends on how the driver is structured. E.g. for cardbus and PCI the bus specific part is either copy & paste or non-existing, so the correct abstraction would be the elimination of the cardbus frontend. Joerg