aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/timer.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:09:09 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:35 -0400
commit7eaa943c8ed8e91e05d0f5d0dc7a18e3319b45cf (patch)
tree51d86a4cb01cf5735b18c36ca62471f8c759a041 /sound/core/timer.c
parent5ef03460a6ffc1d3ee6b6f2abc6765d3e224cf89 (diff)
ALSA: Kill snd_assert() in sound/core/*
Kill snd_assert() in sound/core/*, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r--sound/core/timer.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 0af337efc64e..b8ee49c1f855 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -306,7 +306,8 @@ int snd_timer_close(struct snd_timer_instance *timeri)
306 struct snd_timer *timer = NULL; 306 struct snd_timer *timer = NULL;
307 struct snd_timer_instance *slave, *tmp; 307 struct snd_timer_instance *slave, *tmp;
308 308
309 snd_assert(timeri != NULL, return -ENXIO); 309 if (snd_BUG_ON(!timer))
310 return -ENXIO;
310 311
311 /* force to stop the timer */ 312 /* force to stop the timer */
312 snd_timer_stop(timeri); 313 snd_timer_stop(timeri);
@@ -385,8 +386,9 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
385 do_posix_clock_monotonic_gettime(&tstamp); 386 do_posix_clock_monotonic_gettime(&tstamp);
386 else 387 else
387 getnstimeofday(&tstamp); 388 getnstimeofday(&tstamp);
388 snd_assert(event >= SNDRV_TIMER_EVENT_START && 389 if (snd_BUG_ON(event < SNDRV_TIMER_EVENT_START ||
389 event <= SNDRV_TIMER_EVENT_PAUSE, return); 390 event > SNDRV_TIMER_EVENT_PAUSE))
391 return;
390 if (event == SNDRV_TIMER_EVENT_START || 392 if (event == SNDRV_TIMER_EVENT_START ||
391 event == SNDRV_TIMER_EVENT_CONTINUE) 393 event == SNDRV_TIMER_EVENT_CONTINUE)
392 resolution = snd_timer_resolution(ti); 394 resolution = snd_timer_resolution(ti);
@@ -474,7 +476,8 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri,
474 struct snd_timer *timer; 476 struct snd_timer *timer;
475 unsigned long flags; 477 unsigned long flags;
476 478
477 snd_assert(timeri != NULL, return -ENXIO); 479 if (snd_BUG_ON(!timeri))
480 return -ENXIO;
478 481
479 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { 482 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) {
480 if (!keep_flag) { 483 if (!keep_flag) {
@@ -758,9 +761,10 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
758 .dev_disconnect = snd_timer_dev_disconnect, 761 .dev_disconnect = snd_timer_dev_disconnect,
759 }; 762 };
760 763
761 snd_assert(tid != NULL, return -EINVAL); 764 if (snd_BUG_ON(!tid))
762 snd_assert(rtimer != NULL, return -EINVAL); 765 return -EINVAL;
763 *rtimer = NULL; 766 if (rtimer)
767 *rtimer = NULL;
764 timer = kzalloc(sizeof(*timer), GFP_KERNEL); 768 timer = kzalloc(sizeof(*timer), GFP_KERNEL);
765 if (timer == NULL) { 769 if (timer == NULL) {
766 snd_printk(KERN_ERR "timer: cannot allocate\n"); 770 snd_printk(KERN_ERR "timer: cannot allocate\n");
@@ -788,13 +792,15 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
788 return err; 792 return err;
789 } 793 }
790 } 794 }
791 *rtimer = timer; 795 if (rtimer)
796 *rtimer = timer;
792 return 0; 797 return 0;
793} 798}
794 799
795static int snd_timer_free(struct snd_timer *timer) 800static int snd_timer_free(struct snd_timer *timer)
796{ 801{
797 snd_assert(timer != NULL, return -ENXIO); 802 if (!timer)
803 return 0;
798 804
799 mutex_lock(&register_mutex); 805 mutex_lock(&register_mutex);
800 if (! list_empty(&timer->open_list_head)) { 806 if (! list_empty(&timer->open_list_head)) {
@@ -827,8 +833,8 @@ static int snd_timer_dev_register(struct snd_device *dev)
827 struct snd_timer *timer = dev->device_data; 833 struct snd_timer *timer = dev->device_data;
828 struct snd_timer *timer1; 834 struct snd_timer *timer1;
829 835
830 snd_assert(timer != NULL && timer->hw.start != NULL && 836 if (snd_BUG_ON(!timer || !timer->hw.start || !timer->hw.stop))
831 timer->hw.stop != NULL, return -ENXIO); 837 return -ENXIO;
832 if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) && 838 if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) &&
833 !timer->hw.resolution && timer->hw.c_resolution == NULL) 839 !timer->hw.resolution && timer->hw.c_resolution == NULL)
834 return -EINVAL; 840 return -EINVAL;
@@ -879,8 +885,9 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam
879 885
880 if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)) 886 if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE))
881 return; 887 return;
882 snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && 888 if (snd_BUG_ON(event < SNDRV_TIMER_EVENT_MSTART ||
883 event <= SNDRV_TIMER_EVENT_MRESUME, return); 889 event > SNDRV_TIMER_EVENT_MRESUME))
890 return;
884 spin_lock_irqsave(&timer->lock, flags); 891 spin_lock_irqsave(&timer->lock, flags);
885 if (event == SNDRV_TIMER_EVENT_MSTART || 892 if (event == SNDRV_TIMER_EVENT_MSTART ||
886 event == SNDRV_TIMER_EVENT_MCONTINUE || 893 event == SNDRV_TIMER_EVENT_MCONTINUE ||