diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index d9de667..38830e2 100644
a
|
b
|
|
35 | 35 | |
36 | 36 | #define EP_FLAG_ACTIVATED 0 |
37 | 37 | #define EP_FLAG_RUNNING 1 |
| 38 | #define EP_FLAG_STOPPING 2 |
38 | 39 | |
39 | 40 | /* |
40 | 41 | * snd_usb_endpoint is a model that abstracts everything related to an |
… |
… |
static int wait_clear_urbs(struct snd_usb_endpoint *ep) |
502 | 503 | if (alive) |
503 | 504 | snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", |
504 | 505 | alive, ep->ep_num); |
| 506 | clear_bit(EP_FLAG_STOPPING, &ep->flags); |
505 | 507 | |
506 | 508 | return 0; |
507 | 509 | } |
508 | 510 | |
| 511 | /* wait until urbs are really dropped */ |
| 512 | void snd_usb_endpoint_sync_stop(struct snd_usb_endpoint *ep) |
| 513 | { |
| 514 | if (test_bit(EP_FLAG_STOPPING, &ep->flags)) |
| 515 | wait_clear_urbs(ep); |
| 516 | } |
| 517 | |
| 518 | |
509 | 519 | /* |
510 | 520 | * unlink active urbs. |
511 | 521 | */ |
… |
… |
void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, |
913 | 923 | |
914 | 924 | if (wait) |
915 | 925 | wait_clear_urbs(ep); |
| 926 | else |
| 927 | set_bit(EP_FLAG_STOPPING, &ep->flags); |
916 | 928 | } |
917 | 929 | } |
918 | 930 | |
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
index cbbbdf2..c1540a4 100644
a
|
b
|
int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
16 | 16 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep); |
17 | 17 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, |
18 | 18 | int force, int can_sleep, int wait); |
| 19 | void snd_usb_endpoint_sync_stop(struct snd_usb_endpoint *ep); |
19 | 20 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); |
20 | 21 | int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); |
21 | 22 | void snd_usb_endpoint_free(struct list_head *head); |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index f782ce1..aee3ab0 100644
a
|
b
|
static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) |
546 | 546 | if (snd_BUG_ON(!subs->data_endpoint)) |
547 | 547 | return -EIO; |
548 | 548 | |
| 549 | if (subs->sync_endpoint) |
| 550 | snd_usb_endpoint_sync_stop(subs->sync_endpoint); |
| 551 | if (subs->data_endpoint) |
| 552 | snd_usb_endpoint_sync_stop(subs->data_endpoint); |
| 553 | |
549 | 554 | /* some unit conversions in runtime */ |
550 | 555 | subs->data_endpoint->maxframesize = |
551 | 556 | bytes_to_frames(runtime, subs->data_endpoint->maxpacksize); |