diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-01-14 11:01:46 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-01-15 09:50:34 -0500 |
commit | c3b1681375dc6e71d89a3ae00cc3ce9e775a8917 (patch) | |
tree | 32493ba3081a500aff705b6ad9802229027ed388 /sound | |
parent | b5a663aa426f4884c71cd8580adae73f33570f0d (diff) |
ALSA: timer: Code cleanup
This is a minor code cleanup without any functional changes:
- Kill keep_flag argument from _snd_timer_stop(), as all callers pass
only it false.
- Remove redundant NULL check in _snd_timer_stop().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/timer.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index 4e8d7bfffff6..cb25aded5349 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -301,8 +301,7 @@ int snd_timer_open(struct snd_timer_instance **ti, | |||
301 | return 0; | 301 | return 0; |
302 | } | 302 | } |
303 | 303 | ||
304 | static int _snd_timer_stop(struct snd_timer_instance *timeri, | 304 | static int _snd_timer_stop(struct snd_timer_instance *timeri, int event); |
305 | int keep_flag, int event); | ||
306 | 305 | ||
307 | /* | 306 | /* |
308 | * close a timer instance | 307 | * close a timer instance |
@@ -344,7 +343,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) | |||
344 | spin_unlock_irq(&timer->lock); | 343 | spin_unlock_irq(&timer->lock); |
345 | mutex_lock(®ister_mutex); | 344 | mutex_lock(®ister_mutex); |
346 | list_del(&timeri->open_list); | 345 | list_del(&timeri->open_list); |
347 | if (timer && list_empty(&timer->open_list_head) && | 346 | if (list_empty(&timer->open_list_head) && |
348 | timer->hw.close) | 347 | timer->hw.close) |
349 | timer->hw.close(timer); | 348 | timer->hw.close(timer); |
350 | /* remove slave links */ | 349 | /* remove slave links */ |
@@ -484,8 +483,7 @@ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) | |||
484 | return result; | 483 | return result; |
485 | } | 484 | } |
486 | 485 | ||
487 | static int _snd_timer_stop(struct snd_timer_instance * timeri, | 486 | static int _snd_timer_stop(struct snd_timer_instance *timeri, int event) |
488 | int keep_flag, int event) | ||
489 | { | 487 | { |
490 | struct snd_timer *timer; | 488 | struct snd_timer *timer; |
491 | unsigned long flags; | 489 | unsigned long flags; |
@@ -494,13 +492,11 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, | |||
494 | return -ENXIO; | 492 | return -ENXIO; |
495 | 493 | ||
496 | if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { | 494 | if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { |
497 | if (!keep_flag) { | 495 | spin_lock_irqsave(&slave_active_lock, flags); |
498 | spin_lock_irqsave(&slave_active_lock, flags); | 496 | timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; |
499 | timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; | 497 | list_del_init(&timeri->ack_list); |
500 | list_del_init(&timeri->ack_list); | 498 | list_del_init(&timeri->active_list); |
501 | list_del_init(&timeri->active_list); | 499 | spin_unlock_irqrestore(&slave_active_lock, flags); |
502 | spin_unlock_irqrestore(&slave_active_lock, flags); | ||
503 | } | ||
504 | goto __end; | 500 | goto __end; |
505 | } | 501 | } |
506 | timer = timeri->timer; | 502 | timer = timeri->timer; |
@@ -521,9 +517,7 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, | |||
521 | } | 517 | } |
522 | } | 518 | } |
523 | } | 519 | } |
524 | if (!keep_flag) | 520 | timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); |
525 | timeri->flags &= | ||
526 | ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); | ||
527 | spin_unlock_irqrestore(&timer->lock, flags); | 521 | spin_unlock_irqrestore(&timer->lock, flags); |
528 | __end: | 522 | __end: |
529 | if (event != SNDRV_TIMER_EVENT_RESOLUTION) | 523 | if (event != SNDRV_TIMER_EVENT_RESOLUTION) |
@@ -542,7 +536,7 @@ int snd_timer_stop(struct snd_timer_instance *timeri) | |||
542 | unsigned long flags; | 536 | unsigned long flags; |
543 | int err; | 537 | int err; |
544 | 538 | ||
545 | err = _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_STOP); | 539 | err = _snd_timer_stop(timeri, SNDRV_TIMER_EVENT_STOP); |
546 | if (err < 0) | 540 | if (err < 0) |
547 | return err; | 541 | return err; |
548 | timer = timeri->timer; | 542 | timer = timeri->timer; |
@@ -586,7 +580,7 @@ int snd_timer_continue(struct snd_timer_instance *timeri) | |||
586 | */ | 580 | */ |
587 | int snd_timer_pause(struct snd_timer_instance * timeri) | 581 | int snd_timer_pause(struct snd_timer_instance * timeri) |
588 | { | 582 | { |
589 | return _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_PAUSE); | 583 | return _snd_timer_stop(timeri, SNDRV_TIMER_EVENT_PAUSE); |
590 | } | 584 | } |
591 | 585 | ||
592 | /* | 586 | /* |