Re: [RFC 05/15] xhci: Change hcd_priv be a pointer.

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

 



On Tue, Nov 30, 2010 at 11:00:31AM -0500, Alan Stern wrote:
> Fix the grammar in the patch title.
> 
> On Mon, 29 Nov 2010, Sarah Sharp wrote:
> 
> > Instead of allocating space for the whole xhci_hcd structure at the end of
> > usb_hcd, make the USB core allocate enough space for a pointer to the
> > xhci_hcd structure.  This will make it easy to share the xhci_hcd
> > structure across the two roothubs (the USB 3.0 usb_hcd and the USB 2.0
> > usb_hcd).  This method of sharing the xhci_hcd pointer is better than
> > modifying all xhci_functions to check whether the passed in usb_hcd
> > contains the real xhci_hcd.
> 
> > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> > index ff65ea6..7577876 100644
> > --- a/drivers/usb/host/xhci.c
> > +++ b/drivers/usb/host/xhci.c
> > @@ -519,6 +519,8 @@ void xhci_stop(struct usb_hcd *hcd)
> >  	xhci_mem_cleanup(xhci);
> >  	xhci_dbg(xhci, "xhci_stop completed - status = %x\n",
> >  		    xhci_readl(xhci, &xhci->op_regs->status));
> > +	kfree(xhci);
> > +	*((struct xhci_hcd **) hcd->hcd_priv) = NULL;
> >  }
> 
> This is not a good idea.  Since the xhci_hcd structure is allocated 
> very early in the life cycle, it should be deallocated very late.  For 
> example, at the time when the usb_hcd structure is destroyed.

It's difficult to figure out exactly where the xHCI private structure
should be freed, which is why the free ended up in xhci_stop().  I don't
want the USB core PCI code having to deallocate something the xHCI
driver allocated.  Perhaps I need to introduce a new HCD call,
free_hcd_priv(), that is called in hcd_release()?  It seems like a
heavy-handed approach, but I'm not sure how else to do it.

Sarah Sharp
--
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