On Thu, Sep 10, 2009 at 08:25:41PM +0200, Matthias Drochner wrote: > > jo...@britannica.bec.de said: > > I would have said that the suspend/resume and shutdown hooks could be > > part of device_t directly > > Shutdown handlers are often bus frontend specific because > they deal with power and/or interrupts. I think it makes > a lot of sense to have them installed by the frontends. > (Whether by a function call or static initialization is another > question, but IMHO the current situation is not so bad that > it is worth wasting energy to change it.)
The point is to separate them to make the choice easier for the driver. Often you can either shutdown the device by disabling the bus access (e.g. for PCI) or by stopping the functions; the latter is inherently backend logic. Depending on the driver that can be done directly in the backend attach routine. Decoupling the two actions just makes it easier to use. Joerg