Re: [RFC 10/15] usb: Make core allocate resources per PCI-device.

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

 



On Mon, 29 Nov 2010, Sarah Sharp wrote:

> Introduce the notion of a PCI device that may be associated with more than
> one USB host controller driver (struct usb_hcd).  This patch is the start
> of the work to separate the xHCI host controller into two roothubs: a USB
> 3.0 roothub with SuperSpeed-only ports, and a USB 2.0 roothub with
> HS/FS/LS ports.
> 
> Only one pointer can be stored in the PCI device's private pointer, so
> designate one roothub as the "main" hcd.  For xHCI, this will always be
> the USB 3.0 roothub.  Introduce usb_hcd_is_main_hcd(), a way to check
> whether a usb_hcd structure pointer matches the one stored in the
> hcd->self.controller device's private pointer.
> 
> Make sure that only one interrupt is requested for the whole PCI device,
> by using usb_hcd_is_main_hcd().
> 
> Add a new function, usb_create_shared_hcd(), that does roothub allocation
> for paired roothubs.  It will act just like usb_create_hcd() did if the
> shared_hcd pointer argument is NULL.  If it is passed a non-NULL
> shared_hcd pointer, it sets usb_hcd->shared_hcd, so each roothub can
> access the other partner in the pair.
> 
> The bandwidth_mutex needs to be shared across both xHCI roothubs, so make
> usb_create_shared_hcd() only allocate the mutex once.  When it is passed a
> valid shared_hcd pointer, it stores the mutex pointer from the partner in
> the new roothub.  The bandwidth mutex is only deallocated when the
> shared_hcd pointer is NULL.  The first shared roothub that is released
> will set shared_hcd to NULL.  The second shared roothub that is released
> (or a USB host controller driver that doesn't set up shared roothubs) will
> deallocate the bandwidth mutex.

This seems like a lot of extra effort for something used by only one
driver.  Why not just add a little extra code into usb_hcd_pci_probe()  
to make it avoid allocating resources twice?

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