aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-10-12 11:14:55 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:18:45 -0500
commit9dfba38012196ecaf48cbb7ecad92e0729b4491f (patch)
treec0d383258a0f11057e3bc83712588c561aa91614 /sound/core
parentde24214d0c8e78134875752619f99b9e5824c196 (diff)
[ALSA] timer: remove list_entry() type casts
Modules: Timer Midlevel The return value of list_entry() already has the type from the second argument, so we don't need to typecase it again. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/timer.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index c8496c7b8df8..488c28ac56c0 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -131,7 +131,7 @@ static snd_timer_t *snd_timer_find(snd_timer_id_t *tid)
131 struct list_head *p; 131 struct list_head *p;
132 132
133 list_for_each(p, &snd_timer_list) { 133 list_for_each(p, &snd_timer_list) {
134 timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 134 timer = list_entry(p, snd_timer_t, device_list);
135 135
136 if (timer->tmr_class != tid->dev_class) 136 if (timer->tmr_class != tid->dev_class)
137 continue; 137 continue;
@@ -186,9 +186,9 @@ static void snd_timer_check_slave(snd_timer_instance_t *slave)
186 186
187 /* FIXME: it's really dumb to look up all entries.. */ 187 /* FIXME: it's really dumb to look up all entries.. */
188 list_for_each(p, &snd_timer_list) { 188 list_for_each(p, &snd_timer_list) {
189 timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 189 timer = list_entry(p, snd_timer_t, device_list);
190 list_for_each(q, &timer->open_list_head) { 190 list_for_each(q, &timer->open_list_head) {
191 master = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, open_list); 191 master = list_entry(q, snd_timer_instance_t, open_list);
192 if (slave->slave_class == master->slave_class && 192 if (slave->slave_class == master->slave_class &&
193 slave->slave_id == master->slave_id) { 193 slave->slave_id == master->slave_id) {
194 list_del(&slave->open_list); 194 list_del(&slave->open_list);
@@ -216,7 +216,7 @@ static void snd_timer_check_master(snd_timer_instance_t *master)
216 216
217 /* check all pending slaves */ 217 /* check all pending slaves */
218 list_for_each_safe(p, n, &snd_timer_slave_list) { 218 list_for_each_safe(p, n, &snd_timer_slave_list) {
219 slave = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); 219 slave = list_entry(p, snd_timer_instance_t, open_list);
220 if (slave->slave_class == master->slave_class && 220 if (slave->slave_class == master->slave_class &&
221 slave->slave_id == master->slave_id) { 221 slave->slave_id == master->slave_id) {
222 list_del(p); 222 list_del(p);
@@ -348,7 +348,7 @@ int snd_timer_close(snd_timer_instance_t * timeri)
348 timer->hw.close(timer); 348 timer->hw.close(timer);
349 /* remove slave links */ 349 /* remove slave links */
350 list_for_each_safe(p, n, &timeri->slave_list_head) { 350 list_for_each_safe(p, n, &timeri->slave_list_head) {
351 slave = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); 351 slave = list_entry(p, snd_timer_instance_t, open_list);
352 spin_lock_irq(&slave_active_lock); 352 spin_lock_irq(&slave_active_lock);
353 _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION); 353 _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION);
354 list_del(p); 354 list_del(p);
@@ -406,7 +406,7 @@ static void snd_timer_notify1(snd_timer_instance_t *ti, enum sndrv_timer_event e
406 return; 406 return;
407 spin_lock_irqsave(&timer->lock, flags); 407 spin_lock_irqsave(&timer->lock, flags);
408 list_for_each(n, &ti->slave_active_head) { 408 list_for_each(n, &ti->slave_active_head) {
409 ts = (snd_timer_instance_t *)list_entry(n, snd_timer_instance_t, active_list); 409 ts = list_entry(n, snd_timer_instance_t, active_list);
410 if (ts->ccallback) 410 if (ts->ccallback)
411 ts->ccallback(ti, event + 100, &tstamp, resolution); 411 ts->ccallback(ti, event + 100, &tstamp, resolution);
412 } 412 }
@@ -584,7 +584,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left)
584 struct list_head *p; 584 struct list_head *p;
585 585
586 list_for_each(p, &timer->active_list_head) { 586 list_for_each(p, &timer->active_list_head) {
587 ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list); 587 ti = list_entry(p, snd_timer_instance_t, active_list);
588 if (ti->flags & SNDRV_TIMER_IFLG_START) { 588 if (ti->flags & SNDRV_TIMER_IFLG_START) {
589 ti->flags &= ~SNDRV_TIMER_IFLG_START; 589 ti->flags &= ~SNDRV_TIMER_IFLG_START;
590 ti->flags |= SNDRV_TIMER_IFLG_RUNNING; 590 ti->flags |= SNDRV_TIMER_IFLG_RUNNING;
@@ -621,7 +621,7 @@ static void snd_timer_tasklet(unsigned long arg)
621 /* now process all callbacks */ 621 /* now process all callbacks */
622 while (!list_empty(&timer->sack_list_head)) { 622 while (!list_empty(&timer->sack_list_head)) {
623 p = timer->sack_list_head.next; /* get first item */ 623 p = timer->sack_list_head.next; /* get first item */
624 ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, ack_list); 624 ti = list_entry(p, snd_timer_instance_t, ack_list);
625 625
626 /* remove from ack_list and make empty */ 626 /* remove from ack_list and make empty */
627 list_del_init(p); 627 list_del_init(p);
@@ -669,7 +669,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
669 * instance is relinked to done_list_head before callback is called. 669 * instance is relinked to done_list_head before callback is called.
670 */ 670 */
671 list_for_each_safe(p, n, &timer->active_list_head) { 671 list_for_each_safe(p, n, &timer->active_list_head) {
672 ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list); 672 ti = list_entry(p, snd_timer_instance_t, active_list);
673 if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING)) 673 if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING))
674 continue; 674 continue;
675 ti->pticks += ticks_left; 675 ti->pticks += ticks_left;
@@ -696,7 +696,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
696 } 696 }
697 } 697 }
698 list_for_each(q, &ti->slave_active_head) { 698 list_for_each(q, &ti->slave_active_head) {
699 ts = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, active_list); 699 ts = list_entry(q, snd_timer_instance_t, active_list);
700 ts->pticks = ti->pticks; 700 ts->pticks = ti->pticks;
701 ts->resolution = resolution; 701 ts->resolution = resolution;
702 if (list_empty(&ts->ack_list)) { 702 if (list_empty(&ts->ack_list)) {
@@ -729,7 +729,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
729 /* now process all fast callbacks */ 729 /* now process all fast callbacks */
730 while (!list_empty(&timer->ack_list_head)) { 730 while (!list_empty(&timer->ack_list_head)) {
731 p = timer->ack_list_head.next; /* get first item */ 731 p = timer->ack_list_head.next; /* get first item */
732 ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, ack_list); 732 ti = list_entry(p, snd_timer_instance_t, ack_list);
733 733
734 /* remove from ack_list and make empty */ 734 /* remove from ack_list and make empty */
735 list_del_init(p); 735 list_del_init(p);
@@ -825,7 +825,7 @@ static int snd_timer_dev_register(snd_device_t *dev)
825 825
826 down(&register_mutex); 826 down(&register_mutex);
827 list_for_each(p, &snd_timer_list) { 827 list_for_each(p, &snd_timer_list) {
828 timer1 = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 828 timer1 = list_entry(p, snd_timer_t, device_list);
829 if (timer1->tmr_class > timer->tmr_class) 829 if (timer1->tmr_class > timer->tmr_class)
830 break; 830 break;
831 if (timer1->tmr_class < timer->tmr_class) 831 if (timer1->tmr_class < timer->tmr_class)
@@ -864,7 +864,7 @@ static int snd_timer_unregister(snd_timer_t *timer)
864 snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer); 864 snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer);
865 list_for_each_safe(p, n, &timer->open_list_head) { 865 list_for_each_safe(p, n, &timer->open_list_head) {
866 list_del_init(p); 866 list_del_init(p);
867 ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); 867 ti = list_entry(p, snd_timer_instance_t, open_list);
868 ti->timer = NULL; 868 ti->timer = NULL;
869 } 869 }
870 } 870 }
@@ -899,11 +899,11 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t
899 resolution = timer->hw.resolution; 899 resolution = timer->hw.resolution;
900 } 900 }
901 list_for_each(p, &timer->active_list_head) { 901 list_for_each(p, &timer->active_list_head) {
902 ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list); 902 ti = list_entry(p, snd_timer_instance_t, active_list);
903 if (ti->ccallback) 903 if (ti->ccallback)
904 ti->ccallback(ti, event, tstamp, resolution); 904 ti->ccallback(ti, event, tstamp, resolution);
905 list_for_each(n, &ti->slave_active_head) { 905 list_for_each(n, &ti->slave_active_head) {
906 ts = (snd_timer_instance_t *)list_entry(n, snd_timer_instance_t, active_list); 906 ts = list_entry(n, snd_timer_instance_t, active_list);
907 if (ts->ccallback) 907 if (ts->ccallback)
908 ts->ccallback(ts, event, tstamp, resolution); 908 ts->ccallback(ts, event, tstamp, resolution);
909 } 909 }
@@ -1052,7 +1052,7 @@ static void snd_timer_proc_read(snd_info_entry_t *entry,
1052 1052
1053 down(&register_mutex); 1053 down(&register_mutex);
1054 list_for_each(p, &snd_timer_list) { 1054 list_for_each(p, &snd_timer_list) {
1055 timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 1055 timer = list_entry(p, snd_timer_t, device_list);
1056 switch (timer->tmr_class) { 1056 switch (timer->tmr_class) {
1057 case SNDRV_TIMER_CLASS_GLOBAL: 1057 case SNDRV_TIMER_CLASS_GLOBAL:
1058 snd_iprintf(buffer, "G%i: ", timer->tmr_device); 1058 snd_iprintf(buffer, "G%i: ", timer->tmr_device);
@@ -1074,7 +1074,7 @@ static void snd_timer_proc_read(snd_info_entry_t *entry,
1074 snd_iprintf(buffer, "\n"); 1074 snd_iprintf(buffer, "\n");
1075 spin_lock_irqsave(&timer->lock, flags); 1075 spin_lock_irqsave(&timer->lock, flags);
1076 list_for_each(q, &timer->open_list_head) { 1076 list_for_each(q, &timer->open_list_head) {
1077 ti = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, open_list); 1077 ti = list_entry(q, snd_timer_instance_t, open_list);
1078 snd_iprintf(buffer, " Client %s : %s : lost interrupts %li\n", 1078 snd_iprintf(buffer, " Client %s : %s : lost interrupts %li\n",
1079 ti->owner ? ti->owner : "unknown", 1079 ti->owner ? ti->owner : "unknown",
1080 ti->flags & (SNDRV_TIMER_IFLG_START|SNDRV_TIMER_IFLG_RUNNING) ? "running" : "stopped", 1080 ti->flags & (SNDRV_TIMER_IFLG_START|SNDRV_TIMER_IFLG_RUNNING) ? "running" : "stopped",
@@ -1275,7 +1275,8 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1275 if (list_empty(&snd_timer_list)) 1275 if (list_empty(&snd_timer_list))
1276 snd_timer_user_zero_id(&id); 1276 snd_timer_user_zero_id(&id);
1277 else { 1277 else {
1278 timer = (snd_timer_t *)list_entry(snd_timer_list.next, snd_timer_t, device_list); 1278 timer = list_entry(snd_timer_list.next,
1279 snd_timer_t, device_list);
1279 snd_timer_user_copy_id(&id, timer); 1280 snd_timer_user_copy_id(&id, timer);
1280 } 1281 }
1281 } else { 1282 } else {
@@ -1283,7 +1284,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1283 case SNDRV_TIMER_CLASS_GLOBAL: 1284 case SNDRV_TIMER_CLASS_GLOBAL:
1284 id.device = id.device < 0 ? 0 : id.device + 1; 1285 id.device = id.device < 0 ? 0 : id.device + 1;
1285 list_for_each(p, &snd_timer_list) { 1286 list_for_each(p, &snd_timer_list) {
1286 timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 1287 timer = list_entry(p, snd_timer_t, device_list);
1287 if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) { 1288 if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) {
1288 snd_timer_user_copy_id(&id, timer); 1289 snd_timer_user_copy_id(&id, timer);
1289 break; 1290 break;
@@ -1312,7 +1313,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1312 } 1313 }
1313 } 1314 }
1314 list_for_each(p, &snd_timer_list) { 1315 list_for_each(p, &snd_timer_list) {
1315 timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 1316 timer = list_entry(p, snd_timer_t, device_list);
1316 if (timer->tmr_class > id.dev_class) { 1317 if (timer->tmr_class > id.dev_class) {
1317 snd_timer_user_copy_id(&id, timer); 1318 snd_timer_user_copy_id(&id, timer);
1318 break; 1319 break;
@@ -1915,7 +1916,7 @@ static void __exit alsa_timer_exit(void)
1915 snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0); 1916 snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0);
1916 /* unregister the system timer */ 1917 /* unregister the system timer */
1917 list_for_each_safe(p, n, &snd_timer_list) { 1918 list_for_each_safe(p, n, &snd_timer_list) {
1918 snd_timer_t *timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); 1919 snd_timer_t *timer = list_entry(p, snd_timer_t, device_list);
1919 snd_timer_unregister(timer); 1920 snd_timer_unregister(timer);
1920 } 1921 }
1921 if (snd_timer_proc_entry) { 1922 if (snd_timer_proc_entry) {