On Thu, 17 Mar 2005 11:42:00 -0800, David Brownell <[EMAIL PROTECTED]> wrote:
> On Thursday 17 March 2005 11:24 am, Dmitry Torokhov wrote:
> > On Thu, 17 Mar 2005 11:02:58 -0800, David Brownell <[EMAIL PROTECTED]> 
> > wrote:
> > > On Thursday 17 March 2005 1:54 am, Brian Murphy wrote:
> > > > Executive summary:
> > > > loop until dependant device list is empty instead of for loop over
> > > > changing list.
> > >
> > > In various other cases I've found that list_for_each_safe() is
> > > actually not safe, and so I've had to switch to that same sort
> > > of while-not-empty idiom.
> > >
> > > This makes me wonder about either compiler issues or basic
> > > semantic issues with the definition of "safe" ... I leaned
> > > towards thinking that "safe" was a misnomer, probably just
> > > shorthand for "safe_except_for_what_you_really_want".
> > >
> >
> > Well, as far as "list_*_safe" macros go they are actually "safe as far
> > as deleting an element from the list in the middle of the loop by the
> > same thread of execution", no more, no less.
> 
> That's what I'd been trying to do when it misbehaved for me.
> And what I understand Brian was doing, too.

Oh, yes... change that to "... deleting current element ...". After
all list_*_safe only prefetches pointer to the next element in case
memory occupied by the current element gets freed in the middle of the
loop.

I have re-read the tread and it looks like the problem is that
device_release_driver is called recursively for the same bus which is
not allowed (that limitation that hurts everyone). As far as I
understand, for now caller has to disconnect/destroy all children
before unregistering parent. I am doing pretty much the same with
serio - when driver is unregistered I scan list of ports and unbind
them from this driver. And every time I unbind a port I have to
restart scanning the list because I might have deleted some children
ports in the process.

-- 
Dmitry


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to