linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: dummy-hcd: Adapt dummy_udc_set_speed()
@ 2017-11-02  9:09 Roger Quadros
  2017-11-02 14:17 ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Quadros @ 2017-11-02  9:09 UTC (permalink / raw)
  To: balbi, stern; +Cc: linux-usb, linux-kernel, 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.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/gadget/udc/dummy_hcd.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index b17618a..c42ca8e 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -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,
-- 
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] USB: dummy-hcd: Adapt dummy_udc_set_speed()
  2017-11-02  9:09 [PATCH] USB: dummy-hcd: Adapt dummy_udc_set_speed() Roger Quadros
@ 2017-11-02 14:17 ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2017-11-02 14:17 UTC (permalink / raw)
  To: Roger Quadros; +Cc: balbi, linux-usb, linux-kernel

On Thu, 2 Nov 2017, Roger Quadros wrote:

> 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.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/gadget/udc/dummy_hcd.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index b17618a..c42ca8e 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -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,
> 

Acked-by: Alan Stern <stern@rowland.harvard.edu>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-02 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02  9:09 [PATCH] USB: dummy-hcd: Adapt dummy_udc_set_speed() Roger Quadros
2017-11-02 14:17 ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).