diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-11-20 12:32:06 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-21 05:43:40 -0500 |
commit | a9bb36261ef5c7e25564d5ce8a5129920a29bff9 (patch) | |
tree | 085c83dbf44cc98c77b490ce663bccf3c235a2ea /sound/usb/pcm.c | |
parent | 20d32022a8d8639a33d0e429f2d3c51b527ea362 (diff) |
ALSA: usb-audio: simplify snd_usb_endpoint_start/stop arguments
Reduce the redundant arguments for snd_usb_endpoint_start() and
snd_usb_endpoint_stop(). Also replaced from int to bool.
No functional changes by this commit.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index e7329d0449f2..d90604aa5137 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -211,7 +211,7 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, | |||
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | static int start_endpoints(struct snd_usb_substream *subs, int can_sleep) | 214 | static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) |
215 | { | 215 | { |
216 | int err; | 216 | int err; |
217 | 217 | ||
@@ -263,16 +263,13 @@ static int start_endpoints(struct snd_usb_substream *subs, int can_sleep) | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | static void stop_endpoints(struct snd_usb_substream *subs, | 266 | static void stop_endpoints(struct snd_usb_substream *subs, bool wait) |
267 | int force, int can_sleep, int wait) | ||
268 | { | 267 | { |
269 | if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) | 268 | if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) |
270 | snd_usb_endpoint_stop(subs->sync_endpoint, | 269 | snd_usb_endpoint_stop(subs->sync_endpoint, wait); |
271 | force, can_sleep, wait); | ||
272 | 270 | ||
273 | if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) | 271 | if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) |
274 | snd_usb_endpoint_stop(subs->data_endpoint, | 272 | snd_usb_endpoint_stop(subs->data_endpoint, wait); |
275 | force, can_sleep, wait); | ||
276 | } | 273 | } |
277 | 274 | ||
278 | static int deactivate_endpoints(struct snd_usb_substream *subs) | 275 | static int deactivate_endpoints(struct snd_usb_substream *subs) |
@@ -444,7 +441,7 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
444 | int ret; | 441 | int ret; |
445 | 442 | ||
446 | /* format changed */ | 443 | /* format changed */ |
447 | stop_endpoints(subs, 0, 0, 0); | 444 | stop_endpoints(subs, false); |
448 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, | 445 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, |
449 | subs->pcm_format, | 446 | subs->pcm_format, |
450 | subs->channels, | 447 | subs->channels, |
@@ -530,7 +527,7 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
530 | subs->period_bytes = 0; | 527 | subs->period_bytes = 0; |
531 | down_read(&subs->stream->chip->shutdown_rwsem); | 528 | down_read(&subs->stream->chip->shutdown_rwsem); |
532 | if (!subs->stream->chip->shutdown) { | 529 | if (!subs->stream->chip->shutdown) { |
533 | stop_endpoints(subs, 0, 1, 1); | 530 | stop_endpoints(subs, true); |
534 | deactivate_endpoints(subs); | 531 | deactivate_endpoints(subs); |
535 | } | 532 | } |
536 | up_read(&subs->stream->chip->shutdown_rwsem); | 533 | up_read(&subs->stream->chip->shutdown_rwsem); |
@@ -605,7 +602,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
605 | /* for playback, submit the URBs now; otherwise, the first hwptr_done | 602 | /* for playback, submit the URBs now; otherwise, the first hwptr_done |
606 | * updates for all URBs would happen at the same time when starting */ | 603 | * updates for all URBs would happen at the same time when starting */ |
607 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) | 604 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) |
608 | ret = start_endpoints(subs, 1); | 605 | ret = start_endpoints(subs, true); |
609 | 606 | ||
610 | unlock: | 607 | unlock: |
611 | up_read(&subs->stream->chip->shutdown_rwsem); | 608 | up_read(&subs->stream->chip->shutdown_rwsem); |
@@ -1010,7 +1007,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction) | |||
1010 | struct snd_usb_stream *as = snd_pcm_substream_chip(substream); | 1007 | struct snd_usb_stream *as = snd_pcm_substream_chip(substream); |
1011 | struct snd_usb_substream *subs = &as->substream[direction]; | 1008 | struct snd_usb_substream *subs = &as->substream[direction]; |
1012 | 1009 | ||
1013 | stop_endpoints(subs, 0, 0, 0); | 1010 | stop_endpoints(subs, false); |
1014 | 1011 | ||
1015 | if (!as->chip->shutdown && subs->interface >= 0) { | 1012 | if (!as->chip->shutdown && subs->interface >= 0) { |
1016 | usb_set_interface(subs->dev, subs->interface, 0); | 1013 | usb_set_interface(subs->dev, subs->interface, 0); |
@@ -1245,7 +1242,7 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea | |||
1245 | subs->running = 1; | 1242 | subs->running = 1; |
1246 | return 0; | 1243 | return 0; |
1247 | case SNDRV_PCM_TRIGGER_STOP: | 1244 | case SNDRV_PCM_TRIGGER_STOP: |
1248 | stop_endpoints(subs, 0, 0, 0); | 1245 | stop_endpoints(subs, false); |
1249 | subs->running = 0; | 1246 | subs->running = 0; |
1250 | return 0; | 1247 | return 0; |
1251 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1248 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
@@ -1266,7 +1263,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream | |||
1266 | 1263 | ||
1267 | switch (cmd) { | 1264 | switch (cmd) { |
1268 | case SNDRV_PCM_TRIGGER_START: | 1265 | case SNDRV_PCM_TRIGGER_START: |
1269 | err = start_endpoints(subs, 0); | 1266 | err = start_endpoints(subs, false); |
1270 | if (err < 0) | 1267 | if (err < 0) |
1271 | return err; | 1268 | return err; |
1272 | 1269 | ||
@@ -1274,7 +1271,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream | |||
1274 | subs->running = 1; | 1271 | subs->running = 1; |
1275 | return 0; | 1272 | return 0; |
1276 | case SNDRV_PCM_TRIGGER_STOP: | 1273 | case SNDRV_PCM_TRIGGER_STOP: |
1277 | stop_endpoints(subs, 0, 0, 0); | 1274 | stop_endpoints(subs, false); |
1278 | subs->running = 0; | 1275 | subs->running = 0; |
1279 | return 0; | 1276 | return 0; |
1280 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1277 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |