Re: [PATCH] USB: Warn about USB3 devices plugged into USB2 hub.

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

 



On Tue, 10 Jan 2012, Sebastian Andrzej Siewior wrote:

> If you add soemthing like:
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 79d339e..54b579e 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3142,6 +3142,20 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
>  	kfree(qual);
>  }
>  
> +static bool have_usb3_controller;
> +
> +void usb3_controller_available(void)
> +{
> +	have_usb3_controller = true;
> +}
> +EXPORT_SYMBOL_GPL(usb3_controller_available);
> +
> +bool is_usb3_controller_available(void)
> +{
> +	return have_usb3_controller;
> +}
> +EXPORT_SYMBOL_GPL(is_usb3_controller_available);
> +
>  static unsigned
>  hub_power_remaining (struct usb_hub *hub)
>  {
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 6bbe3c3..c80b088 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -3960,6 +3960,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
>  	u32			temp;
>  
>  	hcd->self.sg_tablesize = TRBS_PER_SEGMENT - 2;
> +	usb3_controller_available();
>  
>  	if (usb_hcd_is_primary_hcd(hcd)) {
>  		xhci = kzalloc(sizeof(struct xhci_hcd), GFP_KERNEL);

Not good.  This fails when an xHCI controller is removed.

> Then you would not print this message unless we have such a controller.
> This could be extended to usb2 in 1.1 port but I guess this is no longer
> required :)

You don't have to be so complicated about it.  Just copy the logic 
used for highspeed_hubs in hub.c.

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