Re: [PATCH] usb: gadget: dummy: implement ->udc_set_speed()

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

 



Hi,

Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> writes:
> On Thu, 8 Jun 2017, Felipe Balbi wrote:
>
>> Hi Alan,
>> 
>> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> writes:
>> > On Wed, 7 Jun 2017, Felipe Balbi wrote:
>> >
>> >> Move the code which was part of pullup() to the newly introduced
>> >> method.
>> >
>> > Comments inline...
>> 
>> thanks for your comments. I think I've fixed them all.
>> 
>> 8<------------------------------------------------------------------------
>> 
>> From 20e574323d3b6d4e5444815e19fb2096b9656727 Mon Sep 17 00:00:00 2001
>> From: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
>> Date: Wed, 7 Jun 2017 13:52:54 +0300
>> Subject: [PATCH v2] usb: gadget: dummy: implement ->udc_set_speed()
>> 
>> Move the code which was part of pullup() to the newly introduced
>> method.
>> 
>> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
>> ---
>> 
>> Changes since v1:
>> 	- Move set_udc_speed() after pullup()
>>         - remove switch statement in favor a more compact construct
>>         - Fix dev_dbg() call to rely on 'speed' parameter instead.
>> 
>>  drivers/usb/gadget/udc/dummy_hcd.c | 39 ++++++++++++++++++++++----------------
>>  1 file changed, 23 insertions(+), 16 deletions(-)
>> 
>> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
>> index c79081952ea0..156380e4e0af 100644
>> --- a/drivers/usb/gadget/udc/dummy_hcd.c
>> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
>> @@ -888,22 +888,6 @@ static int dummy_pullup(struct usb_gadget *_gadget, int value)
>>  	unsigned long	flags;
>>  
>>  	dum = gadget_dev_to_dummy(&_gadget->dev);
>> -
>> -	if (value && dum->driver) {
>> -		if (mod_data.is_super_speed)
>> -			dum->gadget.speed = dum->driver->max_speed;
>> -		else if (mod_data.is_high_speed)
>> -			dum->gadget.speed = min_t(u8, USB_SPEED_HIGH,
>> -					dum->driver->max_speed);
>> -		else
>> -			dum->gadget.speed = USB_SPEED_FULL;
>> -		dummy_udc_update_ep0(dum);
>> -
>> -		if (dum->gadget.speed < dum->driver->max_speed)
>> -			dev_dbg(udc_dev(dum), "This device can perform faster"
>> -				" if you connect it to a %s port...\n",
>> -				usb_speed_string(dum->driver->max_speed));
>> -	}
>>  	dum_hcd = gadget_to_dummy_hcd(_gadget);
>>  
>>  	spin_lock_irqsave(&dum->lock, flags);
>> @@ -915,6 +899,28 @@ static int dummy_pullup(struct usb_gadget *_gadget, int value)
>>  	return 0;
>>  }
>>  
>> +static void dummy_udc_set_speed(struct usb_gadget *_gadget,
>> +		enum usb_device_speed speed)
>> +{
>> +	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;
>> +
>
> What's with the funky extra space characters after the tabs?

Odd, I didn't add them. I'll take them away.

>> +	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,
>>  		struct usb_gadget_driver *driver);
>>  static int dummy_udc_stop(struct usb_gadget *g);
>> @@ -926,6 +932,7 @@ static const struct usb_gadget_ops dummy_ops = {
>>  	.pullup		= dummy_pullup,
>>  	.udc_start	= dummy_udc_start,
>>  	.udc_stop	= dummy_udc_stop,
>> +	.udc_set_speed	= dummy_udc_set_speed,
>>  };
>>  
>>  /*-------------------------------------------------------------------------*/
>
> That looks fine.  You can add:
>
> Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Thanks :-)

> Any results on testing the new memory barrier and exception handling 
> patches for f_mass_storage?

Oh, I couldn't reproduce anymore. I thought I had told ya. Hopefully,
this will be the last we hear from this problem :-s 

-- 
balbi
--
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