> I have a question here. > I have two drivers, say A and B, that cooperate to provide a specific > funcationality. A can call a routine provided by B and passes in a > callback as a parameter so that B can use that to call into A. From > this point of view, they behavior like module. Such calls could be > issued even before the drivers create minor nodes. Yet I can only > create one-way dependency, say A depends on B. > The issues is: it's possible that A could be unloaded, which is very > possible with debug kernel, when B call into A. And the system will > panic. > > Is there a way out ?
Great question. If "B" has a routine which registers a callback, it should also have a routine which unregisters the callback. The unregistration routine shouldn't return successfully until the callback is removed and all callers to the callback have returned. (It depends on the situation whether it is more appropriate to wait for callers to drain or immediately return EBUSY). "A" should call this unregistration routine before it allows itself to be unloaded. I'm no DDI expert, though, so there might be a more elegant way to implement this relationship I don't know about. Dave _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
