Re: [PATCH / RFC] usb/xhci: don't allocate struct xhci_hcd three times.

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

 



On Mon, 9 May 2011, Sebastian Andrzej Siewior wrote:

> It seems that since commit b02d0ed6 ("xhci: Change hcd_priv into a
> pointer.") we no longer use the container_of statement to get usb_hcd
> from the xhci struct because we allocate it in the ->reset() callback.
> However, we still allocate one at usb_create_hcd() time. So we have two
> of them but we use only one.

Look again.  usb_create_hcd() allocates a pointer, not an xhci_hcd 
structure.  Without that pointer, there's no way to go from the hcd 
structure to the corresponding xhci_hcd.

> Since commit f6ff0ac ("xhci: Register second xHCI roothub.")  we
> allocate a third one due the additional USB2 hub.
> This patch removes the two struct xhci_hcd which are allocated at
> usb_create_hcd() time and are not used.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> This is totally untested

Somehow I'm not surprised...  :-)

>  but it kinda makes sense :)
> 
>  drivers/usb/host/xhci-pci.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index a10494c..509e530 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -251,7 +251,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
>  static const struct hc_driver xhci_pci_hc_driver = {
>  	.description =		hcd_name,
>  	.product_desc =		"xHCI Host Controller",
> -	.hcd_priv_size =	sizeof(struct xhci_hcd *),

See?  A pointer, not a structure.

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