Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97e133d5 authored by Roger Quadros's avatar Roger Quadros Committed by Felipe Balbi
Browse files

usb: gadget: core: fix ->udc_set_speed() logic



Consider the following case: udc controller supports SuperSpeed.  If we
first load a HighSpeed gadget followed by a SuperSpeed gadget, the
SuperSpeed gadget will be limited to HighSpeed as UDC core driver
doesn't call ->udc_set_speed() in the second case.

Call ->udc_set_speed() unconditionally to fix this issue.

This will also fix the case for dwc3 controller driver when SuperSpeed
gadget is loaded first and works in HighSpeed only as udc_set_speed()
was never being called.

Fixes: 6099eca796ae ("usb: gadget: core: introduce ->udc_set_speed() method")
Cc: <stable@vger.kernel.org> [v4.13+]
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 55168470
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1320,7 +1320,6 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
	udc->dev.driver = &driver->driver;
	udc->gadget->dev.driver = &driver->driver;

	if (driver->max_speed < udc->gadget->max_speed)
	usb_gadget_udc_set_speed(udc, driver->max_speed);

	ret = driver->bind(udc->gadget, driver);