On Wed, 7 Jul 2004, Andrew Morton wrote: > Greg KH <[EMAIL PROTECTED]> wrote: > > > > On Sat, Jul 03, 2004 at 12:23:30AM -0700, [EMAIL PROTECTED] wrote: > > > > > > > > > usb_trylock_device() returns non-zero on success. > > > > > > Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> > > > > Applied, thanks. > > > > Can you unapply it and apply this one instead? > > > From: Alan Stern <[EMAIL PROTECTED]> > > As Andrew Morton has already spotted, I messed up the interpretation of the > result codes from various _trylock() routines. I didn't notice that > down_trylock() and down_read_trylock() use opposite conventions for > indicating success! This patch fixes the incorrect interpretation of > down_trylock(). That error may well be responsible for some of the > problems cropping up recently with OHCI controllers. > > Signed-off-by: Alan Stern <[EMAIL PROTECTED]> > Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> > --- > > 25-akpm/drivers/usb/core/usb.c | 2 +- > 1 files changed, 1 insertion(+), 1 deletion(-) > > diff -puN > drivers/usb/core/usb.c~as339-interpret-down_trylock-result-code-correctly-in > drivers/usb/core/usb.c > --- 25/drivers/usb/core/usb.c~as339-interpret-down_trylock-result-code-correctly-in > Tue Jul 6 17:10:05 2004 > +++ 25-akpm/drivers/usb/core/usb.c Tue Jul 6 17:10:05 2004 > @@ -871,7 +871,7 @@ int usb_trylock_device(struct usb_device > { > if (!down_read_trylock(&usb_all_devices_rwsem)) > return 0; > - if (!down_trylock(&udev->serialize)) { > + if (down_trylock(&udev->serialize)) { > up_read(&usb_all_devices_rwsem); > return 0; > } > _
No, no -- don't unapply it! Andrew's change was correct. _Both_ patches need to be applied. The basic problem is that usb_trylock_device(), like down_read_trylock(), returns 1 for success whereas down_trylock() returns 0 for success. My first patch, as329, replaced one occurrence of down_trylock in ohci-hub.c with usb_trylock_device() but failed to invert the test of the return code -- that's what Andrew's patch fixed. In as329 there was one other occurrence of down_trylock(), and again I misinterpreted the return code -- that's what the patch above (as339) fixes. Alan Stern ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel