Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 335514
b: refs/heads/master
c: f58161b
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Nov 8, 2012
1 parent 958be3f commit c31e4b7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1a3c98d50731c627909029bb653a0557946f0f5
refs/heads/master: f58161ba1b05a968e5136824b5a16b714b6a5317
13 changes: 13 additions & 0 deletions trunk/sound/usb/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#define EP_FLAG_ACTIVATED 0
#define EP_FLAG_RUNNING 1
#define EP_FLAG_STOPPING 2

/*
* snd_usb_endpoint is a model that abstracts everything related to an
Expand Down Expand Up @@ -502,10 +503,20 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
if (alive)
snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n",
alive, ep->ep_num);
clear_bit(EP_FLAG_STOPPING, &ep->flags);

return 0;
}

/* sync the pending stop operation;
* this function itself doesn't trigger the stop operation
*/
void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)
{
if (ep && test_bit(EP_FLAG_STOPPING, &ep->flags))
wait_clear_urbs(ep);
}

/*
* unlink active urbs.
*/
Expand Down Expand Up @@ -918,6 +929,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,

if (wait)
wait_clear_urbs(ep);
else
set_bit(EP_FLAG_STOPPING, &ep->flags);
}
}

Expand Down
1 change: 1 addition & 0 deletions trunk/sound/usb/endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep);
void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
int force, int can_sleep, int wait);
void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_free(struct list_head *head);
Expand Down
3 changes: 3 additions & 0 deletions trunk/sound/usb/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
goto unlock;
}

snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);

ret = set_format(subs, subs->cur_audiofmt);
if (ret < 0)
goto unlock;
Expand Down

0 comments on commit c31e4b7

Please sign in to comment.