On Tue, Mar 23, 2004 at 07:54:37PM -0800, Pete Zaitcev wrote:
> > However, what about the port->open_count?
> > It is manipulated without any locking, it seems.
>
> Actually it can be gotten rid of entirely I think. The reference count
> of the object is now handled properly, so open_count is pretty much
> pointless. Now we are still relying on the fact that open() can't race
> with disconnect() from the USB bus, which in real-life is probably ok,
You cannot just get rid of it if you still want to call component
driver's ->open only once. Something has to count, and reference
counts do not match open counts, so you have to keep a counter for it.
An alternative would be to pass all upper level opens through to
component drivers, which would just push open counts down a level.
IIRC, we did it before, but migrated to the current scheme.
So, the open count stays. Since it stays, it has to be protected.
Ah, good point, you are correct.
> How about a patch against a clean 2.4 tree? This is against the
latest
> fedora 2.4 kernel, right?
I was going to send it out after 2.4.26, but I can send it now if you
want.
After 2.4.26 is fine, I'm in no hurry.
thanks,
greg k-h