Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Greg KH
On Tue, Jan 29, 2002 at 11:52:09AM -0800, David Brownell wrote: > > I still don't see a real benefit in this mechanism, but if it's > going to be done, then these were the two places to add > it in the "hcd.c" file. Just think, no more fun discussions with Oliver about the urb lifecycle, multipl

Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread David Brownell
> This patch only modifies the hcd.c file, so only the ohci-hcd and > ehci-hcd drivers will take ownership over a urb, but the other drivers > still work right now. That seems like the right way to go. Soonish, we'll expect only the UHCI drivers to need converting ... :) I still don't see a rea

Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Oliver Neukum
> > I see the overhead of atomic operations without gain obvious to me. > > It is needed if two people are calling usb_put_urb() at the same time. > You only want one of them to actually do the free(). If you want this to be possible, it has to be atomic. OK. Regards Oli

Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Greg KH
On Tue, Jan 29, 2002 at 06:37:27PM +0100, Oliver Neukum wrote: > > Very well, so where is it legal to use these functions from two threads > of execution? There'd be a race between usb_put_urb() and usb_get_urb() > as usb_put_urb() might free the urb. If you are calling usb_put_urb() and usb_get

Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Oliver Neukum
On Tuesday 29 January 2002 18:16, Greg KH wrote: > On Tue, Jan 29, 2002 at 05:51:24PM +0100, Oliver Neukum wrote: > > Hi, > > > > > I haven't really tested this out much yet, but want to give everyone > > > else a chance for comments on the implementation. > > > > Why do you use atomic_t for the c

Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Greg KH
On Tue, Jan 29, 2002 at 05:51:24PM +0100, Oliver Neukum wrote: > Hi, > > > I haven't really tested this out much yet, but want to give everyone > > else a chance for comments on the implementation. > > Why do you use atomic_t for the count ? So I can use atomic_inc() and atomic_test_and_dec() c

Re: [linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Oliver Neukum
Hi, > I haven't really tested this out much yet, but want to give everyone > else a chance for comments on the implementation. Why do you use atomic_t for the count ? Why does usb_get_urb() have a return value ? Regards Oliver ___

[linux-usb-devel] [PATCH] urb reference counts

2002-01-29 Thread Greg KH
Hi all, Here's a patch against 2.5.3-pre6 that is a first cut at adding reference counting logic to the USB urb structure. There are two new functions: usb_get_urb usb_put_urb usb_put_urb() maps directly to usb_free_urb() to prevent any device drivers from having to change at th