Duncan Haldane wrote:
which driver is a good model for "doing it right" when it comes
to the usb cable being yanked? maybe usbvideo.c ?
AFAICT none of them is a good model, at least not since the locking
changes went into 2.4.19.
The proper solution in my opinion is to do what Gerd suggested: convert
the drivers over to the new V4L1 interface that was introduced in
2.4.19. That's already been done in 2.5, so it should be a simple matter
of backporting the changes.
I'll release a patch that fixes up ov511 in the next day or two. If
anyone is getting hit by this bug and needs it fixed sooner, you can use
the version 2.17 driver which exclusively uses the new V4L. Get it here:
http://alpha.dyndns.org/ov511/download.html
** is it in fact necessary to kfree() the video device struct after
unregistering, as pwc-if.c does? (pwc-if.c appears to believe this
is stopping a memory leak, but no othe driver seems to do it)
pwc seems to be the only driver (disclaimer: I only checked at a few)
that allocates struct video_device separately from its other structs.
So, it definitely needs to kfree() it at some point. Care must be taken
to not free it before disconnect() is done with it though. I think ov511
needs more locking in that regard.
--
Mark McClelland
mark@xxxxxxxxxxxxxxxx