Am Samstag, 17. April 2004 22:13 schrieb Alan Stern:
> On Sat, 17 Apr 2004, David Brownell wrote:
> > > Oh, I've rewritten the usb-skeleton driver so that it contains no locks
> > > now (with the exception of the BKL to protect on disconnect.)  It's a
> > > world simpler, but I've probably forgotten something here.  I've
> > > attached it below if anyone wants to look at it.
> >
> > Looks much cleaner!  2.6 starts to show its true colors.  :)
> >
> > I'd encourage use of dev_dbg(&dev->interface->dev) and so on.  Wouldn't
> > down_read(&usb_bus_type.subsys.rwsem) in open() let you remove BKL?
>
> This sounds familiar...  How long has it been that people have been busy
> replacing coarse locks like BKL with finer-grained locks?

A spinlock could replace it. But that is a small detail.

> Also, I notice that this code does indeed continue to communicate with the
> device after disconnect() returns.

I see no way fixing that preserving the elegance of the design.

> On Sat, 17 Apr 2004, Oliver Neukum wrote:
> > The key to make reference counting work, seems to be reallocating
> > the data structure operations are based on.
>
> Another key aspect is performing disconnect-type operations in two steps:
> receive the disconnect notification and sometime afterwards acknowledge
> completion of the disconnect by reducing a reference count.

Yes, and not reusing the data structure in between.

> The problem is that physical USB devices aren't data structures -- you
> can't deallocate one and then allocate a new copy when you need it!  Some
> form of synchronization is needed if we want to prevent multiple drivers
> from talking to the same interface at the same time.

Nothing prevents giving out 'struct usb_endpoint_binding's which URBs
could be addressed to. They could have proper reference counting.
You could have them on lists which you walk in case of disconnect(),
config change, etc ...

        Regards
                Oliver



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to