lkml.org 
[lkml]   [2003]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [linux-usb-devel] Re: [OOPS, usbcore, releaseintf] 2.6.0-test10-mm1
Date
Am Donnerstag, 11. Dezember 2003 10:45 schrieb Duncan Sands:
> > > > > __usb_set_configuration - lockless version
> > > > > usb_set_configuration - locked version
> > > >
> > > > Partially done.
> > > > That's what the _physical version of usb_reset_device() is about.
> > >
> > > Unfortunately, usb_physical_reset_device calls usb_set_configuration
> > > which takes dev->serialize.
> >
> > That is bad, but the solution is obvious.
> > All such operations need a _physical version.
> > At first sight this may look less elegant than some lock dropping schemes,
> > but it is a solution that produces obviously correct code paths with
> > respect to locking.
>
> Hi Oliver, I agree, except that there are several layers of locking: dev->serialize
> but also the bus rwsem. So does "physical" mean no subsys.rwsem or no
> dev->serialize or both?

"physical" means no locking at all. It's the caller's responsibility.

> int usb_reset_device(struct usb_device *udev)
> {
> struct device *gdev = &udev->dev;
> int r;
>
> down_read(&gdev->bus->subsys.rwsem);
> r = usb_physical_reset_device(udev);
> up_read(&gdev->bus->subsys.rwsem);
>
> return r;
> }

That's what the core cares about. No probe() while a reset is in
progress. Taking the semaphore ensures that.

Regards
Oliver

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.094 / U:9.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site