Skip to contentSkip to conversation

USB: dummy-hcd: Adapt dummy_udc_set_speed()

PATCH In review Roger Quadros 2 participants 2 messages Nov 2, 2017 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: dummy-hcd: Adapt dummy_udc_set_speed()

The UDC core ensures that .udc_set_speed() is called with a speed that is a minimum of the max speeds supported by the gadget function driver and the UDC driver.

We can now use the speed argument as is.

Get rid of the debug print as that condition will never happen.

---
 drivers/usb/gadget/udc/dummy_hcd.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/usb/gadget/udc/dummy_hcd.c +1 -13
index b17618a..c42ca8e 100644
@@ -910,20 +910,8 @@ static void dummy_udc_set_speed(struct usb_gadget *_gadget,
 	struct dummy	*dum;
 
 	dum = gadget_dev_to_dummy(&_gadget->dev);
-
-	 if (mod_data.is_super_speed)
-		 dum->gadget.speed = min_t(u8, USB_SPEED_SUPER, speed);
-	 else if (mod_data.is_high_speed)
-		 dum->gadget.speed = min_t(u8, USB_SPEED_HIGH, speed);
-	 else
-		 dum->gadget.speed = USB_SPEED_FULL;
-
+	dum->gadget.speed = speed;
 	dummy_udc_update_ep0(dum);
-
-	if (dum->gadget.speed < speed)
-		dev_dbg(udc_dev(dum), "This device can perform faster"
-			" if you connect it to a %s port...\n",
-			usb_speed_string(speed));
 }
 
 static int dummy_udc_start(struct usb_gadget *g,
Signature · 4 lines
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Roger Quadros

The UDC core ensures that .udc_set_speed() is called with a speed that is a minimum of the max speeds supported by the gadget function driver and the UDC driver.

We can now use the speed argument as is.

Get rid of the debug print as that condition will never happen.

---
 drivers/usb/gadget/udc/dummy_hcd.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/usb/gadget/udc/dummy_hcd.c +0 -8
index b17618a..c42ca8e 100644
@@ -910,20 +910,8 @@ static void dummy_udc_set_speed(struct usb_gadget *_gadget,
 	struct dummy	*dum;
 
 	dum = gadget_dev_to_dummy(&_gadget->dev);
-
-	 if (mod_data.is_super_speed)
-		 dum->gadget.speed = min_t(u8, USB_SPEED_SUPER, speed);
-	 else if (mod_data.is_high_speed)
-		 dum->gadget.speed = min_t(u8, USB_SPEED_HIGH, speed);
-	 else
-		 dum->gadget.speed = USB_SPEED_FULL;
-

drivers/usb/gadget/udc/dummy_hcd.c static void dummy_udc_set_speed(struct usb_gadget *_gadget, · line 917

Quoted 10 lines
drivers/usb/gadget/udc/dummy_hcd.c +1 -5
+	dum->gadget.speed = speed;
 	dummy_udc_update_ep0(dum);
-
-	if (dum->gadget.speed < speed)
-		dev_dbg(udc_dev(dum), "This device can perform faster"
-			" if you connect it to a %s port...\n",
-			usb_speed_string(speed));
 }
 
 static int dummy_udc_start(struct usb_gadget *g,