diff options
author | Tatyana Brokhman <tlinder@codeaurora.org> | 2011-06-28 16:33:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-28 11:14:37 -0700 |
commit | ea2a1df7b2b1de839a72217d85bfb4b7b049010c (patch) | |
tree | 89c10a2a18bba8a1d448b8b1f1281cf52b2287c6 /drivers/usb/gadget/f_ecm.c | |
parent | 48767a4e8263620c347c3fa17812c943dd0fc2fa (diff) | |
download | kernel_goldelico_gta04-ea2a1df7b2b1de839a72217d85bfb4b7b049010c.zip kernel_goldelico_gta04-ea2a1df7b2b1de839a72217d85bfb4b7b049010c.tar.gz kernel_goldelico_gta04-ea2a1df7b2b1de839a72217d85bfb4b7b049010c.tar.bz2 |
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>
Diffstat (limited to 'drivers/usb/gadget/f_ecm.c')
-rw-r--r-- | drivers/usb/gadget/f_ecm.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index 7c996f2..ddedbc83 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c @@ -46,11 +46,6 @@ * and also means that a get_alt() method is required. */ -struct ecm_ep_descs { - struct usb_endpoint_descriptor *in; - struct usb_endpoint_descriptor *out; - struct usb_endpoint_descriptor *notify; -}; enum ecm_notify_state { ECM_NOTIFY_NONE, /* don't notify */ @@ -64,9 +59,6 @@ struct f_ecm { char ethaddr[14]; - struct ecm_ep_descs fs; - struct ecm_ep_descs hs; - struct usb_ep *notify; struct usb_request *notify_req; u8 notify_state; @@ -463,11 +455,11 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) if (ecm->notify->driver_data) { VDBG(cdev, "reset ecm control %d\n", intf); usb_ep_disable(ecm->notify); - } else { + } + if (!(ecm->notify->desc)) { VDBG(cdev, "init ecm ctrl %d\n", intf); - ecm->notify->desc = ep_choose(cdev->gadget, - ecm->hs.notify, - ecm->fs.notify); + if (config_ep_by_speed(cdev->gadget, f, ecm->notify)) + goto fail; } usb_ep_enable(ecm->notify); ecm->notify->driver_data = ecm; @@ -482,12 +474,17 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) gether_disconnect(&ecm->port); } - if (!ecm->port.in_ep->desc) { + if (!ecm->port.in_ep->desc || + !ecm->port.out_ep->desc) { DBG(cdev, "init ecm\n"); - ecm->port.in_ep->desc = ep_choose(cdev->gadget, - ecm->hs.in, ecm->fs.in); - ecm->port.out_ep->desc = ep_choose(cdev->gadget, - ecm->hs.out, ecm->fs.out); + if (config_ep_by_speed(cdev->gadget, f, + ecm->port.in_ep) || + config_ep_by_speed(cdev->gadget, f, + ecm->port.out_ep)) { + ecm->port.in_ep->desc = NULL; + ecm->port.out_ep->desc = NULL; + goto fail; + } } /* CDC Ethernet only sends data in non-default altsettings. @@ -664,13 +661,6 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) if (!f->descriptors) goto fail; - ecm->fs.in = usb_find_endpoint(ecm_fs_function, - f->descriptors, &fs_ecm_in_desc); - ecm->fs.out = usb_find_endpoint(ecm_fs_function, - f->descriptors, &fs_ecm_out_desc); - ecm->fs.notify = usb_find_endpoint(ecm_fs_function, - f->descriptors, &fs_ecm_notify_desc); - /* support all relevant hardware speeds... we expect that when * hardware is dual speed, all bulk-capable endpoints work at * both speeds @@ -687,13 +677,6 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) f->hs_descriptors = usb_copy_descriptors(ecm_hs_function); if (!f->hs_descriptors) goto fail; - - ecm->hs.in = usb_find_endpoint(ecm_hs_function, - f->hs_descriptors, &hs_ecm_in_desc); - ecm->hs.out = usb_find_endpoint(ecm_hs_function, - f->hs_descriptors, &hs_ecm_out_desc); - ecm->hs.notify = usb_find_endpoint(ecm_hs_function, - f->hs_descriptors, &hs_ecm_notify_desc); } /* NOTE: all that is done without knowing or caring about |