> > > > Let the programmer of drivers add a bus-dependent PMF hook in the bus > > > > attachment routine, and a bus-independent PMF hook in the generic attach > > > > routine. Something like this, for example, > > > > > > How much duplication between the bus-dependent frontend really exists? > > > Other than PCI/Cardbus which are essentially the same... > > > > Most shutdown hooks and pmf_class_foo_register()? > > You can't move the class registering into device_t as e.g. the network > class has to know the ifp. The shutdown hook can be directly shared > between frontend already if all do the same thing. If all your frontends > directly call the backend, you can also push the register calls down.
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. BTW, most shutdown hooks for NICs just call foo_stop(). I wonder if it's redundant because it will also be handled by pmf_class_network_register()? > I still don't see what splitting between bus-dependent and > bus-indepedent for the suspend/resume (and shutdown) hooks really buys. The splitting is suggested by dyoung@, and I don't have a particular comment about it. --- Izumi Tsutsui