Are there any plans to address the problem of low-level drivers not
keeping track of which ports are actually there's in the near future?
The reason I ask is that I've re-written the driver for the "custom"
interface card that shipped with older HP scanners to be part of the
parport subsystem. The card is actually a bi-directional parallel port
and this way one can, say, plug a printer into it if the scanner ever dies
or gets lost.
The problem is parport_pc assumes it's the only low-level driver present
in the system so segfaults result if the modules are unloaded in the wrong
order: parport_pc unregisters everything leaving the other driver with
dangling pointers. (there's a comment about this problem in parport_pc's
The HP interface driver keeps track of which ports it owns by maintaining
a private linked list of them. This could be done in every low-level
driver but it's a lot of code duplication. My own preference would be to
add the field
struct module *owner
to one of the parport structures, either struct parport or maybe struct
parport_operations (a la file_operations). It's then trivial to set the
pointer to THIS_MODULE and check it against THIS_MODULE before removing
the port. I don't know if this method of keeping track of ownership is
smiled upon or frowned upon by the kernel upper-ups but it can't be beaten
for simplicity at the driver level. Any thoughts?
-- To unsubscribe, send mail to: email@example.com --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Thu Dec 06 2001 - 21:33:53 EST