Re: [RFC v3 11/23] usb: Make core allocate resources per PCI-device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 9 Mar 2011, Sarah Sharp wrote:

> > This is okay as it stands, but I wonder if it can be simplified.  The
> > order in which the hcd structures are released doesn't matter, because
> > the bandwidth mutex won't be accessed after the root hubs are
> > unregistered.  Hence the mutex can be deallocated when the primary hcd
> > is removed (since the primary hcd structure always has to be removed
> > last).
> > 
> > Or am I missing something?
> 
> No, you're not missing something, and I think your suggestion simplifies
> things a lot.
> 
> The hcd->primary_hcd is set when usb_create_shared_hcd() is called, but
> looking through the code, it's never cleared when the primary_hcd is
> freed.  It would be useful to use that fact when testing for the
> primary_hcd in hcd_release(), but I wonder if it will lead to bad
> pointer dereferences later...

Well, the idea is simple enough.: Always deallocate the bandwidth_mutex 
except when you're removing a secondary shared hcd.  That should work 
out okay, regardless of how you manage the pointers.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux