diff options
Diffstat (limited to 'drivers/usb/gadget/f_obex.c')
| -rw-r--r-- | drivers/usb/gadget/f_obex.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c index 5f400f66aa9b..d8dd8782768c 100644 --- a/drivers/usb/gadget/f_obex.c +++ b/drivers/usb/gadget/f_obex.c | |||
| @@ -331,23 +331,19 @@ obex_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 331 | obex->port.out = ep; | 331 | obex->port.out = ep; |
| 332 | ep->driver_data = cdev; /* claim */ | 332 | ep->driver_data = cdev; /* claim */ |
| 333 | 333 | ||
| 334 | /* copy descriptors, and track endpoint copies */ | ||
| 335 | f->descriptors = usb_copy_descriptors(fs_function); | ||
| 336 | |||
| 337 | /* support all relevant hardware speeds... we expect that when | 334 | /* support all relevant hardware speeds... we expect that when |
| 338 | * hardware is dual speed, all bulk-capable endpoints work at | 335 | * hardware is dual speed, all bulk-capable endpoints work at |
| 339 | * both speeds | 336 | * both speeds |
| 340 | */ | 337 | */ |
| 341 | if (gadget_is_dualspeed(c->cdev->gadget)) { | ||
| 342 | 338 | ||
| 343 | obex_hs_ep_in_desc.bEndpointAddress = | 339 | obex_hs_ep_in_desc.bEndpointAddress = |
| 344 | obex_fs_ep_in_desc.bEndpointAddress; | 340 | obex_fs_ep_in_desc.bEndpointAddress; |
| 345 | obex_hs_ep_out_desc.bEndpointAddress = | 341 | obex_hs_ep_out_desc.bEndpointAddress = |
| 346 | obex_fs_ep_out_desc.bEndpointAddress; | 342 | obex_fs_ep_out_desc.bEndpointAddress; |
| 347 | 343 | ||
| 348 | /* copy descriptors, and track endpoint copies */ | 344 | status = usb_assign_descriptors(f, fs_function, hs_function, NULL); |
| 349 | f->hs_descriptors = usb_copy_descriptors(hs_function); | 345 | if (status) |
| 350 | } | 346 | goto fail; |
| 351 | 347 | ||
| 352 | /* Avoid letting this gadget enumerate until the userspace | 348 | /* Avoid letting this gadget enumerate until the userspace |
| 353 | * OBEX server is active. | 349 | * OBEX server is active. |
| @@ -368,6 +364,7 @@ obex_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 368 | return 0; | 364 | return 0; |
| 369 | 365 | ||
| 370 | fail: | 366 | fail: |
| 367 | usb_free_all_descriptors(f); | ||
| 371 | /* we might as well release our claims on endpoints */ | 368 | /* we might as well release our claims on endpoints */ |
| 372 | if (obex->port.out) | 369 | if (obex->port.out) |
| 373 | obex->port.out->driver_data = NULL; | 370 | obex->port.out->driver_data = NULL; |
| @@ -382,9 +379,8 @@ fail: | |||
| 382 | static void | 379 | static void |
| 383 | obex_unbind(struct usb_configuration *c, struct usb_function *f) | 380 | obex_unbind(struct usb_configuration *c, struct usb_function *f) |
| 384 | { | 381 | { |
| 385 | if (gadget_is_dualspeed(c->cdev->gadget)) | 382 | obex_string_defs[OBEX_CTRL_IDX].id = 0; |
| 386 | usb_free_descriptors(f->hs_descriptors); | 383 | usb_free_all_descriptors(f); |
| 387 | usb_free_descriptors(f->descriptors); | ||
| 388 | kfree(func_to_obex(f)); | 384 | kfree(func_to_obex(f)); |
| 389 | } | 385 | } |
| 390 | 386 | ||
| @@ -423,22 +419,16 @@ int __init obex_bind_config(struct usb_configuration *c, u8 port_num) | |||
| 423 | if (!can_support_obex(c)) | 419 | if (!can_support_obex(c)) |
| 424 | return -EINVAL; | 420 | return -EINVAL; |
| 425 | 421 | ||
| 426 | /* maybe allocate device-global string IDs, and patch descriptors */ | ||
| 427 | if (obex_string_defs[OBEX_CTRL_IDX].id == 0) { | 422 | if (obex_string_defs[OBEX_CTRL_IDX].id == 0) { |
| 428 | status = usb_string_id(c->cdev); | 423 | status = usb_string_ids_tab(c->cdev, obex_string_defs); |
| 429 | if (status < 0) | ||
| 430 | return status; | ||
| 431 | obex_string_defs[OBEX_CTRL_IDX].id = status; | ||
| 432 | |||
| 433 | obex_control_intf.iInterface = status; | ||
| 434 | |||
| 435 | status = usb_string_id(c->cdev); | ||
| 436 | if (status < 0) | 424 | if (status < 0) |
| 437 | return status; | 425 | return status; |
| 438 | obex_string_defs[OBEX_DATA_IDX].id = status; | 426 | obex_control_intf.iInterface = |
| 427 | obex_string_defs[OBEX_CTRL_IDX].id; | ||
| 439 | 428 | ||
| 440 | obex_data_nop_intf.iInterface = | 429 | status = obex_string_defs[OBEX_DATA_IDX].id; |
| 441 | obex_data_intf.iInterface = status; | 430 | obex_data_nop_intf.iInterface = status; |
| 431 | obex_data_intf.iInterface = status; | ||
| 442 | } | 432 | } |
| 443 | 433 | ||
| 444 | /* allocate and initialize one new instance */ | 434 | /* allocate and initialize one new instance */ |
