aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r--sound/core/timer.c346
1 files changed, 172 insertions, 174 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 1b90a38d10ff..18d43a037850 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -53,8 +53,8 @@ MODULE_LICENSE("GPL");
53module_param(timer_limit, int, 0444); 53module_param(timer_limit, int, 0444);
54MODULE_PARM_DESC(timer_limit, "Maximum global timers in system."); 54MODULE_PARM_DESC(timer_limit, "Maximum global timers in system.");
55 55
56typedef struct { 56struct snd_timer_user {
57 snd_timer_instance_t *timeri; 57 struct snd_timer_instance *timeri;
58 int tread; /* enhanced read with timestamps and events */ 58 int tread; /* enhanced read with timestamps and events */
59 unsigned long ticks; 59 unsigned long ticks;
60 unsigned long overrun; 60 unsigned long overrun;
@@ -62,8 +62,8 @@ typedef struct {
62 int qtail; 62 int qtail;
63 int qused; 63 int qused;
64 int queue_size; 64 int queue_size;
65 snd_timer_read_t *queue; 65 struct snd_timer_read *queue;
66 snd_timer_tread_t *tqueue; 66 struct snd_timer_tread *tqueue;
67 spinlock_t qlock; 67 spinlock_t qlock;
68 unsigned long last_resolution; 68 unsigned long last_resolution;
69 unsigned int filter; 69 unsigned int filter;
@@ -71,7 +71,7 @@ typedef struct {
71 wait_queue_head_t qchange_sleep; 71 wait_queue_head_t qchange_sleep;
72 struct fasync_struct *fasync; 72 struct fasync_struct *fasync;
73 struct semaphore tread_sem; 73 struct semaphore tread_sem;
74} snd_timer_user_t; 74};
75 75
76/* list of timers */ 76/* list of timers */
77static LIST_HEAD(snd_timer_list); 77static LIST_HEAD(snd_timer_list);
@@ -84,21 +84,21 @@ static DEFINE_SPINLOCK(slave_active_lock);
84 84
85static DECLARE_MUTEX(register_mutex); 85static DECLARE_MUTEX(register_mutex);
86 86
87static int snd_timer_free(snd_timer_t *timer); 87static int snd_timer_free(struct snd_timer *timer);
88static int snd_timer_dev_free(snd_device_t *device); 88static int snd_timer_dev_free(struct snd_device *device);
89static int snd_timer_dev_register(snd_device_t *device); 89static int snd_timer_dev_register(struct snd_device *device);
90static int snd_timer_dev_unregister(snd_device_t *device); 90static int snd_timer_dev_unregister(struct snd_device *device);
91 91
92static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left); 92static void snd_timer_reschedule(struct snd_timer * timer, unsigned long ticks_left);
93 93
94/* 94/*
95 * create a timer instance with the given owner string. 95 * create a timer instance with the given owner string.
96 * when timer is not NULL, increments the module counter 96 * when timer is not NULL, increments the module counter
97 */ 97 */
98static snd_timer_instance_t *snd_timer_instance_new(char *owner, 98static struct snd_timer_instance *snd_timer_instance_new(char *owner,
99 snd_timer_t *timer) 99 struct snd_timer *timer)
100{ 100{
101 snd_timer_instance_t *timeri; 101 struct snd_timer_instance *timeri;
102 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); 102 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
103 if (timeri == NULL) 103 if (timeri == NULL)
104 return NULL; 104 return NULL;
@@ -126,13 +126,13 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner,
126/* 126/*
127 * find a timer instance from the given timer id 127 * find a timer instance from the given timer id
128 */ 128 */
129static snd_timer_t *snd_timer_find(snd_timer_id_t *tid) 129static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
130{ 130{
131 snd_timer_t *timer = NULL; 131 struct snd_timer *timer = NULL;
132 struct list_head *p; 132 struct list_head *p;
133 133
134 list_for_each(p, &snd_timer_list) { 134 list_for_each(p, &snd_timer_list) {
135 timer = list_entry(p, snd_timer_t, device_list); 135 timer = list_entry(p, struct snd_timer, device_list);
136 136
137 if (timer->tmr_class != tid->dev_class) 137 if (timer->tmr_class != tid->dev_class)
138 continue; 138 continue;
@@ -152,7 +152,7 @@ static snd_timer_t *snd_timer_find(snd_timer_id_t *tid)
152 152
153#ifdef CONFIG_KMOD 153#ifdef CONFIG_KMOD
154 154
155static void snd_timer_request(snd_timer_id_t *tid) 155static void snd_timer_request(struct snd_timer_id *tid)
156{ 156{
157 if (! current->fs->root) 157 if (! current->fs->root)
158 return; 158 return;
@@ -179,17 +179,17 @@ static void snd_timer_request(snd_timer_id_t *tid)
179 * 179 *
180 * call this with register_mutex down. 180 * call this with register_mutex down.
181 */ 181 */
182static void snd_timer_check_slave(snd_timer_instance_t *slave) 182static void snd_timer_check_slave(struct snd_timer_instance *slave)
183{ 183{
184 snd_timer_t *timer; 184 struct snd_timer *timer;
185 snd_timer_instance_t *master; 185 struct snd_timer_instance *master;
186 struct list_head *p, *q; 186 struct list_head *p, *q;
187 187
188 /* FIXME: it's really dumb to look up all entries.. */ 188 /* FIXME: it's really dumb to look up all entries.. */
189 list_for_each(p, &snd_timer_list) { 189 list_for_each(p, &snd_timer_list) {
190 timer = list_entry(p, snd_timer_t, device_list); 190 timer = list_entry(p, struct snd_timer, device_list);
191 list_for_each(q, &timer->open_list_head) { 191 list_for_each(q, &timer->open_list_head) {
192 master = list_entry(q, snd_timer_instance_t, open_list); 192 master = list_entry(q, struct snd_timer_instance, open_list);
193 if (slave->slave_class == master->slave_class && 193 if (slave->slave_class == master->slave_class &&
194 slave->slave_id == master->slave_id) { 194 slave->slave_id == master->slave_id) {
195 list_del(&slave->open_list); 195 list_del(&slave->open_list);
@@ -211,14 +211,14 @@ static void snd_timer_check_slave(snd_timer_instance_t *slave)
211 * 211 *
212 * call this with register_mutex down. 212 * call this with register_mutex down.
213 */ 213 */
214static void snd_timer_check_master(snd_timer_instance_t *master) 214static void snd_timer_check_master(struct snd_timer_instance *master)
215{ 215{
216 snd_timer_instance_t *slave; 216 struct snd_timer_instance *slave;
217 struct list_head *p, *n; 217 struct list_head *p, *n;
218 218
219 /* check all pending slaves */ 219 /* check all pending slaves */
220 list_for_each_safe(p, n, &snd_timer_slave_list) { 220 list_for_each_safe(p, n, &snd_timer_slave_list) {
221 slave = list_entry(p, snd_timer_instance_t, open_list); 221 slave = list_entry(p, struct snd_timer_instance, open_list);
222 if (slave->slave_class == master->slave_class && 222 if (slave->slave_class == master->slave_class &&
223 slave->slave_id == master->slave_id) { 223 slave->slave_id == master->slave_id) {
224 list_del(p); 224 list_del(p);
@@ -238,12 +238,12 @@ static void snd_timer_check_master(snd_timer_instance_t *master)
238 * open a timer instance 238 * open a timer instance
239 * when opening a master, the slave id must be here given. 239 * when opening a master, the slave id must be here given.
240 */ 240 */
241int snd_timer_open(snd_timer_instance_t **ti, 241int snd_timer_open(struct snd_timer_instance **ti,
242 char *owner, snd_timer_id_t *tid, 242 char *owner, struct snd_timer_id *tid,
243 unsigned int slave_id) 243 unsigned int slave_id)
244{ 244{
245 snd_timer_t *timer; 245 struct snd_timer *timer;
246 snd_timer_instance_t *timeri = NULL; 246 struct snd_timer_instance *timeri = NULL;
247 247
248 if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) { 248 if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {
249 /* open a slave instance */ 249 /* open a slave instance */
@@ -285,7 +285,7 @@ int snd_timer_open(snd_timer_instance_t **ti,
285 } 285 }
286 if (!list_empty(&timer->open_list_head)) { 286 if (!list_empty(&timer->open_list_head)) {
287 timeri = list_entry(timer->open_list_head.next, 287 timeri = list_entry(timer->open_list_head.next,
288 snd_timer_instance_t, open_list); 288 struct snd_timer_instance, open_list);
289 if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) { 289 if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {
290 up(&register_mutex); 290 up(&register_mutex);
291 return -EBUSY; 291 return -EBUSY;
@@ -307,17 +307,17 @@ int snd_timer_open(snd_timer_instance_t **ti,
307 return 0; 307 return 0;
308} 308}
309 309
310static int _snd_timer_stop(snd_timer_instance_t * timeri, 310static int _snd_timer_stop(struct snd_timer_instance *timeri,
311 int keep_flag, enum sndrv_timer_event event); 311 int keep_flag, int event);
312 312
313/* 313/*
314 * close a timer instance 314 * close a timer instance
315 */ 315 */
316int snd_timer_close(snd_timer_instance_t * timeri) 316int snd_timer_close(struct snd_timer_instance *timeri)
317{ 317{
318 snd_timer_t *timer = NULL; 318 struct snd_timer *timer = NULL;
319 struct list_head *p, *n; 319 struct list_head *p, *n;
320 snd_timer_instance_t *slave; 320 struct snd_timer_instance *slave;
321 321
322 snd_assert(timeri != NULL, return -ENXIO); 322 snd_assert(timeri != NULL, return -ENXIO);
323 323
@@ -353,7 +353,7 @@ int snd_timer_close(snd_timer_instance_t * timeri)
353 timer->hw.close(timer); 353 timer->hw.close(timer);
354 /* remove slave links */ 354 /* remove slave links */
355 list_for_each_safe(p, n, &timeri->slave_list_head) { 355 list_for_each_safe(p, n, &timeri->slave_list_head) {
356 slave = list_entry(p, snd_timer_instance_t, open_list); 356 slave = list_entry(p, struct snd_timer_instance, open_list);
357 spin_lock_irq(&slave_active_lock); 357 spin_lock_irq(&slave_active_lock);
358 _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION); 358 _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION);
359 list_del(p); 359 list_del(p);
@@ -373,9 +373,9 @@ int snd_timer_close(snd_timer_instance_t * timeri)
373 return 0; 373 return 0;
374} 374}
375 375
376unsigned long snd_timer_resolution(snd_timer_instance_t * timeri) 376unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
377{ 377{
378 snd_timer_t * timer; 378 struct snd_timer * timer;
379 379
380 if (timeri == NULL) 380 if (timeri == NULL)
381 return 0; 381 return 0;
@@ -387,13 +387,12 @@ unsigned long snd_timer_resolution(snd_timer_instance_t * timeri)
387 return 0; 387 return 0;
388} 388}
389 389
390static void snd_timer_notify1(snd_timer_instance_t *ti, 390static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
391 enum sndrv_timer_event event)
392{ 391{
393 snd_timer_t *timer; 392 struct snd_timer *timer;
394 unsigned long flags; 393 unsigned long flags;
395 unsigned long resolution = 0; 394 unsigned long resolution = 0;
396 snd_timer_instance_t *ts; 395 struct snd_timer_instance *ts;
397 struct list_head *n; 396 struct list_head *n;
398 struct timespec tstamp; 397 struct timespec tstamp;
399 398
@@ -414,14 +413,14 @@ static void snd_timer_notify1(snd_timer_instance_t *ti,
414 return; 413 return;
415 spin_lock_irqsave(&timer->lock, flags); 414 spin_lock_irqsave(&timer->lock, flags);
416 list_for_each(n, &ti->slave_active_head) { 415 list_for_each(n, &ti->slave_active_head) {
417 ts = list_entry(n, snd_timer_instance_t, active_list); 416 ts = list_entry(n, struct snd_timer_instance, active_list);
418 if (ts->ccallback) 417 if (ts->ccallback)
419 ts->ccallback(ti, event + 100, &tstamp, resolution); 418 ts->ccallback(ti, event + 100, &tstamp, resolution);
420 } 419 }
421 spin_unlock_irqrestore(&timer->lock, flags); 420 spin_unlock_irqrestore(&timer->lock, flags);
422} 421}
423 422
424static int snd_timer_start1(snd_timer_t *timer, snd_timer_instance_t *timeri, 423static int snd_timer_start1(struct snd_timer *timer, struct snd_timer_instance *timeri,
425 unsigned long sticks) 424 unsigned long sticks)
426{ 425{
427 list_del(&timeri->active_list); 426 list_del(&timeri->active_list);
@@ -442,7 +441,7 @@ static int snd_timer_start1(snd_timer_t *timer, snd_timer_instance_t *timeri,
442 } 441 }
443} 442}
444 443
445static int snd_timer_start_slave(snd_timer_instance_t *timeri) 444static int snd_timer_start_slave(struct snd_timer_instance *timeri)
446{ 445{
447 unsigned long flags; 446 unsigned long flags;
448 447
@@ -458,9 +457,9 @@ static int snd_timer_start_slave(snd_timer_instance_t *timeri)
458/* 457/*
459 * start the timer instance 458 * start the timer instance
460 */ 459 */
461int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks) 460int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)
462{ 461{
463 snd_timer_t *timer; 462 struct snd_timer *timer;
464 int result = -EINVAL; 463 int result = -EINVAL;
465 unsigned long flags; 464 unsigned long flags;
466 465
@@ -483,10 +482,10 @@ int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks)
483 return result; 482 return result;
484} 483}
485 484
486static int _snd_timer_stop(snd_timer_instance_t * timeri, 485static int _snd_timer_stop(struct snd_timer_instance * timeri,
487 int keep_flag, enum sndrv_timer_event event) 486 int keep_flag, int event)
488{ 487{
489 snd_timer_t *timer; 488 struct snd_timer *timer;
490 unsigned long flags; 489 unsigned long flags;
491 490
492 snd_assert(timeri != NULL, return -ENXIO); 491 snd_assert(timeri != NULL, return -ENXIO);
@@ -532,9 +531,9 @@ static int _snd_timer_stop(snd_timer_instance_t * timeri,
532 * 531 *
533 * do not call this from the timer callback! 532 * do not call this from the timer callback!
534 */ 533 */
535int snd_timer_stop(snd_timer_instance_t * timeri) 534int snd_timer_stop(struct snd_timer_instance *timeri)
536{ 535{
537 snd_timer_t *timer; 536 struct snd_timer *timer;
538 unsigned long flags; 537 unsigned long flags;
539 int err; 538 int err;
540 539
@@ -552,9 +551,9 @@ int snd_timer_stop(snd_timer_instance_t * timeri)
552/* 551/*
553 * start again.. the tick is kept. 552 * start again.. the tick is kept.
554 */ 553 */
555int snd_timer_continue(snd_timer_instance_t * timeri) 554int snd_timer_continue(struct snd_timer_instance *timeri)
556{ 555{
557 snd_timer_t *timer; 556 struct snd_timer *timer;
558 int result = -EINVAL; 557 int result = -EINVAL;
559 unsigned long flags; 558 unsigned long flags;
560 559
@@ -578,7 +577,7 @@ int snd_timer_continue(snd_timer_instance_t * timeri)
578/* 577/*
579 * pause.. remember the ticks left 578 * pause.. remember the ticks left
580 */ 579 */
581int snd_timer_pause(snd_timer_instance_t * timeri) 580int snd_timer_pause(struct snd_timer_instance * timeri)
582{ 581{
583 return _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_PAUSE); 582 return _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_PAUSE);
584} 583}
@@ -589,14 +588,14 @@ int snd_timer_pause(snd_timer_instance_t * timeri)
589 * start pending instances and check the scheduling ticks. 588 * start pending instances and check the scheduling ticks.
590 * when the scheduling ticks is changed set CHANGE flag to reprogram the timer. 589 * when the scheduling ticks is changed set CHANGE flag to reprogram the timer.
591 */ 590 */
592static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left) 591static void snd_timer_reschedule(struct snd_timer * timer, unsigned long ticks_left)
593{ 592{
594 snd_timer_instance_t *ti; 593 struct snd_timer_instance *ti;
595 unsigned long ticks = ~0UL; 594 unsigned long ticks = ~0UL;
596 struct list_head *p; 595 struct list_head *p;
597 596
598 list_for_each(p, &timer->active_list_head) { 597 list_for_each(p, &timer->active_list_head) {
599 ti = list_entry(p, snd_timer_instance_t, active_list); 598 ti = list_entry(p, struct snd_timer_instance, active_list);
600 if (ti->flags & SNDRV_TIMER_IFLG_START) { 599 if (ti->flags & SNDRV_TIMER_IFLG_START) {
601 ti->flags &= ~SNDRV_TIMER_IFLG_START; 600 ti->flags &= ~SNDRV_TIMER_IFLG_START;
602 ti->flags |= SNDRV_TIMER_IFLG_RUNNING; 601 ti->flags |= SNDRV_TIMER_IFLG_RUNNING;
@@ -624,8 +623,8 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left)
624 */ 623 */
625static void snd_timer_tasklet(unsigned long arg) 624static void snd_timer_tasklet(unsigned long arg)
626{ 625{
627 snd_timer_t *timer = (snd_timer_t *) arg; 626 struct snd_timer *timer = (struct snd_timer *) arg;
628 snd_timer_instance_t *ti; 627 struct snd_timer_instance *ti;
629 struct list_head *p; 628 struct list_head *p;
630 unsigned long resolution, ticks; 629 unsigned long resolution, ticks;
631 630
@@ -633,7 +632,7 @@ static void snd_timer_tasklet(unsigned long arg)
633 /* now process all callbacks */ 632 /* now process all callbacks */
634 while (!list_empty(&timer->sack_list_head)) { 633 while (!list_empty(&timer->sack_list_head)) {
635 p = timer->sack_list_head.next; /* get first item */ 634 p = timer->sack_list_head.next; /* get first item */
636 ti = list_entry(p, snd_timer_instance_t, ack_list); 635 ti = list_entry(p, struct snd_timer_instance, ack_list);
637 636
638 /* remove from ack_list and make empty */ 637 /* remove from ack_list and make empty */
639 list_del_init(p); 638 list_del_init(p);
@@ -658,9 +657,9 @@ static void snd_timer_tasklet(unsigned long arg)
658 * ticks_left is usually equal to timer->sticks. 657 * ticks_left is usually equal to timer->sticks.
659 * 658 *
660 */ 659 */
661void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left) 660void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
662{ 661{
663 snd_timer_instance_t *ti, *ts; 662 struct snd_timer_instance *ti, *ts;
664 unsigned long resolution, ticks; 663 unsigned long resolution, ticks;
665 struct list_head *p, *q, *n, *ack_list_head; 664 struct list_head *p, *q, *n, *ack_list_head;
666 int use_tasklet = 0; 665 int use_tasklet = 0;
@@ -682,7 +681,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
682 * is called. 681 * is called.
683 */ 682 */
684 list_for_each_safe(p, n, &timer->active_list_head) { 683 list_for_each_safe(p, n, &timer->active_list_head) {
685 ti = list_entry(p, snd_timer_instance_t, active_list); 684 ti = list_entry(p, struct snd_timer_instance, active_list);
686 if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING)) 685 if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING))
687 continue; 686 continue;
688 ti->pticks += ticks_left; 687 ti->pticks += ticks_left;
@@ -708,7 +707,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
708 if (list_empty(&ti->ack_list)) 707 if (list_empty(&ti->ack_list))
709 list_add_tail(&ti->ack_list, ack_list_head); 708 list_add_tail(&ti->ack_list, ack_list_head);
710 list_for_each(q, &ti->slave_active_head) { 709 list_for_each(q, &ti->slave_active_head) {
711 ts = list_entry(q, snd_timer_instance_t, active_list); 710 ts = list_entry(q, struct snd_timer_instance, active_list);
712 ts->pticks = ti->pticks; 711 ts->pticks = ti->pticks;
713 ts->resolution = resolution; 712 ts->resolution = resolution;
714 if (list_empty(&ts->ack_list)) 713 if (list_empty(&ts->ack_list))
@@ -735,7 +734,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
735 /* now process all fast callbacks */ 734 /* now process all fast callbacks */
736 while (!list_empty(&timer->ack_list_head)) { 735 while (!list_empty(&timer->ack_list_head)) {
737 p = timer->ack_list_head.next; /* get first item */ 736 p = timer->ack_list_head.next; /* get first item */
738 ti = list_entry(p, snd_timer_instance_t, ack_list); 737 ti = list_entry(p, struct snd_timer_instance, ack_list);
739 738
740 /* remove from ack_list and make empty */ 739 /* remove from ack_list and make empty */
741 list_del_init(p); 740 list_del_init(p);
@@ -763,12 +762,12 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
763 762
764 */ 763 */
765 764
766int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, 765int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
767 snd_timer_t **rtimer) 766 struct snd_timer **rtimer)
768{ 767{
769 snd_timer_t *timer; 768 struct snd_timer *timer;
770 int err; 769 int err;
771 static snd_device_ops_t ops = { 770 static struct snd_device_ops ops = {
772 .dev_free = snd_timer_dev_free, 771 .dev_free = snd_timer_dev_free,
773 .dev_register = snd_timer_dev_register, 772 .dev_register = snd_timer_dev_register,
774 .dev_unregister = snd_timer_dev_unregister 773 .dev_unregister = snd_timer_dev_unregister
@@ -806,7 +805,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid,
806 return 0; 805 return 0;
807} 806}
808 807
809static int snd_timer_free(snd_timer_t *timer) 808static int snd_timer_free(struct snd_timer *timer)
810{ 809{
811 snd_assert(timer != NULL, return -ENXIO); 810 snd_assert(timer != NULL, return -ENXIO);
812 if (timer->private_free) 811 if (timer->private_free)
@@ -815,16 +814,16 @@ static int snd_timer_free(snd_timer_t *timer)
815 return 0; 814 return 0;
816} 815}
817 816
818static int snd_timer_dev_free(snd_device_t *device) 817static int snd_timer_dev_free(struct snd_device *device)
819{ 818{
820 snd_timer_t *timer = device->device_data; 819 struct snd_timer *timer = device->device_data;
821 return snd_timer_free(timer); 820 return snd_timer_free(timer);
822} 821}
823 822
824static int snd_timer_dev_register(snd_device_t *dev) 823static int snd_timer_dev_register(struct snd_device *dev)
825{ 824{
826 snd_timer_t *timer = dev->device_data; 825 struct snd_timer *timer = dev->device_data;
827 snd_timer_t *timer1; 826 struct snd_timer *timer1;
828 struct list_head *p; 827 struct list_head *p;
829 828
830 snd_assert(timer != NULL && timer->hw.start != NULL && 829 snd_assert(timer != NULL && timer->hw.start != NULL &&
@@ -835,7 +834,7 @@ static int snd_timer_dev_register(snd_device_t *dev)
835 834
836 down(&register_mutex); 835 down(&register_mutex);
837 list_for_each(p, &snd_timer_list) { 836 list_for_each(p, &snd_timer_list) {
838 timer1 = list_entry(p, snd_timer_t, device_list); 837 timer1 = list_entry(p, struct snd_timer, device_list);
839 if (timer1->tmr_class > timer->tmr_class) 838 if (timer1->tmr_class > timer->tmr_class)
840 break; 839 break;
841 if (timer1->tmr_class < timer->tmr_class) 840 if (timer1->tmr_class < timer->tmr_class)
@@ -863,10 +862,10 @@ static int snd_timer_dev_register(snd_device_t *dev)
863 return 0; 862 return 0;
864} 863}
865 864
866static int snd_timer_unregister(snd_timer_t *timer) 865static int snd_timer_unregister(struct snd_timer *timer)
867{ 866{
868 struct list_head *p, *n; 867 struct list_head *p, *n;
869 snd_timer_instance_t *ti; 868 struct snd_timer_instance *ti;
870 869
871 snd_assert(timer != NULL, return -ENXIO); 870 snd_assert(timer != NULL, return -ENXIO);
872 down(&register_mutex); 871 down(&register_mutex);
@@ -874,7 +873,7 @@ static int snd_timer_unregister(snd_timer_t *timer)
874 snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer); 873 snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer);
875 list_for_each_safe(p, n, &timer->open_list_head) { 874 list_for_each_safe(p, n, &timer->open_list_head) {
876 list_del_init(p); 875 list_del_init(p);
877 ti = list_entry(p, snd_timer_instance_t, open_list); 876 ti = list_entry(p, struct snd_timer_instance, open_list);
878 ti->timer = NULL; 877 ti->timer = NULL;
879 } 878 }
880 } 879 }
@@ -883,18 +882,17 @@ static int snd_timer_unregister(snd_timer_t *timer)
883 return snd_timer_free(timer); 882 return snd_timer_free(timer);
884} 883}
885 884
886static int snd_timer_dev_unregister(snd_device_t *device) 885static int snd_timer_dev_unregister(struct snd_device *device)
887{ 886{
888 snd_timer_t *timer = device->device_data; 887 struct snd_timer *timer = device->device_data;
889 return snd_timer_unregister(timer); 888 return snd_timer_unregister(timer);
890} 889}
891 890
892void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, 891void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp)
893 struct timespec *tstamp)
894{ 892{
895 unsigned long flags; 893 unsigned long flags;
896 unsigned long resolution = 0; 894 unsigned long resolution = 0;
897 snd_timer_instance_t *ti, *ts; 895 struct snd_timer_instance *ti, *ts;
898 struct list_head *p, *n; 896 struct list_head *p, *n;
899 897
900 if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)) 898 if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE))
@@ -911,11 +909,11 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event,
911 resolution = timer->hw.resolution; 909 resolution = timer->hw.resolution;
912 } 910 }
913 list_for_each(p, &timer->active_list_head) { 911 list_for_each(p, &timer->active_list_head) {
914 ti = list_entry(p, snd_timer_instance_t, active_list); 912 ti = list_entry(p, struct snd_timer_instance, active_list);
915 if (ti->ccallback) 913 if (ti->ccallback)
916 ti->ccallback(ti, event, tstamp, resolution); 914 ti->ccallback(ti, event, tstamp, resolution);
917 list_for_each(n, &ti->slave_active_head) { 915 list_for_each(n, &ti->slave_active_head) {
918 ts = list_entry(n, snd_timer_instance_t, active_list); 916 ts = list_entry(n, struct snd_timer_instance, active_list);
919 if (ts->ccallback) 917 if (ts->ccallback)
920 ts->ccallback(ts, event, tstamp, resolution); 918 ts->ccallback(ts, event, tstamp, resolution);
921 } 919 }
@@ -926,9 +924,9 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event,
926/* 924/*
927 * exported functions for global timers 925 * exported functions for global timers
928 */ 926 */
929int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer) 927int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer)
930{ 928{
931 snd_timer_id_t tid; 929 struct snd_timer_id tid;
932 930
933 tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL; 931 tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL;
934 tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; 932 tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
@@ -938,21 +936,21 @@ int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer)
938 return snd_timer_new(NULL, id, &tid, rtimer); 936 return snd_timer_new(NULL, id, &tid, rtimer);
939} 937}
940 938
941int snd_timer_global_free(snd_timer_t *timer) 939int snd_timer_global_free(struct snd_timer *timer)
942{ 940{
943 return snd_timer_free(timer); 941 return snd_timer_free(timer);
944} 942}
945 943
946int snd_timer_global_register(snd_timer_t *timer) 944int snd_timer_global_register(struct snd_timer *timer)
947{ 945{
948 snd_device_t dev; 946 struct snd_device dev;
949 947
950 memset(&dev, 0, sizeof(dev)); 948 memset(&dev, 0, sizeof(dev));
951 dev.device_data = timer; 949 dev.device_data = timer;
952 return snd_timer_dev_register(&dev); 950 return snd_timer_dev_register(&dev);
953} 951}
954 952
955int snd_timer_global_unregister(snd_timer_t *timer) 953int snd_timer_global_unregister(struct snd_timer *timer)
956{ 954{
957 return snd_timer_unregister(timer); 955 return snd_timer_unregister(timer);
958} 956}
@@ -971,7 +969,7 @@ struct snd_timer_system_private {
971 969
972static void snd_timer_s_function(unsigned long data) 970static void snd_timer_s_function(unsigned long data)
973{ 971{
974 snd_timer_t *timer = (snd_timer_t *)data; 972 struct snd_timer *timer = (struct snd_timer *)data;
975 struct snd_timer_system_private *priv = timer->private_data; 973 struct snd_timer_system_private *priv = timer->private_data;
976 unsigned long jiff = jiffies; 974 unsigned long jiff = jiffies;
977 if (time_after(jiff, priv->last_expires)) 975 if (time_after(jiff, priv->last_expires))
@@ -979,7 +977,7 @@ static void snd_timer_s_function(unsigned long data)
979 snd_timer_interrupt(timer, (long)jiff - (long)priv->last_jiffies); 977 snd_timer_interrupt(timer, (long)jiff - (long)priv->last_jiffies);
980} 978}
981 979
982static int snd_timer_s_start(snd_timer_t * timer) 980static int snd_timer_s_start(struct snd_timer * timer)
983{ 981{
984 struct snd_timer_system_private *priv; 982 struct snd_timer_system_private *priv;
985 unsigned long njiff; 983 unsigned long njiff;
@@ -998,7 +996,7 @@ static int snd_timer_s_start(snd_timer_t * timer)
998 return 0; 996 return 0;
999} 997}
1000 998
1001static int snd_timer_s_stop(snd_timer_t * timer) 999static int snd_timer_s_stop(struct snd_timer * timer)
1002{ 1000{
1003 struct snd_timer_system_private *priv; 1001 struct snd_timer_system_private *priv;
1004 unsigned long jiff; 1002 unsigned long jiff;
@@ -1013,7 +1011,7 @@ static int snd_timer_s_stop(snd_timer_t * timer)
1013 return 0; 1011 return 0;
1014} 1012}
1015 1013
1016static struct _snd_timer_hardware snd_timer_system = 1014static struct snd_timer_hardware snd_timer_system =
1017{ 1015{
1018 .flags = SNDRV_TIMER_HW_FIRST | SNDRV_TIMER_HW_TASKLET, 1016 .flags = SNDRV_TIMER_HW_FIRST | SNDRV_TIMER_HW_TASKLET,
1019 .resolution = 1000000000L / HZ, 1017 .resolution = 1000000000L / HZ,
@@ -1022,14 +1020,14 @@ static struct _snd_timer_hardware snd_timer_system =
1022 .stop = snd_timer_s_stop 1020 .stop = snd_timer_s_stop
1023}; 1021};
1024 1022
1025static void snd_timer_free_system(snd_timer_t *timer) 1023static void snd_timer_free_system(struct snd_timer *timer)
1026{ 1024{
1027 kfree(timer->private_data); 1025 kfree(timer->private_data);
1028} 1026}
1029 1027
1030static int snd_timer_register_system(void) 1028static int snd_timer_register_system(void)
1031{ 1029{
1032 snd_timer_t *timer; 1030 struct snd_timer *timer;
1033 struct snd_timer_system_private *priv; 1031 struct snd_timer_system_private *priv;
1034 int err; 1032 int err;
1035 1033
@@ -1055,17 +1053,17 @@ static int snd_timer_register_system(void)
1055 * Info interface 1053 * Info interface
1056 */ 1054 */
1057 1055
1058static void snd_timer_proc_read(snd_info_entry_t *entry, 1056static void snd_timer_proc_read(struct snd_info_entry *entry,
1059 snd_info_buffer_t * buffer) 1057 struct snd_info_buffer *buffer)
1060{ 1058{
1061 unsigned long flags; 1059 unsigned long flags;
1062 snd_timer_t *timer; 1060 struct snd_timer *timer;
1063 snd_timer_instance_t *ti; 1061 struct snd_timer_instance *ti;
1064 struct list_head *p, *q; 1062 struct list_head *p, *q;
1065 1063
1066 down(&register_mutex); 1064 down(&register_mutex);
1067 list_for_each(p, &snd_timer_list) { 1065 list_for_each(p, &snd_timer_list) {
1068 timer = list_entry(p, snd_timer_t, device_list); 1066 timer = list_entry(p, struct snd_timer, device_list);
1069 switch (timer->tmr_class) { 1067 switch (timer->tmr_class) {
1070 case SNDRV_TIMER_CLASS_GLOBAL: 1068 case SNDRV_TIMER_CLASS_GLOBAL:
1071 snd_iprintf(buffer, "G%i: ", timer->tmr_device); 1069 snd_iprintf(buffer, "G%i: ", timer->tmr_device);
@@ -1094,7 +1092,7 @@ static void snd_timer_proc_read(snd_info_entry_t *entry,
1094 snd_iprintf(buffer, "\n"); 1092 snd_iprintf(buffer, "\n");
1095 spin_lock_irqsave(&timer->lock, flags); 1093 spin_lock_irqsave(&timer->lock, flags);
1096 list_for_each(q, &timer->open_list_head) { 1094 list_for_each(q, &timer->open_list_head) {
1097 ti = list_entry(q, snd_timer_instance_t, open_list); 1095 ti = list_entry(q, struct snd_timer_instance, open_list);
1098 snd_iprintf(buffer, " Client %s : %s\n", 1096 snd_iprintf(buffer, " Client %s : %s\n",
1099 ti->owner ? ti->owner : "unknown", 1097 ti->owner ? ti->owner : "unknown",
1100 ti->flags & (SNDRV_TIMER_IFLG_START | 1098 ti->flags & (SNDRV_TIMER_IFLG_START |
@@ -1110,12 +1108,12 @@ static void snd_timer_proc_read(snd_info_entry_t *entry,
1110 * USER SPACE interface 1108 * USER SPACE interface
1111 */ 1109 */
1112 1110
1113static void snd_timer_user_interrupt(snd_timer_instance_t *timeri, 1111static void snd_timer_user_interrupt(struct snd_timer_instance *timeri,
1114 unsigned long resolution, 1112 unsigned long resolution,
1115 unsigned long ticks) 1113 unsigned long ticks)
1116{ 1114{
1117 snd_timer_user_t *tu = timeri->callback_data; 1115 struct snd_timer_user *tu = timeri->callback_data;
1118 snd_timer_read_t *r; 1116 struct snd_timer_read *r;
1119 int prev; 1117 int prev;
1120 1118
1121 spin_lock(&tu->qlock); 1119 spin_lock(&tu->qlock);
@@ -1142,8 +1140,8 @@ static void snd_timer_user_interrupt(snd_timer_instance_t *timeri,
1142 wake_up(&tu->qchange_sleep); 1140 wake_up(&tu->qchange_sleep);
1143} 1141}
1144 1142
1145static void snd_timer_user_append_to_tqueue(snd_timer_user_t *tu, 1143static void snd_timer_user_append_to_tqueue(struct snd_timer_user *tu,
1146 snd_timer_tread_t *tread) 1144 struct snd_timer_tread *tread)
1147{ 1145{
1148 if (tu->qused >= tu->queue_size) { 1146 if (tu->qused >= tu->queue_size) {
1149 tu->overrun++; 1147 tu->overrun++;
@@ -1154,13 +1152,13 @@ static void snd_timer_user_append_to_tqueue(snd_timer_user_t *tu,
1154 } 1152 }
1155} 1153}
1156 1154
1157static void snd_timer_user_ccallback(snd_timer_instance_t *timeri, 1155static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,
1158 enum sndrv_timer_event event, 1156 int event,
1159 struct timespec *tstamp, 1157 struct timespec *tstamp,
1160 unsigned long resolution) 1158 unsigned long resolution)
1161{ 1159{
1162 snd_timer_user_t *tu = timeri->callback_data; 1160 struct snd_timer_user *tu = timeri->callback_data;
1163 snd_timer_tread_t r1; 1161 struct snd_timer_tread r1;
1164 1162
1165 if (event >= SNDRV_TIMER_EVENT_START && 1163 if (event >= SNDRV_TIMER_EVENT_START &&
1166 event <= SNDRV_TIMER_EVENT_PAUSE) 1164 event <= SNDRV_TIMER_EVENT_PAUSE)
@@ -1177,12 +1175,12 @@ static void snd_timer_user_ccallback(snd_timer_instance_t *timeri,
1177 wake_up(&tu->qchange_sleep); 1175 wake_up(&tu->qchange_sleep);
1178} 1176}
1179 1177
1180static void snd_timer_user_tinterrupt(snd_timer_instance_t *timeri, 1178static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
1181 unsigned long resolution, 1179 unsigned long resolution,
1182 unsigned long ticks) 1180 unsigned long ticks)
1183{ 1181{
1184 snd_timer_user_t *tu = timeri->callback_data; 1182 struct snd_timer_user *tu = timeri->callback_data;
1185 snd_timer_tread_t *r, r1; 1183 struct snd_timer_tread *r, r1;
1186 struct timespec tstamp; 1184 struct timespec tstamp;
1187 int prev, append = 0; 1185 int prev, append = 0;
1188 1186
@@ -1233,7 +1231,7 @@ static void snd_timer_user_tinterrupt(snd_timer_instance_t *timeri,
1233 1231
1234static int snd_timer_user_open(struct inode *inode, struct file *file) 1232static int snd_timer_user_open(struct inode *inode, struct file *file)
1235{ 1233{
1236 snd_timer_user_t *tu; 1234 struct snd_timer_user *tu;
1237 1235
1238 tu = kzalloc(sizeof(*tu), GFP_KERNEL); 1236 tu = kzalloc(sizeof(*tu), GFP_KERNEL);
1239 if (tu == NULL) 1237 if (tu == NULL)
@@ -1243,7 +1241,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
1243 init_MUTEX(&tu->tread_sem); 1241 init_MUTEX(&tu->tread_sem);
1244 tu->ticks = 1; 1242 tu->ticks = 1;
1245 tu->queue_size = 128; 1243 tu->queue_size = 128;
1246 tu->queue = kmalloc(tu->queue_size * sizeof(snd_timer_read_t), 1244 tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read),
1247 GFP_KERNEL); 1245 GFP_KERNEL);
1248 if (tu->queue == NULL) { 1246 if (tu->queue == NULL) {
1249 kfree(tu); 1247 kfree(tu);
@@ -1255,7 +1253,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
1255 1253
1256static int snd_timer_user_release(struct inode *inode, struct file *file) 1254static int snd_timer_user_release(struct inode *inode, struct file *file)
1257{ 1255{
1258 snd_timer_user_t *tu; 1256 struct snd_timer_user *tu;
1259 1257
1260 if (file->private_data) { 1258 if (file->private_data) {
1261 tu = file->private_data; 1259 tu = file->private_data;
@@ -1270,7 +1268,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
1270 return 0; 1268 return 0;
1271} 1269}
1272 1270
1273static void snd_timer_user_zero_id(snd_timer_id_t *id) 1271static void snd_timer_user_zero_id(struct snd_timer_id *id)
1274{ 1272{
1275 id->dev_class = SNDRV_TIMER_CLASS_NONE; 1273 id->dev_class = SNDRV_TIMER_CLASS_NONE;
1276 id->dev_sclass = SNDRV_TIMER_SCLASS_NONE; 1274 id->dev_sclass = SNDRV_TIMER_SCLASS_NONE;
@@ -1279,7 +1277,7 @@ static void snd_timer_user_zero_id(snd_timer_id_t *id)
1279 id->subdevice = -1; 1277 id->subdevice = -1;
1280} 1278}
1281 1279
1282static void snd_timer_user_copy_id(snd_timer_id_t *id, snd_timer_t *timer) 1280static void snd_timer_user_copy_id(struct snd_timer_id *id, struct snd_timer *timer)
1283{ 1281{
1284 id->dev_class = timer->tmr_class; 1282 id->dev_class = timer->tmr_class;
1285 id->dev_sclass = SNDRV_TIMER_SCLASS_NONE; 1283 id->dev_sclass = SNDRV_TIMER_SCLASS_NONE;
@@ -1288,10 +1286,10 @@ static void snd_timer_user_copy_id(snd_timer_id_t *id, snd_timer_t *timer)
1288 id->subdevice = timer->tmr_subdevice; 1286 id->subdevice = timer->tmr_subdevice;
1289} 1287}
1290 1288
1291static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) 1289static int snd_timer_user_next_device(struct snd_timer_id __user *_tid)
1292{ 1290{
1293 snd_timer_id_t id; 1291 struct snd_timer_id id;
1294 snd_timer_t *timer; 1292 struct snd_timer *timer;
1295 struct list_head *p; 1293 struct list_head *p;
1296 1294
1297 if (copy_from_user(&id, _tid, sizeof(id))) 1295 if (copy_from_user(&id, _tid, sizeof(id)))
@@ -1302,7 +1300,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1302 snd_timer_user_zero_id(&id); 1300 snd_timer_user_zero_id(&id);
1303 else { 1301 else {
1304 timer = list_entry(snd_timer_list.next, 1302 timer = list_entry(snd_timer_list.next,
1305 snd_timer_t, device_list); 1303 struct snd_timer, device_list);
1306 snd_timer_user_copy_id(&id, timer); 1304 snd_timer_user_copy_id(&id, timer);
1307 } 1305 }
1308 } else { 1306 } else {
@@ -1310,7 +1308,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1310 case SNDRV_TIMER_CLASS_GLOBAL: 1308 case SNDRV_TIMER_CLASS_GLOBAL:
1311 id.device = id.device < 0 ? 0 : id.device + 1; 1309 id.device = id.device < 0 ? 0 : id.device + 1;
1312 list_for_each(p, &snd_timer_list) { 1310 list_for_each(p, &snd_timer_list) {
1313 timer = list_entry(p, snd_timer_t, device_list); 1311 timer = list_entry(p, struct snd_timer, device_list);
1314 if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) { 1312 if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) {
1315 snd_timer_user_copy_id(&id, timer); 1313 snd_timer_user_copy_id(&id, timer);
1316 break; 1314 break;
@@ -1343,7 +1341,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1343 } 1341 }
1344 } 1342 }
1345 list_for_each(p, &snd_timer_list) { 1343 list_for_each(p, &snd_timer_list) {
1346 timer = list_entry(p, snd_timer_t, device_list); 1344 timer = list_entry(p, struct snd_timer, device_list);
1347 if (timer->tmr_class > id.dev_class) { 1345 if (timer->tmr_class > id.dev_class) {
1348 snd_timer_user_copy_id(&id, timer); 1346 snd_timer_user_copy_id(&id, timer);
1349 break; 1347 break;
@@ -1385,11 +1383,11 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
1385} 1383}
1386 1384
1387static int snd_timer_user_ginfo(struct file *file, 1385static int snd_timer_user_ginfo(struct file *file,
1388 snd_timer_ginfo_t __user *_ginfo) 1386 struct snd_timer_ginfo __user *_ginfo)
1389{ 1387{
1390 snd_timer_ginfo_t *ginfo; 1388 struct snd_timer_ginfo *ginfo;
1391 snd_timer_id_t tid; 1389 struct snd_timer_id tid;
1392 snd_timer_t *t; 1390 struct snd_timer *t;
1393 struct list_head *p; 1391 struct list_head *p;
1394 int err = 0; 1392 int err = 0;
1395 1393
@@ -1430,10 +1428,10 @@ static int snd_timer_user_ginfo(struct file *file,
1430} 1428}
1431 1429
1432static int snd_timer_user_gparams(struct file *file, 1430static int snd_timer_user_gparams(struct file *file,
1433 snd_timer_gparams_t __user *_gparams) 1431 struct snd_timer_gparams __user *_gparams)
1434{ 1432{
1435 snd_timer_gparams_t gparams; 1433 struct snd_timer_gparams gparams;
1436 snd_timer_t *t; 1434 struct snd_timer *t;
1437 int err; 1435 int err;
1438 1436
1439 if (copy_from_user(&gparams, _gparams, sizeof(gparams))) 1437 if (copy_from_user(&gparams, _gparams, sizeof(gparams)))
@@ -1459,11 +1457,11 @@ _error:
1459} 1457}
1460 1458
1461static int snd_timer_user_gstatus(struct file *file, 1459static int snd_timer_user_gstatus(struct file *file,
1462 snd_timer_gstatus_t __user *_gstatus) 1460 struct snd_timer_gstatus __user *_gstatus)
1463{ 1461{
1464 snd_timer_gstatus_t gstatus; 1462 struct snd_timer_gstatus gstatus;
1465 snd_timer_id_t tid; 1463 struct snd_timer_id tid;
1466 snd_timer_t *t; 1464 struct snd_timer *t;
1467 int err = 0; 1465 int err = 0;
1468 1466
1469 if (copy_from_user(&gstatus, _gstatus, sizeof(gstatus))) 1467 if (copy_from_user(&gstatus, _gstatus, sizeof(gstatus)))
@@ -1495,10 +1493,10 @@ static int snd_timer_user_gstatus(struct file *file,
1495} 1493}
1496 1494
1497static int snd_timer_user_tselect(struct file *file, 1495static int snd_timer_user_tselect(struct file *file,
1498 snd_timer_select_t __user *_tselect) 1496 struct snd_timer_select __user *_tselect)
1499{ 1497{
1500 snd_timer_user_t *tu; 1498 struct snd_timer_user *tu;
1501 snd_timer_select_t tselect; 1499 struct snd_timer_select tselect;
1502 char str[32]; 1500 char str[32];
1503 int err = 0; 1501 int err = 0;
1504 1502
@@ -1524,12 +1522,12 @@ static int snd_timer_user_tselect(struct file *file,
1524 kfree(tu->tqueue); 1522 kfree(tu->tqueue);
1525 tu->tqueue = NULL; 1523 tu->tqueue = NULL;
1526 if (tu->tread) { 1524 if (tu->tread) {
1527 tu->tqueue = kmalloc(tu->queue_size * sizeof(snd_timer_tread_t), 1525 tu->tqueue = kmalloc(tu->queue_size * sizeof(struct snd_timer_tread),
1528 GFP_KERNEL); 1526 GFP_KERNEL);
1529 if (tu->tqueue == NULL) 1527 if (tu->tqueue == NULL)
1530 err = -ENOMEM; 1528 err = -ENOMEM;
1531 } else { 1529 } else {
1532 tu->queue = kmalloc(tu->queue_size * sizeof(snd_timer_read_t), 1530 tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read),
1533 GFP_KERNEL); 1531 GFP_KERNEL);
1534 if (tu->queue == NULL) 1532 if (tu->queue == NULL)
1535 err = -ENOMEM; 1533 err = -ENOMEM;
@@ -1552,11 +1550,11 @@ static int snd_timer_user_tselect(struct file *file,
1552} 1550}
1553 1551
1554static int snd_timer_user_info(struct file *file, 1552static int snd_timer_user_info(struct file *file,
1555 snd_timer_info_t __user *_info) 1553 struct snd_timer_info __user *_info)
1556{ 1554{
1557 snd_timer_user_t *tu; 1555 struct snd_timer_user *tu;
1558 snd_timer_info_t *info; 1556 struct snd_timer_info *info;
1559 snd_timer_t *t; 1557 struct snd_timer *t;
1560 int err = 0; 1558 int err = 0;
1561 1559
1562 tu = file->private_data; 1560 tu = file->private_data;
@@ -1580,13 +1578,13 @@ static int snd_timer_user_info(struct file *file,
1580} 1578}
1581 1579
1582static int snd_timer_user_params(struct file *file, 1580static int snd_timer_user_params(struct file *file,
1583 snd_timer_params_t __user *_params) 1581 struct snd_timer_params __user *_params)
1584{ 1582{
1585 snd_timer_user_t *tu; 1583 struct snd_timer_user *tu;
1586 snd_timer_params_t params; 1584 struct snd_timer_params params;
1587 snd_timer_t *t; 1585 struct snd_timer *t;
1588 snd_timer_read_t *tr; 1586 struct snd_timer_read *tr;
1589 snd_timer_tread_t *ttr; 1587 struct snd_timer_tread *ttr;
1590 int err; 1588 int err;
1591 1589
1592 tu = file->private_data; 1590 tu = file->private_data;
@@ -1656,14 +1654,14 @@ static int snd_timer_user_params(struct file *file,
1656 tu->qhead = tu->qtail = tu->qused = 0; 1654 tu->qhead = tu->qtail = tu->qused = 0;
1657 if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { 1655 if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) {
1658 if (tu->tread) { 1656 if (tu->tread) {
1659 snd_timer_tread_t tread; 1657 struct snd_timer_tread tread;
1660 tread.event = SNDRV_TIMER_EVENT_EARLY; 1658 tread.event = SNDRV_TIMER_EVENT_EARLY;
1661 tread.tstamp.tv_sec = 0; 1659 tread.tstamp.tv_sec = 0;
1662 tread.tstamp.tv_nsec = 0; 1660 tread.tstamp.tv_nsec = 0;
1663 tread.val = 0; 1661 tread.val = 0;
1664 snd_timer_user_append_to_tqueue(tu, &tread); 1662 snd_timer_user_append_to_tqueue(tu, &tread);
1665 } else { 1663 } else {
1666 snd_timer_read_t *r = &tu->queue[0]; 1664 struct snd_timer_read *r = &tu->queue[0];
1667 r->resolution = 0; 1665 r->resolution = 0;
1668 r->ticks = 0; 1666 r->ticks = 0;
1669 tu->qused++; 1667 tu->qused++;
@@ -1680,10 +1678,10 @@ static int snd_timer_user_params(struct file *file,
1680} 1678}
1681 1679
1682static int snd_timer_user_status(struct file *file, 1680static int snd_timer_user_status(struct file *file,
1683 snd_timer_status_t __user *_status) 1681 struct snd_timer_status __user *_status)
1684{ 1682{
1685 snd_timer_user_t *tu; 1683 struct snd_timer_user *tu;
1686 snd_timer_status_t status; 1684 struct snd_timer_status status;
1687 1685
1688 tu = file->private_data; 1686 tu = file->private_data;
1689 snd_assert(tu->timeri != NULL, return -ENXIO); 1687 snd_assert(tu->timeri != NULL, return -ENXIO);
@@ -1703,7 +1701,7 @@ static int snd_timer_user_status(struct file *file,
1703static int snd_timer_user_start(struct file *file) 1701static int snd_timer_user_start(struct file *file)
1704{ 1702{
1705 int err; 1703 int err;
1706 snd_timer_user_t *tu; 1704 struct snd_timer_user *tu;
1707 1705
1708 tu = file->private_data; 1706 tu = file->private_data;
1709 snd_assert(tu->timeri != NULL, return -ENXIO); 1707 snd_assert(tu->timeri != NULL, return -ENXIO);
@@ -1716,7 +1714,7 @@ static int snd_timer_user_start(struct file *file)
1716static int snd_timer_user_stop(struct file *file) 1714static int snd_timer_user_stop(struct file *file)
1717{ 1715{
1718 int err; 1716 int err;
1719 snd_timer_user_t *tu; 1717 struct snd_timer_user *tu;
1720 1718
1721 tu = file->private_data; 1719 tu = file->private_data;
1722 snd_assert(tu->timeri != NULL, return -ENXIO); 1720 snd_assert(tu->timeri != NULL, return -ENXIO);
@@ -1726,7 +1724,7 @@ static int snd_timer_user_stop(struct file *file)
1726static int snd_timer_user_continue(struct file *file) 1724static int snd_timer_user_continue(struct file *file)
1727{ 1725{
1728 int err; 1726 int err;
1729 snd_timer_user_t *tu; 1727 struct snd_timer_user *tu;
1730 1728
1731 tu = file->private_data; 1729 tu = file->private_data;
1732 snd_assert(tu->timeri != NULL, return -ENXIO); 1730 snd_assert(tu->timeri != NULL, return -ENXIO);
@@ -1737,7 +1735,7 @@ static int snd_timer_user_continue(struct file *file)
1737static int snd_timer_user_pause(struct file *file) 1735static int snd_timer_user_pause(struct file *file)
1738{ 1736{
1739 int err; 1737 int err;
1740 snd_timer_user_t *tu; 1738 struct snd_timer_user *tu;
1741 1739
1742 tu = file->private_data; 1740 tu = file->private_data;
1743 snd_assert(tu->timeri != NULL, return -ENXIO); 1741 snd_assert(tu->timeri != NULL, return -ENXIO);
@@ -1754,7 +1752,7 @@ enum {
1754static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, 1752static long snd_timer_user_ioctl(struct file *file, unsigned int cmd,
1755 unsigned long arg) 1753 unsigned long arg)
1756{ 1754{
1757 snd_timer_user_t *tu; 1755 struct snd_timer_user *tu;
1758 void __user *argp = (void __user *)arg; 1756 void __user *argp = (void __user *)arg;
1759 int __user *p = argp; 1757 int __user *p = argp;
1760 1758
@@ -1813,7 +1811,7 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd,
1813 1811
1814static int snd_timer_user_fasync(int fd, struct file * file, int on) 1812static int snd_timer_user_fasync(int fd, struct file * file, int on)
1815{ 1813{
1816 snd_timer_user_t *tu; 1814 struct snd_timer_user *tu;
1817 int err; 1815 int err;
1818 1816
1819 tu = file->private_data; 1817 tu = file->private_data;
@@ -1826,12 +1824,12 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)
1826static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, 1824static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1827 size_t count, loff_t *offset) 1825 size_t count, loff_t *offset)
1828{ 1826{
1829 snd_timer_user_t *tu; 1827 struct snd_timer_user *tu;
1830 long result = 0, unit; 1828 long result = 0, unit;
1831 int err = 0; 1829 int err = 0;
1832 1830
1833 tu = file->private_data; 1831 tu = file->private_data;
1834 unit = tu->tread ? sizeof(snd_timer_tread_t) : sizeof(snd_timer_read_t); 1832 unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read);
1835 spin_lock_irq(&tu->qlock); 1833 spin_lock_irq(&tu->qlock);
1836 while ((long)count - result >= unit) { 1834 while ((long)count - result >= unit) {
1837 while (!tu->qused) { 1835 while (!tu->qused) {
@@ -1864,13 +1862,13 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1864 1862
1865 if (tu->tread) { 1863 if (tu->tread) {
1866 if (copy_to_user(buffer, &tu->tqueue[tu->qhead++], 1864 if (copy_to_user(buffer, &tu->tqueue[tu->qhead++],
1867 sizeof(snd_timer_tread_t))) { 1865 sizeof(struct snd_timer_tread))) {
1868 err = -EFAULT; 1866 err = -EFAULT;
1869 goto _error; 1867 goto _error;
1870 } 1868 }
1871 } else { 1869 } else {
1872 if (copy_to_user(buffer, &tu->queue[tu->qhead++], 1870 if (copy_to_user(buffer, &tu->queue[tu->qhead++],
1873 sizeof(snd_timer_read_t))) { 1871 sizeof(struct snd_timer_read))) {
1874 err = -EFAULT; 1872 err = -EFAULT;
1875 goto _error; 1873 goto _error;
1876 } 1874 }
@@ -1892,7 +1890,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1892static unsigned int snd_timer_user_poll(struct file *file, poll_table * wait) 1890static unsigned int snd_timer_user_poll(struct file *file, poll_table * wait)
1893{ 1891{
1894 unsigned int mask; 1892 unsigned int mask;
1895 snd_timer_user_t *tu; 1893 struct snd_timer_user *tu;
1896 1894
1897 tu = file->private_data; 1895 tu = file->private_data;
1898 1896
@@ -1923,7 +1921,7 @@ static struct file_operations snd_timer_f_ops =
1923 .fasync = snd_timer_user_fasync, 1921 .fasync = snd_timer_user_fasync,
1924}; 1922};
1925 1923
1926static snd_minor_t snd_timer_reg = 1924static struct snd_minor snd_timer_reg =
1927{ 1925{
1928 .comment = "timer", 1926 .comment = "timer",
1929 .f_ops = &snd_timer_f_ops, 1927 .f_ops = &snd_timer_f_ops,
@@ -1933,12 +1931,12 @@ static snd_minor_t snd_timer_reg =
1933 * ENTRY functions 1931 * ENTRY functions
1934 */ 1932 */
1935 1933
1936static snd_info_entry_t *snd_timer_proc_entry = NULL; 1934static struct snd_info_entry *snd_timer_proc_entry = NULL;
1937 1935
1938static int __init alsa_timer_init(void) 1936static int __init alsa_timer_init(void)
1939{ 1937{
1940 int err; 1938 int err;
1941 snd_info_entry_t *entry; 1939 struct snd_info_entry *entry;
1942 1940
1943#ifdef SNDRV_OSS_INFO_DEV_TIMERS 1941#ifdef SNDRV_OSS_INFO_DEV_TIMERS
1944 snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1, 1942 snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1,
@@ -1971,7 +1969,7 @@ static void __exit alsa_timer_exit(void)
1971 snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0); 1969 snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0);
1972 /* unregister the system timer */ 1970 /* unregister the system timer */
1973 list_for_each_safe(p, n, &snd_timer_list) { 1971 list_for_each_safe(p, n, &snd_timer_list) {
1974 snd_timer_t *timer = list_entry(p, snd_timer_t, device_list); 1972 struct snd_timer *timer = list_entry(p, struct snd_timer, device_list);
1975 snd_timer_unregister(timer); 1973 snd_timer_unregister(timer);
1976 } 1974 }
1977 if (snd_timer_proc_entry) { 1975 if (snd_timer_proc_entry) {