RE: [PATCH v2] usb: gadget: add SS descriptors to Ethernet gadget

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

 



Hi Paul,

> diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
> index ddedbc8..b54e2ac 100644
> --- a/drivers/usb/gadget/f_ecm.c
> +++ b/drivers/usb/gadget/f_ecm.c
> @@ -77,10 +77,12 @@ static inline struct f_ecm *func_to_ecm(struct
> usb_function *f)
>  /* peak (theoretical) bulk transfer rate in bits-per-second */
>  static inline unsigned ecm_bitrate(struct usb_gadget *g)
>  {
> -	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
> -		return 13 * 512 * 8 * 1000 * 8;
> +	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_SUPER)
> +		return 13 * 1024 * 8 * 1000 * 8;

I think you meant gadget_is_super_speed(g) && g->speed == USB_SPEED_SUPER...

> +	else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
> +		return 13 *  512 * 8 * 1000 * 8;
>  	else
> -		return 19 *  64 * 1 * 1000 * 8;
> +		return 19 *   64 * 1 * 1000 * 8;
>  }
> 


> +		ss_ecm_in_desc.bEndpointAddress =
> +				hs_ecm_in_desc.bEndpointAddress;
> +		ss_ecm_out_desc.bEndpointAddress =
> +				hs_ecm_out_desc.bEndpointAddress;
> +		ss_ecm_notify_desc.bEndpointAddress =
> +				hs_ecm_notify_desc.bEndpointAddress;
> +
> +		/* copy descriptors, and track endpoint copies */
> +		f->ss_descriptors = usb_copy_descriptors(ecm_ss_function);
> +		if (!f->ss_descriptors)
> +			goto fail;
>  	}

If I'm not mistaken in your version the above code is under if
gadget_is_dual_speed(), which will work since if the gadget is SS it should
be dual speed as well, but IMO, the above should be under if
gadget_is_super_speed()

> 
>  	/* NOTE:  all that is done without knowing or caring about
> @@ -696,6 +776,8 @@ ecm_bind(struct usb_configuration *c, struct
> usb_function *f)
>  fail:
>  	if (f->descriptors)
>  		usb_free_descriptors(f->descriptors);
> +	if (f->hs_descriptors)
> +		usb_free_descriptors(f->hs_descriptors);
> 
>  	if (ecm->notify_req) {
>  		kfree(ecm->notify_req->buf);
> @@ -722,8 +804,10 @@ ecm_unbind(struct usb_configuration *c, struct
> usb_function *f)
> 
>  	DBG(c->cdev, "ecm unbind\n");
> 
> -	if (gadget_is_dualspeed(c->cdev->gadget))
> +	if (gadget_is_dualspeed(c->cdev->gadget)) {
>  		usb_free_descriptors(f->hs_descriptors);
> +		usb_free_descriptors(f->ss_descriptors);
> +	}

Same here: if gadget_is_super_speed().

Actually this comment goes for all of the updated gadgets; SuperSpeed
support code should be under if gadget_is_super_speed() and not under
gadget_is_dualspeed().


Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

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