aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/f_obex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/function/f_obex.c')
-rw-r--r--drivers/usb/gadget/function/f_obex.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c
index 5f40080c92cc..a1b79c53499c 100644
--- a/drivers/usb/gadget/function/f_obex.c
+++ b/drivers/usb/gadget/function/f_obex.c
@@ -35,6 +35,7 @@ struct f_obex {
35 struct gserial port; 35 struct gserial port;
36 u8 ctrl_id; 36 u8 ctrl_id;
37 u8 data_id; 37 u8 data_id;
38 u8 cur_alt;
38 u8 port_num; 39 u8 port_num;
39 u8 can_activate; 40 u8 can_activate;
40}; 41};
@@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
235 } else 236 } else
236 goto fail; 237 goto fail;
237 238
239 obex->cur_alt = alt;
240
238 return 0; 241 return 0;
239 242
240fail: 243fail:
@@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf)
245{ 248{
246 struct f_obex *obex = func_to_obex(f); 249 struct f_obex *obex = func_to_obex(f);
247 250
248 if (intf == obex->ctrl_id) 251 return obex->cur_alt;
249 return 0;
250
251 return obex->port.in->driver_data ? 1 : 0;
252} 252}
253 253
254static void obex_disable(struct usb_function *f) 254static void obex_disable(struct usb_function *f)
@@ -397,7 +397,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f)
397 return 0; 397 return 0;
398 398
399fail: 399fail:
400 usb_free_all_descriptors(f);
401 /* we might as well release our claims on endpoints */ 400 /* we might as well release our claims on endpoints */
402 if (obex->port.out) 401 if (obex->port.out)
403 obex->port.out->driver_data = NULL; 402 obex->port.out->driver_data = NULL;