usb: gadget: use config_ep_by_speed() instead of ep_choose()
Remove obsolete functions:
1. ep_choose()
2. usb_find_endpoint()
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[idos@codeaurora.org: Changed also the following files to
comply with this commit: f_accessory.c,f_adb.c,f_diag.c,f_mtp.c,
f_rmnet.c,f_rmnet_sdio,f_rmnet_smd,f_rmnet_smd_sdio,f_serial.f_ccid.c.
Also merged a patch in f_serial.c for checking return value of
config_ep_by_speed, see "usb: gadget: fix g_serial regression".
Also fix a bug in ci13xxx_udc. Since f_serial is now checking if the endpoint
descriptors are null in the set_alt function, need to set them to null on
ep_disable in case of cable disconnect. Since the ep descriptor was inserted to
struct usb_ep in "usb: gadget: add usb_endpoint_descriptor to struct usb_ep",
also set mEp->ep.desc to NULL. I have upstream this to the community, please
see "usb: gadget: Clear usb_endpoint_descriptor inside the struct usb_ep" in
the latest linux kernel.]
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
diff --git a/drivers/usb/gadget/f_diag.c b/drivers/usb/gadget/f_diag.c
index 2785474..c4c7941 100644
--- a/drivers/usb/gadget/f_diag.c
+++ b/drivers/usb/gadget/f_diag.c
@@ -512,12 +512,13 @@
unsigned long flags;
int rc = 0;
- dev->in->desc = ep_choose(cdev->gadget,
- (struct usb_endpoint_descriptor *)f->hs_descriptors[1],
- (struct usb_endpoint_descriptor *)f->descriptors[1]);
- dev->out->desc = ep_choose(cdev->gadget,
- (struct usb_endpoint_descriptor *)f->hs_descriptors[2],
- (struct usb_endpoint_descriptor *)f->descriptors[2]);
+ if (config_ep_by_speed(cdev->gadget, f, dev->in) ||
+ config_ep_by_speed(cdev->gadget, f, dev->out)) {
+ dev->in->desc = NULL;
+ dev->out->desc = NULL;
+ return -EINVAL;
+ }
+
dev->in->driver_data = dev;
rc = usb_ep_enable(dev->in);
if (rc) {