aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 07:59:38 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:43 -0500
commit877211f5e1b1196179ba1290e8e1a3dc00427c55 (patch)
tree9964e0e46043cee6c76a614ac35ab982faba7f99 /sound/core/pcm_native.c
parent24c1f93188b4438c7f30df5b4cd78340cdb28daf (diff)
[ALSA] Remove xxx_t typedefs: PCM
Modules: PCM Midlevel Remove xxx_t typedefs from the core PCM codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c623
1 files changed, 332 insertions, 291 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 16e252f5495..263c01a70fd 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -39,11 +39,11 @@
39 * Compatibility 39 * Compatibility
40 */ 40 */
41 41
42struct sndrv_pcm_hw_params_old { 42struct snd_pcm_hw_params_old {
43 unsigned int flags; 43 unsigned int flags;
44 unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT - 44 unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT -
45 SNDRV_PCM_HW_PARAM_ACCESS + 1]; 45 SNDRV_PCM_HW_PARAM_ACCESS + 1];
46 struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME - 46 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME -
47 SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1]; 47 SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1];
48 unsigned int rmask; 48 unsigned int rmask;
49 unsigned int cmask; 49 unsigned int cmask;
@@ -51,15 +51,17 @@ struct sndrv_pcm_hw_params_old {
51 unsigned int msbits; 51 unsigned int msbits;
52 unsigned int rate_num; 52 unsigned int rate_num;
53 unsigned int rate_den; 53 unsigned int rate_den;
54 sndrv_pcm_uframes_t fifo_size; 54 snd_pcm_uframes_t fifo_size;
55 unsigned char reserved[64]; 55 unsigned char reserved[64];
56}; 56};
57 57
58#define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old) 58#define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct snd_pcm_hw_params_old)
59#define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old) 59#define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct snd_pcm_hw_params_old)
60 60
61static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); 61static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
62static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); 62 struct snd_pcm_hw_params_old __user * _oparams);
63static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
64 struct snd_pcm_hw_params_old __user * _oparams);
63 65
64/* 66/*
65 * 67 *
@@ -83,11 +85,11 @@ static inline void snd_leave_user(mm_segment_t fs)
83 85
84 86
85 87
86int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info) 88int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info)
87{ 89{
88 snd_pcm_runtime_t * runtime; 90 struct snd_pcm_runtime *runtime;
89 snd_pcm_t *pcm = substream->pcm; 91 struct snd_pcm *pcm = substream->pcm;
90 snd_pcm_str_t *pstr = substream->pstr; 92 struct snd_pcm_str *pstr = substream->pstr;
91 93
92 snd_assert(substream != NULL, return -ENXIO); 94 snd_assert(substream != NULL, return -ENXIO);
93 memset(info, 0, sizeof(*info)); 95 memset(info, 0, sizeof(*info));
@@ -111,9 +113,10 @@ int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info)
111 return 0; 113 return 0;
112} 114}
113 115
114int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * _info) 116int snd_pcm_info_user(struct snd_pcm_substream *substream,
117 struct snd_pcm_info __user * _info)
115{ 118{
116 snd_pcm_info_t *info; 119 struct snd_pcm_info *info;
117 int err; 120 int err;
118 121
119 info = kmalloc(sizeof(*info), GFP_KERNEL); 122 info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -151,14 +154,14 @@ char *snd_pcm_hw_param_names[] = {
151}; 154};
152#endif 155#endif
153 156
154int snd_pcm_hw_refine(snd_pcm_substream_t *substream, 157int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
155 snd_pcm_hw_params_t *params) 158 struct snd_pcm_hw_params *params)
156{ 159{
157 unsigned int k; 160 unsigned int k;
158 snd_pcm_hardware_t *hw; 161 struct snd_pcm_hardware *hw;
159 snd_interval_t *i = NULL; 162 struct snd_interval *i = NULL;
160 snd_mask_t *m = NULL; 163 struct snd_mask *m = NULL;
161 snd_pcm_hw_constraints_t *constrs = &substream->runtime->hw_constraints; 164 struct snd_pcm_hw_constraints *constrs = &substream->runtime->hw_constraints;
162 unsigned int rstamps[constrs->rules_num]; 165 unsigned int rstamps[constrs->rules_num];
163 unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1]; 166 unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1];
164 unsigned int stamp = 2; 167 unsigned int stamp = 2;
@@ -231,7 +234,7 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream,
231 do { 234 do {
232 again = 0; 235 again = 0;
233 for (k = 0; k < constrs->rules_num; k++) { 236 for (k = 0; k < constrs->rules_num; k++) {
234 snd_pcm_hw_rule_t *r = &constrs->rules[k]; 237 struct snd_pcm_hw_rule *r = &constrs->rules[k];
235 unsigned int d; 238 unsigned int d;
236 int doit = 0; 239 int doit = 0;
237 if (r->cond && !(r->cond & params->flags)) 240 if (r->cond && !(r->cond & params->flags))
@@ -313,9 +316,10 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream,
313 return 0; 316 return 0;
314} 317}
315 318
316static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) 319static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream,
320 struct snd_pcm_hw_params __user * _params)
317{ 321{
318 snd_pcm_hw_params_t *params; 322 struct snd_pcm_hw_params *params;
319 int err; 323 int err;
320 324
321 params = kmalloc(sizeof(*params), GFP_KERNEL); 325 params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -337,10 +341,10 @@ out:
337 return err; 341 return err;
338} 342}
339 343
340static int snd_pcm_hw_params(snd_pcm_substream_t *substream, 344static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
341 snd_pcm_hw_params_t *params) 345 struct snd_pcm_hw_params *params)
342{ 346{
343 snd_pcm_runtime_t *runtime; 347 struct snd_pcm_runtime *runtime;
344 int err; 348 int err;
345 unsigned int bits; 349 unsigned int bits;
346 snd_pcm_uframes_t frames; 350 snd_pcm_uframes_t frames;
@@ -432,9 +436,10 @@ static int snd_pcm_hw_params(snd_pcm_substream_t *substream,
432 return err; 436 return err;
433} 437}
434 438
435static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) 439static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream,
440 struct snd_pcm_hw_params __user * _params)
436{ 441{
437 snd_pcm_hw_params_t *params; 442 struct snd_pcm_hw_params *params;
438 int err; 443 int err;
439 444
440 params = kmalloc(sizeof(*params), GFP_KERNEL); 445 params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -456,9 +461,9 @@ out:
456 return err; 461 return err;
457} 462}
458 463
459static int snd_pcm_hw_free(snd_pcm_substream_t * substream) 464static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
460{ 465{
461 snd_pcm_runtime_t *runtime; 466 struct snd_pcm_runtime *runtime;
462 int result = 0; 467 int result = 0;
463 468
464 snd_assert(substream != NULL, return -ENXIO); 469 snd_assert(substream != NULL, return -ENXIO);
@@ -482,9 +487,10 @@ static int snd_pcm_hw_free(snd_pcm_substream_t * substream)
482 return result; 487 return result;
483} 488}
484 489
485static int snd_pcm_sw_params(snd_pcm_substream_t * substream, snd_pcm_sw_params_t *params) 490static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
491 struct snd_pcm_sw_params *params)
486{ 492{
487 snd_pcm_runtime_t *runtime; 493 struct snd_pcm_runtime *runtime;
488 494
489 snd_assert(substream != NULL, return -ENXIO); 495 snd_assert(substream != NULL, return -ENXIO);
490 runtime = substream->runtime; 496 runtime = substream->runtime;
@@ -537,9 +543,10 @@ static int snd_pcm_sw_params(snd_pcm_substream_t * substream, snd_pcm_sw_params_
537 return 0; 543 return 0;
538} 544}
539 545
540static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t __user * _params) 546static int snd_pcm_sw_params_user(struct snd_pcm_substream *substream,
547 struct snd_pcm_sw_params __user * _params)
541{ 548{
542 snd_pcm_sw_params_t params; 549 struct snd_pcm_sw_params params;
543 int err; 550 int err;
544 if (copy_from_user(&params, _params, sizeof(params))) 551 if (copy_from_user(&params, _params, sizeof(params)))
545 return -EFAULT; 552 return -EFAULT;
@@ -549,10 +556,10 @@ static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_pa
549 return err; 556 return err;
550} 557}
551 558
552int snd_pcm_status(snd_pcm_substream_t *substream, 559int snd_pcm_status(struct snd_pcm_substream *substream,
553 snd_pcm_status_t *status) 560 struct snd_pcm_status *status)
554{ 561{
555 snd_pcm_runtime_t *runtime = substream->runtime; 562 struct snd_pcm_runtime *runtime = substream->runtime;
556 563
557 snd_pcm_stream_lock_irq(substream); 564 snd_pcm_stream_lock_irq(substream);
558 status->state = runtime->status->state; 565 status->state = runtime->status->state;
@@ -593,10 +600,11 @@ int snd_pcm_status(snd_pcm_substream_t *substream,
593 return 0; 600 return 0;
594} 601}
595 602
596static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t __user * _status) 603static int snd_pcm_status_user(struct snd_pcm_substream *substream,
604 struct snd_pcm_status __user * _status)
597{ 605{
598 snd_pcm_status_t status; 606 struct snd_pcm_status status;
599 snd_pcm_runtime_t *runtime; 607 struct snd_pcm_runtime *runtime;
600 int res; 608 int res;
601 609
602 snd_assert(substream != NULL, return -ENXIO); 610 snd_assert(substream != NULL, return -ENXIO);
@@ -610,9 +618,10 @@ static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t
610 return 0; 618 return 0;
611} 619}
612 620
613static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * info) 621static int snd_pcm_channel_info(struct snd_pcm_substream *substream,
622 struct snd_pcm_channel_info * info)
614{ 623{
615 snd_pcm_runtime_t *runtime; 624 struct snd_pcm_runtime *runtime;
616 unsigned int channel; 625 unsigned int channel;
617 626
618 snd_assert(substream != NULL, return -ENXIO); 627 snd_assert(substream != NULL, return -ENXIO);
@@ -631,9 +640,10 @@ static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel
631 return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info); 640 return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info);
632} 641}
633 642
634static int snd_pcm_channel_info_user(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info) 643static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
644 struct snd_pcm_channel_info __user * _info)
635{ 645{
636 snd_pcm_channel_info_t info; 646 struct snd_pcm_channel_info info;
637 int res; 647 int res;
638 648
639 if (copy_from_user(&info, _info, sizeof(info))) 649 if (copy_from_user(&info, _info, sizeof(info)))
@@ -646,9 +656,9 @@ static int snd_pcm_channel_info_user(snd_pcm_substream_t * substream, snd_pcm_ch
646 return 0; 656 return 0;
647} 657}
648 658
649static void snd_pcm_trigger_tstamp(snd_pcm_substream_t *substream) 659static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream)
650{ 660{
651 snd_pcm_runtime_t *runtime = substream->runtime; 661 struct snd_pcm_runtime *runtime = substream->runtime;
652 if (runtime->trigger_master == NULL) 662 if (runtime->trigger_master == NULL)
653 return; 663 return;
654 if (runtime->trigger_master == substream) { 664 if (runtime->trigger_master == substream) {
@@ -661,10 +671,10 @@ static void snd_pcm_trigger_tstamp(snd_pcm_substream_t *substream)
661} 671}
662 672
663struct action_ops { 673struct action_ops {
664 int (*pre_action)(snd_pcm_substream_t *substream, int state); 674 int (*pre_action)(struct snd_pcm_substream *substream, int state);
665 int (*do_action)(snd_pcm_substream_t *substream, int state); 675 int (*do_action)(struct snd_pcm_substream *substream, int state);
666 void (*undo_action)(snd_pcm_substream_t *substream, int state); 676 void (*undo_action)(struct snd_pcm_substream *substream, int state);
667 void (*post_action)(snd_pcm_substream_t *substream, int state); 677 void (*post_action)(struct snd_pcm_substream *substream, int state);
668}; 678};
669 679
670/* 680/*
@@ -673,12 +683,12 @@ struct action_ops {
673 * Note2: call with calling stream lock + link lock 683 * Note2: call with calling stream lock + link lock
674 */ 684 */
675static int snd_pcm_action_group(struct action_ops *ops, 685static int snd_pcm_action_group(struct action_ops *ops,
676 snd_pcm_substream_t *substream, 686 struct snd_pcm_substream *substream,
677 int state, int do_lock) 687 int state, int do_lock)
678{ 688{
679 struct list_head *pos; 689 struct list_head *pos;
680 snd_pcm_substream_t *s = NULL; 690 struct snd_pcm_substream *s = NULL;
681 snd_pcm_substream_t *s1; 691 struct snd_pcm_substream *s1;
682 int res = 0; 692 int res = 0;
683 693
684 snd_pcm_group_for_each(pos, substream) { 694 snd_pcm_group_for_each(pos, substream) {
@@ -727,7 +737,7 @@ static int snd_pcm_action_group(struct action_ops *ops,
727 * Note: call with stream lock 737 * Note: call with stream lock
728 */ 738 */
729static int snd_pcm_action_single(struct action_ops *ops, 739static int snd_pcm_action_single(struct action_ops *ops,
730 snd_pcm_substream_t *substream, 740 struct snd_pcm_substream *substream,
731 int state) 741 int state)
732{ 742{
733 int res; 743 int res;
@@ -747,7 +757,7 @@ static int snd_pcm_action_single(struct action_ops *ops,
747 * Note: call with stream lock 757 * Note: call with stream lock
748 */ 758 */
749static int snd_pcm_action(struct action_ops *ops, 759static int snd_pcm_action(struct action_ops *ops,
750 snd_pcm_substream_t *substream, 760 struct snd_pcm_substream *substream,
751 int state) 761 int state)
752{ 762{
753 int res; 763 int res;
@@ -770,7 +780,7 @@ static int snd_pcm_action(struct action_ops *ops,
770 * Note: don't use any locks before 780 * Note: don't use any locks before
771 */ 781 */
772static int snd_pcm_action_lock_irq(struct action_ops *ops, 782static int snd_pcm_action_lock_irq(struct action_ops *ops,
773 snd_pcm_substream_t *substream, 783 struct snd_pcm_substream *substream,
774 int state) 784 int state)
775{ 785{
776 int res; 786 int res;
@@ -794,7 +804,7 @@ static int snd_pcm_action_lock_irq(struct action_ops *ops,
794/* 804/*
795 */ 805 */
796static int snd_pcm_action_nonatomic(struct action_ops *ops, 806static int snd_pcm_action_nonatomic(struct action_ops *ops,
797 snd_pcm_substream_t *substream, 807 struct snd_pcm_substream *substream,
798 int state) 808 int state)
799{ 809{
800 int res; 810 int res;
@@ -811,9 +821,9 @@ static int snd_pcm_action_nonatomic(struct action_ops *ops,
811/* 821/*
812 * start callbacks 822 * start callbacks
813 */ 823 */
814static int snd_pcm_pre_start(snd_pcm_substream_t *substream, int state) 824static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state)
815{ 825{
816 snd_pcm_runtime_t *runtime = substream->runtime; 826 struct snd_pcm_runtime *runtime = substream->runtime;
817 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) 827 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED)
818 return -EBADFD; 828 return -EBADFD;
819 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 829 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
@@ -823,22 +833,22 @@ static int snd_pcm_pre_start(snd_pcm_substream_t *substream, int state)
823 return 0; 833 return 0;
824} 834}
825 835
826static int snd_pcm_do_start(snd_pcm_substream_t *substream, int state) 836static int snd_pcm_do_start(struct snd_pcm_substream *substream, int state)
827{ 837{
828 if (substream->runtime->trigger_master != substream) 838 if (substream->runtime->trigger_master != substream)
829 return 0; 839 return 0;
830 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START); 840 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START);
831} 841}
832 842
833static void snd_pcm_undo_start(snd_pcm_substream_t *substream, int state) 843static void snd_pcm_undo_start(struct snd_pcm_substream *substream, int state)
834{ 844{
835 if (substream->runtime->trigger_master == substream) 845 if (substream->runtime->trigger_master == substream)
836 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); 846 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP);
837} 847}
838 848
839static void snd_pcm_post_start(snd_pcm_substream_t *substream, int state) 849static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state)
840{ 850{
841 snd_pcm_runtime_t *runtime = substream->runtime; 851 struct snd_pcm_runtime *runtime = substream->runtime;
842 snd_pcm_trigger_tstamp(substream); 852 snd_pcm_trigger_tstamp(substream);
843 runtime->status->state = state; 853 runtime->status->state = state;
844 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 854 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
@@ -847,7 +857,8 @@ static void snd_pcm_post_start(snd_pcm_substream_t *substream, int state)
847 if (runtime->sleep_min) 857 if (runtime->sleep_min)
848 snd_pcm_tick_prepare(substream); 858 snd_pcm_tick_prepare(substream);
849 if (substream->timer) 859 if (substream->timer)
850 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, &runtime->trigger_tstamp); 860 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART,
861 &runtime->trigger_tstamp);
851} 862}
852 863
853static struct action_ops snd_pcm_action_start = { 864static struct action_ops snd_pcm_action_start = {
@@ -863,24 +874,25 @@ static struct action_ops snd_pcm_action_start = {
863 * 874 *
864 * Start all linked streams. 875 * Start all linked streams.
865 */ 876 */
866int snd_pcm_start(snd_pcm_substream_t *substream) 877int snd_pcm_start(struct snd_pcm_substream *substream)
867{ 878{
868 return snd_pcm_action(&snd_pcm_action_start, substream, SNDRV_PCM_STATE_RUNNING); 879 return snd_pcm_action(&snd_pcm_action_start, substream,
880 SNDRV_PCM_STATE_RUNNING);
869} 881}
870 882
871/* 883/*
872 * stop callbacks 884 * stop callbacks
873 */ 885 */
874static int snd_pcm_pre_stop(snd_pcm_substream_t *substream, int state) 886static int snd_pcm_pre_stop(struct snd_pcm_substream *substream, int state)
875{ 887{
876 snd_pcm_runtime_t *runtime = substream->runtime; 888 struct snd_pcm_runtime *runtime = substream->runtime;
877 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 889 if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
878 return -EBADFD; 890 return -EBADFD;
879 runtime->trigger_master = substream; 891 runtime->trigger_master = substream;
880 return 0; 892 return 0;
881} 893}
882 894
883static int snd_pcm_do_stop(snd_pcm_substream_t *substream, int state) 895static int snd_pcm_do_stop(struct snd_pcm_substream *substream, int state)
884{ 896{
885 if (substream->runtime->trigger_master == substream && 897 if (substream->runtime->trigger_master == substream &&
886 snd_pcm_running(substream)) 898 snd_pcm_running(substream))
@@ -888,13 +900,14 @@ static int snd_pcm_do_stop(snd_pcm_substream_t *substream, int state)
888 return 0; /* unconditonally stop all substreams */ 900 return 0; /* unconditonally stop all substreams */
889} 901}
890 902
891static void snd_pcm_post_stop(snd_pcm_substream_t *substream, int state) 903static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state)
892{ 904{
893 snd_pcm_runtime_t *runtime = substream->runtime; 905 struct snd_pcm_runtime *runtime = substream->runtime;
894 if (runtime->status->state != state) { 906 if (runtime->status->state != state) {
895 snd_pcm_trigger_tstamp(substream); 907 snd_pcm_trigger_tstamp(substream);
896 if (substream->timer) 908 if (substream->timer)
897 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, &runtime->trigger_tstamp); 909 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP,
910 &runtime->trigger_tstamp);
898 runtime->status->state = state; 911 runtime->status->state = state;
899 snd_pcm_tick_set(substream, 0); 912 snd_pcm_tick_set(substream, 0);
900 } 913 }
@@ -915,7 +928,7 @@ static struct action_ops snd_pcm_action_stop = {
915 * Try to stop all running streams in the substream group. 928 * Try to stop all running streams in the substream group.
916 * The state of each stream is changed to the given value after that unconditionally. 929 * The state of each stream is changed to the given value after that unconditionally.
917 */ 930 */
918int snd_pcm_stop(snd_pcm_substream_t *substream, int state) 931int snd_pcm_stop(struct snd_pcm_substream *substream, int state)
919{ 932{
920 return snd_pcm_action(&snd_pcm_action_stop, substream, state); 933 return snd_pcm_action(&snd_pcm_action_stop, substream, state);
921} 934}
@@ -928,17 +941,18 @@ int snd_pcm_stop(snd_pcm_substream_t *substream, int state)
928 * The state is changed to SETUP. 941 * The state is changed to SETUP.
929 * Unlike snd_pcm_stop(), this affects only the given stream. 942 * Unlike snd_pcm_stop(), this affects only the given stream.
930 */ 943 */
931int snd_pcm_drain_done(snd_pcm_substream_t *substream) 944int snd_pcm_drain_done(struct snd_pcm_substream *substream)
932{ 945{
933 return snd_pcm_action_single(&snd_pcm_action_stop, substream, SNDRV_PCM_STATE_SETUP); 946 return snd_pcm_action_single(&snd_pcm_action_stop, substream,
947 SNDRV_PCM_STATE_SETUP);
934} 948}
935 949
936/* 950/*
937 * pause callbacks 951 * pause callbacks
938 */ 952 */
939static int snd_pcm_pre_pause(snd_pcm_substream_t *substream, int push) 953static int snd_pcm_pre_pause(struct snd_pcm_substream *substream, int push)
940{ 954{
941 snd_pcm_runtime_t *runtime = substream->runtime; 955 struct snd_pcm_runtime *runtime = substream->runtime;
942 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) 956 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE))
943 return -ENOSYS; 957 return -ENOSYS;
944 if (push) { 958 if (push) {
@@ -950,7 +964,7 @@ static int snd_pcm_pre_pause(snd_pcm_substream_t *substream, int push)
950 return 0; 964 return 0;
951} 965}
952 966
953static int snd_pcm_do_pause(snd_pcm_substream_t *substream, int push) 967static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push)
954{ 968{
955 if (substream->runtime->trigger_master != substream) 969 if (substream->runtime->trigger_master != substream)
956 return 0; 970 return 0;
@@ -959,7 +973,7 @@ static int snd_pcm_do_pause(snd_pcm_substream_t *substream, int push)
959 SNDRV_PCM_TRIGGER_PAUSE_RELEASE); 973 SNDRV_PCM_TRIGGER_PAUSE_RELEASE);
960} 974}
961 975
962static void snd_pcm_undo_pause(snd_pcm_substream_t *substream, int push) 976static void snd_pcm_undo_pause(struct snd_pcm_substream *substream, int push)
963{ 977{
964 if (substream->runtime->trigger_master == substream) 978 if (substream->runtime->trigger_master == substream)
965 substream->ops->trigger(substream, 979 substream->ops->trigger(substream,
@@ -967,14 +981,16 @@ static void snd_pcm_undo_pause(snd_pcm_substream_t *substream, int push)
967 SNDRV_PCM_TRIGGER_PAUSE_PUSH); 981 SNDRV_PCM_TRIGGER_PAUSE_PUSH);
968} 982}
969 983
970static void snd_pcm_post_pause(snd_pcm_substream_t *substream, int push) 984static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push)
971{ 985{
972 snd_pcm_runtime_t *runtime = substream->runtime; 986 struct snd_pcm_runtime *runtime = substream->runtime;
973 snd_pcm_trigger_tstamp(substream); 987 snd_pcm_trigger_tstamp(substream);
974 if (push) { 988 if (push) {
975 runtime->status->state = SNDRV_PCM_STATE_PAUSED; 989 runtime->status->state = SNDRV_PCM_STATE_PAUSED;
976 if (substream->timer) 990 if (substream->timer)
977 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); 991 snd_timer_notify(substream->timer,
992 SNDRV_TIMER_EVENT_MPAUSE,
993 &runtime->trigger_tstamp);
978 snd_pcm_tick_set(substream, 0); 994 snd_pcm_tick_set(substream, 0);
979 wake_up(&runtime->sleep); 995 wake_up(&runtime->sleep);
980 } else { 996 } else {
@@ -982,7 +998,9 @@ static void snd_pcm_post_pause(snd_pcm_substream_t *substream, int push)
982 if (runtime->sleep_min) 998 if (runtime->sleep_min)
983 snd_pcm_tick_prepare(substream); 999 snd_pcm_tick_prepare(substream);
984 if (substream->timer) 1000 if (substream->timer)
985 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, &runtime->trigger_tstamp); 1001 snd_timer_notify(substream->timer,
1002 SNDRV_TIMER_EVENT_MCONTINUE,
1003 &runtime->trigger_tstamp);
986 } 1004 }
987} 1005}
988 1006
@@ -996,7 +1014,7 @@ static struct action_ops snd_pcm_action_pause = {
996/* 1014/*
997 * Push/release the pause for all linked streams. 1015 * Push/release the pause for all linked streams.
998 */ 1016 */
999static int snd_pcm_pause(snd_pcm_substream_t *substream, int push) 1017static int snd_pcm_pause(struct snd_pcm_substream *substream, int push)
1000{ 1018{
1001 return snd_pcm_action(&snd_pcm_action_pause, substream, push); 1019 return snd_pcm_action(&snd_pcm_action_pause, substream, push);
1002} 1020}
@@ -1004,18 +1022,18 @@ static int snd_pcm_pause(snd_pcm_substream_t *substream, int push)
1004#ifdef CONFIG_PM 1022#ifdef CONFIG_PM
1005/* suspend */ 1023/* suspend */
1006 1024
1007static int snd_pcm_pre_suspend(snd_pcm_substream_t *substream, int state) 1025static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state)
1008{ 1026{
1009 snd_pcm_runtime_t *runtime = substream->runtime; 1027 struct snd_pcm_runtime *runtime = substream->runtime;
1010 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) 1028 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
1011 return -EBUSY; 1029 return -EBUSY;
1012 runtime->trigger_master = substream; 1030 runtime->trigger_master = substream;
1013 return 0; 1031 return 0;
1014} 1032}
1015 1033
1016static int snd_pcm_do_suspend(snd_pcm_substream_t *substream, int state) 1034static int snd_pcm_do_suspend(struct snd_pcm_substream *substream, int state)
1017{ 1035{
1018 snd_pcm_runtime_t *runtime = substream->runtime; 1036 struct snd_pcm_runtime *runtime = substream->runtime;
1019 if (runtime->trigger_master != substream) 1037 if (runtime->trigger_master != substream)
1020 return 0; 1038 return 0;
1021 if (! snd_pcm_running(substream)) 1039 if (! snd_pcm_running(substream))
@@ -1024,12 +1042,13 @@ static int snd_pcm_do_suspend(snd_pcm_substream_t *substream, int state)
1024 return 0; /* suspend unconditionally */ 1042 return 0; /* suspend unconditionally */
1025} 1043}
1026 1044
1027static void snd_pcm_post_suspend(snd_pcm_substream_t *substream, int state) 1045static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state)
1028{ 1046{
1029 snd_pcm_runtime_t *runtime = substream->runtime; 1047 struct snd_pcm_runtime *runtime = substream->runtime;
1030 snd_pcm_trigger_tstamp(substream); 1048 snd_pcm_trigger_tstamp(substream);
1031 if (substream->timer) 1049 if (substream->timer)
1032 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, &runtime->trigger_tstamp); 1050 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND,
1051 &runtime->trigger_tstamp);
1033 runtime->status->suspended_state = runtime->status->state; 1052 runtime->status->suspended_state = runtime->status->state;
1034 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; 1053 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED;
1035 snd_pcm_tick_set(substream, 0); 1054 snd_pcm_tick_set(substream, 0);
@@ -1049,7 +1068,7 @@ static struct action_ops snd_pcm_action_suspend = {
1049 * Trigger SUSPEND to all linked streams. 1068 * Trigger SUSPEND to all linked streams.
1050 * After this call, all streams are changed to SUSPENDED state. 1069 * After this call, all streams are changed to SUSPENDED state.
1051 */ 1070 */
1052int snd_pcm_suspend(snd_pcm_substream_t *substream) 1071int snd_pcm_suspend(struct snd_pcm_substream *substream)
1053{ 1072{
1054 int err; 1073 int err;
1055 unsigned long flags; 1074 unsigned long flags;
@@ -1067,13 +1086,14 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream)
1067 * Trigger SUSPEND to all substreams in the given pcm. 1086 * Trigger SUSPEND to all substreams in the given pcm.
1068 * After this call, all streams are changed to SUSPENDED state. 1087 * After this call, all streams are changed to SUSPENDED state.
1069 */ 1088 */
1070int snd_pcm_suspend_all(snd_pcm_t *pcm) 1089int snd_pcm_suspend_all(struct snd_pcm *pcm)
1071{ 1090{
1072 snd_pcm_substream_t *substream; 1091 struct snd_pcm_substream *substream;
1073 int stream, err = 0; 1092 int stream, err = 0;
1074 1093
1075 for (stream = 0; stream < 2; stream++) { 1094 for (stream = 0; stream < 2; stream++) {
1076 for (substream = pcm->streams[stream].substream; substream; substream = substream->next) { 1095 for (substream = pcm->streams[stream].substream;
1096 substream; substream = substream->next) {
1077 /* FIXME: the open/close code should lock this as well */ 1097 /* FIXME: the open/close code should lock this as well */
1078 if (substream->runtime == NULL) 1098 if (substream->runtime == NULL)
1079 continue; 1099 continue;
@@ -1087,18 +1107,18 @@ int snd_pcm_suspend_all(snd_pcm_t *pcm)
1087 1107
1088/* resume */ 1108/* resume */
1089 1109
1090static int snd_pcm_pre_resume(snd_pcm_substream_t *substream, int state) 1110static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, int state)
1091{ 1111{
1092 snd_pcm_runtime_t *runtime = substream->runtime; 1112 struct snd_pcm_runtime *runtime = substream->runtime;
1093 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) 1113 if (!(runtime->info & SNDRV_PCM_INFO_RESUME))
1094 return -ENOSYS; 1114 return -ENOSYS;
1095 runtime->trigger_master = substream; 1115 runtime->trigger_master = substream;
1096 return 0; 1116 return 0;
1097} 1117}
1098 1118
1099static int snd_pcm_do_resume(snd_pcm_substream_t *substream, int state) 1119static int snd_pcm_do_resume(struct snd_pcm_substream *substream, int state)
1100{ 1120{
1101 snd_pcm_runtime_t *runtime = substream->runtime; 1121 struct snd_pcm_runtime *runtime = substream->runtime;
1102 if (runtime->trigger_master != substream) 1122 if (runtime->trigger_master != substream)
1103 return 0; 1123 return 0;
1104 /* DMA not running previously? */ 1124 /* DMA not running previously? */
@@ -1109,19 +1129,20 @@ static int snd_pcm_do_resume(snd_pcm_substream_t *substream, int state)
1109 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME); 1129 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME);
1110} 1130}
1111 1131
1112static void snd_pcm_undo_resume(snd_pcm_substream_t *substream, int state) 1132static void snd_pcm_undo_resume(struct snd_pcm_substream *substream, int state)
1113{ 1133{
1114 if (substream->runtime->trigger_master == substream && 1134 if (substream->runtime->trigger_master == substream &&
1115 snd_pcm_running(substream)) 1135 snd_pcm_running(substream))
1116 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); 1136 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND);
1117} 1137}
1118 1138
1119static void snd_pcm_post_resume(snd_pcm_substream_t *substream, int state) 1139static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state)
1120{ 1140{
1121 snd_pcm_runtime_t *runtime = substream->runtime; 1141 struct snd_pcm_runtime *runtime = substream->runtime;
1122 snd_pcm_trigger_tstamp(substream); 1142 snd_pcm_trigger_tstamp(substream);
1123 if (substream->timer) 1143 if (substream->timer)
1124 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); 1144 snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME,
1145 &runtime->trigger_tstamp);
1125 runtime->status->state = runtime->status->suspended_state; 1146 runtime->status->state = runtime->status->suspended_state;
1126 if (runtime->sleep_min) 1147 if (runtime->sleep_min)
1127 snd_pcm_tick_prepare(substream); 1148 snd_pcm_tick_prepare(substream);
@@ -1134,9 +1155,9 @@ static struct action_ops snd_pcm_action_resume = {
1134 .post_action = snd_pcm_post_resume 1155 .post_action = snd_pcm_post_resume
1135}; 1156};
1136 1157
1137static int snd_pcm_resume(snd_pcm_substream_t *substream) 1158static int snd_pcm_resume(struct snd_pcm_substream *substream)
1138{ 1159{
1139 snd_card_t *card = substream->pcm->card; 1160 struct snd_card *card = substream->pcm->card;
1140 int res; 1161 int res;
1141 1162
1142 snd_power_lock(card); 1163 snd_power_lock(card);
@@ -1148,7 +1169,7 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream)
1148 1169
1149#else 1170#else
1150 1171
1151static int snd_pcm_resume(snd_pcm_substream_t *substream) 1172static int snd_pcm_resume(struct snd_pcm_substream *substream)
1152{ 1173{
1153 return -ENOSYS; 1174 return -ENOSYS;
1154} 1175}
@@ -1160,10 +1181,10 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream)
1160 * 1181 *
1161 * Change the RUNNING stream(s) to XRUN state. 1182 * Change the RUNNING stream(s) to XRUN state.
1162 */ 1183 */
1163static int snd_pcm_xrun(snd_pcm_substream_t *substream) 1184static int snd_pcm_xrun(struct snd_pcm_substream *substream)
1164{ 1185{
1165 snd_card_t *card = substream->pcm->card; 1186 struct snd_card *card = substream->pcm->card;
1166 snd_pcm_runtime_t *runtime = substream->runtime; 1187 struct snd_pcm_runtime *runtime = substream->runtime;
1167 int result; 1188 int result;
1168 1189
1169 snd_power_lock(card); 1190 snd_power_lock(card);
@@ -1193,9 +1214,9 @@ static int snd_pcm_xrun(snd_pcm_substream_t *substream)
1193/* 1214/*
1194 * reset ioctl 1215 * reset ioctl
1195 */ 1216 */
1196static int snd_pcm_pre_reset(snd_pcm_substream_t * substream, int state) 1217static int snd_pcm_pre_reset(struct snd_pcm_substream *substream, int state)
1197{ 1218{
1198 snd_pcm_runtime_t *runtime = substream->runtime; 1219 struct snd_pcm_runtime *runtime = substream->runtime;
1199 switch (runtime->status->state) { 1220 switch (runtime->status->state) {
1200 case SNDRV_PCM_STATE_RUNNING: 1221 case SNDRV_PCM_STATE_RUNNING:
1201 case SNDRV_PCM_STATE_PREPARED: 1222 case SNDRV_PCM_STATE_PREPARED:
@@ -1207,23 +1228,24 @@ static int snd_pcm_pre_reset(snd_pcm_substream_t * substream, int state)
1207 } 1228 }
1208} 1229}
1209 1230
1210static int snd_pcm_do_reset(snd_pcm_substream_t * substream, int state) 1231static int snd_pcm_do_reset(struct snd_pcm_substream *substream, int state)
1211{ 1232{
1212 snd_pcm_runtime_t *runtime = substream->runtime; 1233 struct snd_pcm_runtime *runtime = substream->runtime;
1213 int err = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL); 1234 int err = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL);
1214 if (err < 0) 1235 if (err < 0)
1215 return err; 1236 return err;
1216 // snd_assert(runtime->status->hw_ptr < runtime->buffer_size, ); 1237 // snd_assert(runtime->status->hw_ptr < runtime->buffer_size, );
1217 runtime->hw_ptr_base = 0; 1238 runtime->hw_ptr_base = 0;
1218 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - runtime->status->hw_ptr % runtime->period_size; 1239 runtime->hw_ptr_interrupt = runtime->status->hw_ptr -
1240 runtime->status->hw_ptr % runtime->period_size;
1219 runtime->silence_start = runtime->status->hw_ptr; 1241 runtime->silence_start = runtime->status->hw_ptr;
1220 runtime->silence_filled = 0; 1242 runtime->silence_filled = 0;
1221 return 0; 1243 return 0;
1222} 1244}
1223 1245
1224static void snd_pcm_post_reset(snd_pcm_substream_t * substream, int state) 1246static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state)
1225{ 1247{
1226 snd_pcm_runtime_t *runtime = substream->runtime; 1248 struct snd_pcm_runtime *runtime = substream->runtime;
1227 runtime->control->appl_ptr = runtime->status->hw_ptr; 1249 runtime->control->appl_ptr = runtime->status->hw_ptr;
1228 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 1250 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
1229 runtime->silence_size > 0) 1251 runtime->silence_size > 0)
@@ -1236,7 +1258,7 @@ static struct action_ops snd_pcm_action_reset = {
1236 .post_action = snd_pcm_post_reset 1258 .post_action = snd_pcm_post_reset
1237}; 1259};
1238 1260
1239static int snd_pcm_reset(snd_pcm_substream_t *substream) 1261static int snd_pcm_reset(struct snd_pcm_substream *substream)
1240{ 1262{
1241 return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0); 1263 return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0);
1242} 1264}
@@ -1244,9 +1266,9 @@ static int snd_pcm_reset(snd_pcm_substream_t *substream)
1244/* 1266/*
1245 * prepare ioctl 1267 * prepare ioctl
1246 */ 1268 */
1247static int snd_pcm_pre_prepare(snd_pcm_substream_t * substream, int state) 1269static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, int state)
1248{ 1270{
1249 snd_pcm_runtime_t *runtime = substream->runtime; 1271 struct snd_pcm_runtime *runtime = substream->runtime;
1250 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 1272 if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
1251 return -EBADFD; 1273 return -EBADFD;
1252 if (snd_pcm_running(substream)) 1274 if (snd_pcm_running(substream))
@@ -1254,7 +1276,7 @@ static int snd_pcm_pre_prepare(snd_pcm_substream_t * substream, int state)
1254 return 0; 1276 return 0;
1255} 1277}
1256 1278
1257static int snd_pcm_do_prepare(snd_pcm_substream_t * substream, int state) 1279static int snd_pcm_do_prepare(struct snd_pcm_substream *substream, int state)
1258{ 1280{
1259 int err; 1281 int err;
1260 err = substream->ops->prepare(substream); 1282 err = substream->ops->prepare(substream);
@@ -1263,9 +1285,9 @@ static int snd_pcm_do_prepare(snd_pcm_substream_t * substream, int state)
1263 return snd_pcm_do_reset(substream, 0); 1285 return snd_pcm_do_reset(substream, 0);
1264} 1286}
1265 1287
1266static void snd_pcm_post_prepare(snd_pcm_substream_t * substream, int state) 1288static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state)
1267{ 1289{
1268 snd_pcm_runtime_t *runtime = substream->runtime; 1290 struct snd_pcm_runtime *runtime = substream->runtime;
1269 runtime->control->appl_ptr = runtime->status->hw_ptr; 1291 runtime->control->appl_ptr = runtime->status->hw_ptr;
1270 runtime->status->state = SNDRV_PCM_STATE_PREPARED; 1292 runtime->status->state = SNDRV_PCM_STATE_PREPARED;
1271} 1293}
@@ -1282,10 +1304,10 @@ static struct action_ops snd_pcm_action_prepare = {
1282 * 1304 *
1283 * Prepare the PCM substream to be triggerable. 1305 * Prepare the PCM substream to be triggerable.
1284 */ 1306 */
1285int snd_pcm_prepare(snd_pcm_substream_t *substream) 1307int snd_pcm_prepare(struct snd_pcm_substream *substream)
1286{ 1308{
1287 int res; 1309 int res;
1288 snd_card_t *card = substream->pcm->card; 1310 struct snd_card *card = substream->pcm->card;
1289 1311
1290 snd_power_lock(card); 1312 snd_power_lock(card);
1291 if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0) 1313 if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0)
@@ -1298,7 +1320,7 @@ int snd_pcm_prepare(snd_pcm_substream_t *substream)
1298 * drain ioctl 1320 * drain ioctl
1299 */ 1321 */
1300 1322
1301static int snd_pcm_pre_drain_init(snd_pcm_substream_t * substream, int state) 1323static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, int state)
1302{ 1324{
1303 if (substream->ffile->f_flags & O_NONBLOCK) 1325 if (substream->ffile->f_flags & O_NONBLOCK)
1304 return -EAGAIN; 1326 return -EAGAIN;
@@ -1306,9 +1328,9 @@ static int snd_pcm_pre_drain_init(snd_pcm_substream_t * substream, int state)
1306 return 0; 1328 return 0;
1307} 1329}
1308 1330
1309static int snd_pcm_do_drain_init(snd_pcm_substream_t * substream, int state) 1331static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
1310{ 1332{
1311 snd_pcm_runtime_t *runtime = substream->runtime; 1333 struct snd_pcm_runtime *runtime = substream->runtime;
1312 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 1334 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1313 switch (runtime->status->state) { 1335 switch (runtime->status->state) {
1314 case SNDRV_PCM_STATE_PREPARED: 1336 case SNDRV_PCM_STATE_PREPARED:
@@ -1336,7 +1358,7 @@ static int snd_pcm_do_drain_init(snd_pcm_substream_t * substream, int state)
1336 return 0; 1358 return 0;
1337} 1359}
1338 1360
1339static void snd_pcm_post_drain_init(snd_pcm_substream_t * substream, int state) 1361static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int state)
1340{ 1362{
1341} 1363}
1342 1364
@@ -1347,12 +1369,12 @@ static struct action_ops snd_pcm_action_drain_init = {
1347}; 1369};
1348 1370
1349struct drain_rec { 1371struct drain_rec {
1350 snd_pcm_substream_t *substream; 1372 struct snd_pcm_substream *substream;
1351 wait_queue_t wait; 1373 wait_queue_t wait;
1352 snd_pcm_uframes_t stop_threshold; 1374 snd_pcm_uframes_t stop_threshold;
1353}; 1375};
1354 1376
1355static int snd_pcm_drop(snd_pcm_substream_t *substream); 1377static int snd_pcm_drop(struct snd_pcm_substream *substream);
1356 1378
1357/* 1379/*
1358 * Drain the stream(s). 1380 * Drain the stream(s).
@@ -1361,10 +1383,10 @@ static int snd_pcm_drop(snd_pcm_substream_t *substream);
1361 * After this call, all streams are supposed to be either SETUP or DRAINING 1383 * After this call, all streams are supposed to be either SETUP or DRAINING
1362 * (capture only) state. 1384 * (capture only) state.
1363 */ 1385 */
1364static int snd_pcm_drain(snd_pcm_substream_t *substream) 1386static int snd_pcm_drain(struct snd_pcm_substream *substream)
1365{ 1387{
1366 snd_card_t *card; 1388 struct snd_card *card;
1367 snd_pcm_runtime_t *runtime; 1389 struct snd_pcm_runtime *runtime;
1368 struct list_head *pos; 1390 struct list_head *pos;
1369 int result = 0; 1391 int result = 0;
1370 int i, num_drecs; 1392 int i, num_drecs;
@@ -1401,7 +1423,7 @@ static int snd_pcm_drain(snd_pcm_substream_t *substream)
1401 /* count only playback streams */ 1423 /* count only playback streams */
1402 num_drecs = 0; 1424 num_drecs = 0;
1403 snd_pcm_group_for_each(pos, substream) { 1425 snd_pcm_group_for_each(pos, substream) {
1404 snd_pcm_substream_t *s = snd_pcm_group_substream_entry(pos); 1426 struct snd_pcm_substream *s = snd_pcm_group_substream_entry(pos);
1405 runtime = s->runtime; 1427 runtime = s->runtime;
1406 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { 1428 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1407 d = &drec[num_drecs++]; 1429 d = &drec[num_drecs++];
@@ -1487,10 +1509,10 @@ static int snd_pcm_drain(snd_pcm_substream_t *substream)
1487 * 1509 *
1488 * Immediately put all linked substreams into SETUP state. 1510 * Immediately put all linked substreams into SETUP state.
1489 */ 1511 */
1490static int snd_pcm_drop(snd_pcm_substream_t *substream) 1512static int snd_pcm_drop(struct snd_pcm_substream *substream)
1491{ 1513{
1492 snd_pcm_runtime_t *runtime; 1514 struct snd_pcm_runtime *runtime;
1493 snd_card_t *card; 1515 struct snd_card *card;
1494 int result = 0; 1516 int result = 0;
1495 1517
1496 snd_assert(substream != NULL, return -ENXIO); 1518 snd_assert(substream != NULL, return -ENXIO);
@@ -1548,12 +1570,12 @@ static struct file *snd_pcm_file_fd(int fd)
1548/* 1570/*
1549 * PCM link handling 1571 * PCM link handling
1550 */ 1572 */
1551static int snd_pcm_link(snd_pcm_substream_t *substream, int fd) 1573static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
1552{ 1574{
1553 int res = 0; 1575 int res = 0;
1554 struct file *file; 1576 struct file *file;
1555 snd_pcm_file_t *pcm_file; 1577 struct snd_pcm_file *pcm_file;
1556 snd_pcm_substream_t *substream1; 1578 struct snd_pcm_substream *substream1;
1557 1579
1558 file = snd_pcm_file_fd(fd); 1580 file = snd_pcm_file_fd(fd);
1559 if (!file) 1581 if (!file)
@@ -1572,7 +1594,7 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd)
1572 goto _end; 1594 goto _end;
1573 } 1595 }
1574 if (!snd_pcm_stream_linked(substream)) { 1596 if (!snd_pcm_stream_linked(substream)) {
1575 substream->group = kmalloc(sizeof(snd_pcm_group_t), GFP_ATOMIC); 1597 substream->group = kmalloc(sizeof(struct snd_pcm_group), GFP_ATOMIC);
1576 if (substream->group == NULL) { 1598 if (substream->group == NULL) {
1577 res = -ENOMEM; 1599 res = -ENOMEM;
1578 goto _end; 1600 goto _end;
@@ -1592,14 +1614,14 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd)
1592 return res; 1614 return res;
1593} 1615}
1594 1616
1595static void relink_to_local(snd_pcm_substream_t *substream) 1617static void relink_to_local(struct snd_pcm_substream *substream)
1596{ 1618{
1597 substream->group = &substream->self_group; 1619 substream->group = &substream->self_group;
1598 INIT_LIST_HEAD(&substream->self_group.substreams); 1620 INIT_LIST_HEAD(&substream->self_group.substreams);
1599 list_add_tail(&substream->link_list, &substream->self_group.substreams); 1621 list_add_tail(&substream->link_list, &substream->self_group.substreams);
1600} 1622}
1601 1623
1602static int snd_pcm_unlink(snd_pcm_substream_t *substream) 1624static int snd_pcm_unlink(struct snd_pcm_substream *substream)
1603{ 1625{
1604 struct list_head *pos; 1626 struct list_head *pos;
1605 int res = 0; 1627 int res = 0;
@@ -1629,51 +1651,51 @@ static int snd_pcm_unlink(snd_pcm_substream_t *substream)
1629/* 1651/*
1630 * hw configurator 1652 * hw configurator
1631 */ 1653 */
1632static int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params, 1654static int snd_pcm_hw_rule_mul(struct snd_pcm_hw_params *params,
1633 snd_pcm_hw_rule_t *rule) 1655 struct snd_pcm_hw_rule *rule)
1634{ 1656{
1635 snd_interval_t t; 1657 struct snd_interval t;
1636 snd_interval_mul(hw_param_interval_c(params, rule->deps[0]), 1658 snd_interval_mul(hw_param_interval_c(params, rule->deps[0]),
1637 hw_param_interval_c(params, rule->deps[1]), &t); 1659 hw_param_interval_c(params, rule->deps[1]), &t);
1638 return snd_interval_refine(hw_param_interval(params, rule->var), &t); 1660 return snd_interval_refine(hw_param_interval(params, rule->var), &t);
1639} 1661}
1640 1662
1641static int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params, 1663static int snd_pcm_hw_rule_div(struct snd_pcm_hw_params *params,
1642 snd_pcm_hw_rule_t *rule) 1664 struct snd_pcm_hw_rule *rule)
1643{ 1665{
1644 snd_interval_t t; 1666 struct snd_interval t;
1645 snd_interval_div(hw_param_interval_c(params, rule->deps[0]), 1667 snd_interval_div(hw_param_interval_c(params, rule->deps[0]),
1646 hw_param_interval_c(params, rule->deps[1]), &t); 1668 hw_param_interval_c(params, rule->deps[1]), &t);
1647 return snd_interval_refine(hw_param_interval(params, rule->var), &t); 1669 return snd_interval_refine(hw_param_interval(params, rule->var), &t);
1648} 1670}
1649 1671
1650static int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params, 1672static int snd_pcm_hw_rule_muldivk(struct snd_pcm_hw_params *params,
1651 snd_pcm_hw_rule_t *rule) 1673 struct snd_pcm_hw_rule *rule)
1652{ 1674{
1653 snd_interval_t t; 1675 struct snd_interval t;
1654 snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]), 1676 snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]),
1655 hw_param_interval_c(params, rule->deps[1]), 1677 hw_param_interval_c(params, rule->deps[1]),
1656 (unsigned long) rule->private, &t); 1678 (unsigned long) rule->private, &t);
1657 return snd_interval_refine(hw_param_interval(params, rule->var), &t); 1679 return snd_interval_refine(hw_param_interval(params, rule->var), &t);
1658} 1680}
1659 1681
1660static int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params, 1682static int snd_pcm_hw_rule_mulkdiv(struct snd_pcm_hw_params *params,
1661 snd_pcm_hw_rule_t *rule) 1683 struct snd_pcm_hw_rule *rule)
1662{ 1684{
1663 snd_interval_t t; 1685 struct snd_interval t;
1664 snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]), 1686 snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]),
1665 (unsigned long) rule->private, 1687 (unsigned long) rule->private,
1666 hw_param_interval_c(params, rule->deps[1]), &t); 1688 hw_param_interval_c(params, rule->deps[1]), &t);
1667 return snd_interval_refine(hw_param_interval(params, rule->var), &t); 1689 return snd_interval_refine(hw_param_interval(params, rule->var), &t);
1668} 1690}
1669 1691
1670static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params, 1692static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params,
1671 snd_pcm_hw_rule_t *rule) 1693 struct snd_pcm_hw_rule *rule)
1672{ 1694{
1673 unsigned int k; 1695 unsigned int k;
1674 snd_interval_t *i = hw_param_interval(params, rule->deps[0]); 1696 struct snd_interval *i = hw_param_interval(params, rule->deps[0]);
1675 snd_mask_t m; 1697 struct snd_mask m;
1676 snd_mask_t *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1698 struct snd_mask *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
1677 snd_mask_any(&m); 1699 snd_mask_any(&m);
1678 for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) { 1700 for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
1679 int bits; 1701 int bits;
@@ -1688,10 +1710,10 @@ static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
1688 return snd_mask_refine(mask, &m); 1710 return snd_mask_refine(mask, &m);
1689} 1711}
1690 1712
1691static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params, 1713static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
1692 snd_pcm_hw_rule_t *rule) 1714 struct snd_pcm_hw_rule *rule)
1693{ 1715{
1694 snd_interval_t t; 1716 struct snd_interval t;
1695 unsigned int k; 1717 unsigned int k;
1696 t.min = UINT_MAX; 1718 t.min = UINT_MAX;
1697 t.max = 0; 1719 t.max = 0;
@@ -1720,19 +1742,19 @@ static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params,
1720static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 1742static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100,
1721 48000, 64000, 88200, 96000, 176400, 192000 }; 1743 48000, 64000, 88200, 96000, 176400, 192000 };
1722 1744
1723static int snd_pcm_hw_rule_rate(snd_pcm_hw_params_t *params, 1745static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params,
1724 snd_pcm_hw_rule_t *rule) 1746 struct snd_pcm_hw_rule *rule)
1725{ 1747{
1726 snd_pcm_hardware_t *hw = rule->private; 1748 struct snd_pcm_hardware *hw = rule->private;
1727 return snd_interval_list(hw_param_interval(params, rule->var), 1749 return snd_interval_list(hw_param_interval(params, rule->var),
1728 ARRAY_SIZE(rates), rates, hw->rates); 1750 ARRAY_SIZE(rates), rates, hw->rates);
1729} 1751}
1730 1752
1731static int snd_pcm_hw_rule_buffer_bytes_max(snd_pcm_hw_params_t *params, 1753static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
1732 snd_pcm_hw_rule_t *rule) 1754 struct snd_pcm_hw_rule *rule)
1733{ 1755{
1734 snd_interval_t t; 1756 struct snd_interval t;
1735 snd_pcm_substream_t *substream = rule->private; 1757 struct snd_pcm_substream *substream = rule->private;
1736 t.min = 0; 1758 t.min = 0;
1737 t.max = substream->buffer_bytes_max; 1759 t.max = substream->buffer_bytes_max;
1738 t.openmin = 0; 1760 t.openmin = 0;
@@ -1741,10 +1763,10 @@ static int snd_pcm_hw_rule_buffer_bytes_max(snd_pcm_hw_params_t *params,
1741 return snd_interval_refine(hw_param_interval(params, rule->var), &t); 1763 return snd_interval_refine(hw_param_interval(params, rule->var), &t);
1742} 1764}
1743 1765
1744int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream) 1766int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
1745{ 1767{
1746 snd_pcm_runtime_t *runtime = substream->runtime; 1768 struct snd_pcm_runtime *runtime = substream->runtime;
1747 snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; 1769 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
1748 int k, err; 1770 int k, err;
1749 1771
1750 for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) { 1772 for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) {
@@ -1865,10 +1887,10 @@ int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream)
1865 return 0; 1887 return 0;
1866} 1888}
1867 1889
1868int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream) 1890int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1869{ 1891{
1870 snd_pcm_runtime_t *runtime = substream->runtime; 1892 struct snd_pcm_runtime *runtime = substream->runtime;
1871 snd_pcm_hardware_t *hw = &runtime->hw; 1893 struct snd_pcm_hardware *hw = &runtime->hw;
1872 int err; 1894 int err;
1873 unsigned int mask = 0; 1895 unsigned int mask = 0;
1874 1896
@@ -1941,17 +1963,17 @@ int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream)
1941 return 0; 1963 return 0;
1942} 1964}
1943 1965
1944static void snd_pcm_add_file(snd_pcm_str_t *str, 1966static void snd_pcm_add_file(struct snd_pcm_str *str,
1945 snd_pcm_file_t *pcm_file) 1967 struct snd_pcm_file *pcm_file)
1946{ 1968{
1947 pcm_file->next = str->files; 1969 pcm_file->next = str->files;
1948 str->files = pcm_file; 1970 str->files = pcm_file;
1949} 1971}
1950 1972
1951static void snd_pcm_remove_file(snd_pcm_str_t *str, 1973static void snd_pcm_remove_file(struct snd_pcm_str *str,
1952 snd_pcm_file_t *pcm_file) 1974 struct snd_pcm_file *pcm_file)
1953{ 1975{
1954 snd_pcm_file_t * pcm_file1; 1976 struct snd_pcm_file * pcm_file1;
1955 if (str->files == pcm_file) { 1977 if (str->files == pcm_file) {
1956 str->files = pcm_file->next; 1978 str->files = pcm_file->next;
1957 } else { 1979 } else {
@@ -1963,11 +1985,11 @@ static void snd_pcm_remove_file(snd_pcm_str_t *str,
1963 } 1985 }
1964} 1986}
1965 1987
1966static int snd_pcm_release_file(snd_pcm_file_t * pcm_file) 1988static int snd_pcm_release_file(struct snd_pcm_file * pcm_file)
1967{ 1989{
1968 snd_pcm_substream_t *substream; 1990 struct snd_pcm_substream *substream;
1969 snd_pcm_runtime_t *runtime; 1991 struct snd_pcm_runtime *runtime;
1970 snd_pcm_str_t * str; 1992 struct snd_pcm_str * str;
1971 1993
1972 snd_assert(pcm_file != NULL, return -ENXIO); 1994 snd_assert(pcm_file != NULL, return -ENXIO);
1973 substream = pcm_file->substream; 1995 substream = pcm_file->substream;
@@ -1988,14 +2010,14 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file)
1988} 2010}
1989 2011
1990static int snd_pcm_open_file(struct file *file, 2012static int snd_pcm_open_file(struct file *file,
1991 snd_pcm_t *pcm, 2013 struct snd_pcm *pcm,
1992 int stream, 2014 int stream,
1993 snd_pcm_file_t **rpcm_file) 2015 struct snd_pcm_file **rpcm_file)
1994{ 2016{
1995 int err = 0; 2017 int err = 0;
1996 snd_pcm_file_t *pcm_file; 2018 struct snd_pcm_file *pcm_file;
1997 snd_pcm_substream_t *substream; 2019 struct snd_pcm_substream *substream;
1998 snd_pcm_str_t *str; 2020 struct snd_pcm_str *str;
1999 2021
2000 snd_assert(rpcm_file != NULL, return -EINVAL); 2022 snd_assert(rpcm_file != NULL, return -EINVAL);
2001 *rpcm_file = NULL; 2023 *rpcm_file = NULL;
@@ -2048,8 +2070,8 @@ static int snd_pcm_open(struct inode *inode, struct file *file)
2048 int cardnum = SNDRV_MINOR_CARD(iminor(inode)); 2070 int cardnum = SNDRV_MINOR_CARD(iminor(inode));
2049 int device = SNDRV_MINOR_DEVICE(iminor(inode)); 2071 int device = SNDRV_MINOR_DEVICE(iminor(inode));
2050 int err; 2072 int err;
2051 snd_pcm_t *pcm; 2073 struct snd_pcm *pcm;
2052 snd_pcm_file_t *pcm_file; 2074 struct snd_pcm_file *pcm_file;
2053 wait_queue_t wait; 2075 wait_queue_t wait;
2054 2076
2055 if (device < SNDRV_MINOR_PCM_PLAYBACK || device >= SNDRV_MINOR_DEVICES) 2077 if (device < SNDRV_MINOR_PCM_PLAYBACK || device >= SNDRV_MINOR_DEVICES)
@@ -2105,9 +2127,9 @@ static int snd_pcm_open(struct inode *inode, struct file *file)
2105 2127
2106static int snd_pcm_release(struct inode *inode, struct file *file) 2128static int snd_pcm_release(struct inode *inode, struct file *file)
2107{ 2129{
2108 snd_pcm_t *pcm; 2130 struct snd_pcm *pcm;
2109 snd_pcm_substream_t *substream; 2131 struct snd_pcm_substream *substream;
2110 snd_pcm_file_t *pcm_file; 2132 struct snd_pcm_file *pcm_file;
2111 2133
2112 pcm_file = file->private_data; 2134 pcm_file = file->private_data;
2113 substream = pcm_file->substream; 2135 substream = pcm_file->substream;
@@ -2125,9 +2147,10 @@ static int snd_pcm_release(struct inode *inode, struct file *file)
2125 return 0; 2147 return 0;
2126} 2148}
2127 2149
2128static snd_pcm_sframes_t snd_pcm_playback_rewind(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) 2150static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *substream,
2151 snd_pcm_uframes_t frames)
2129{ 2152{
2130 snd_pcm_runtime_t *runtime = substream->runtime; 2153 struct snd_pcm_runtime *runtime = substream->runtime;
2131 snd_pcm_sframes_t appl_ptr; 2154 snd_pcm_sframes_t appl_ptr;
2132 snd_pcm_sframes_t ret; 2155 snd_pcm_sframes_t ret;
2133 snd_pcm_sframes_t hw_avail; 2156 snd_pcm_sframes_t hw_avail;
@@ -2174,9 +2197,10 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(snd_pcm_substream_t *substream,
2174 return ret; 2197 return ret;
2175} 2198}
2176 2199
2177static snd_pcm_sframes_t snd_pcm_capture_rewind(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) 2200static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substream,
2201 snd_pcm_uframes_t frames)
2178{ 2202{
2179 snd_pcm_runtime_t *runtime = substream->runtime; 2203 struct snd_pcm_runtime *runtime = substream->runtime;
2180 snd_pcm_sframes_t appl_ptr; 2204 snd_pcm_sframes_t appl_ptr;
2181 snd_pcm_sframes_t ret; 2205 snd_pcm_sframes_t ret;
2182 snd_pcm_sframes_t hw_avail; 2206 snd_pcm_sframes_t hw_avail;
@@ -2223,9 +2247,10 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(snd_pcm_substream_t *substream,
2223 return ret; 2247 return ret;
2224} 2248}
2225 2249
2226static snd_pcm_sframes_t snd_pcm_playback_forward(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) 2250static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *substream,
2251 snd_pcm_uframes_t frames)
2227{ 2252{
2228 snd_pcm_runtime_t *runtime = substream->runtime; 2253 struct snd_pcm_runtime *runtime = substream->runtime;
2229 snd_pcm_sframes_t appl_ptr; 2254 snd_pcm_sframes_t appl_ptr;
2230 snd_pcm_sframes_t ret; 2255 snd_pcm_sframes_t ret;
2231 snd_pcm_sframes_t avail; 2256 snd_pcm_sframes_t avail;
@@ -2273,9 +2298,10 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(snd_pcm_substream_t *substream
2273 return ret; 2298 return ret;
2274} 2299}
2275 2300
2276static snd_pcm_sframes_t snd_pcm_capture_forward(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) 2301static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *substream,
2302 snd_pcm_uframes_t frames)
2277{ 2303{
2278 snd_pcm_runtime_t *runtime = substream->runtime; 2304 struct snd_pcm_runtime *runtime = substream->runtime;
2279 snd_pcm_sframes_t appl_ptr; 2305 snd_pcm_sframes_t appl_ptr;
2280 snd_pcm_sframes_t ret; 2306 snd_pcm_sframes_t ret;
2281 snd_pcm_sframes_t avail; 2307 snd_pcm_sframes_t avail;
@@ -2323,9 +2349,9 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(snd_pcm_substream_t *substream,
2323 return ret; 2349 return ret;
2324} 2350}
2325 2351
2326static int snd_pcm_hwsync(snd_pcm_substream_t *substream) 2352static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
2327{ 2353{
2328 snd_pcm_runtime_t *runtime = substream->runtime; 2354 struct snd_pcm_runtime *runtime = substream->runtime;
2329 int err; 2355 int err;
2330 2356
2331 snd_pcm_stream_lock_irq(substream); 2357 snd_pcm_stream_lock_irq(substream);
@@ -2353,9 +2379,10 @@ static int snd_pcm_hwsync(snd_pcm_substream_t *substream)
2353 return err; 2379 return err;
2354} 2380}
2355 2381
2356static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __user *res) 2382static int snd_pcm_delay(struct snd_pcm_substream *substream,
2383 snd_pcm_sframes_t __user *res)
2357{ 2384{
2358 snd_pcm_runtime_t *runtime = substream->runtime; 2385 struct snd_pcm_runtime *runtime = substream->runtime;
2359 int err; 2386 int err;
2360 snd_pcm_sframes_t n = 0; 2387 snd_pcm_sframes_t n = 0;
2361 2388
@@ -2391,18 +2418,19 @@ static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __use
2391 return err; 2418 return err;
2392} 2419}
2393 2420
2394static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr __user *_sync_ptr) 2421static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
2422 struct snd_pcm_sync_ptr __user *_sync_ptr)
2395{ 2423{
2396 snd_pcm_runtime_t *runtime = substream->runtime; 2424 struct snd_pcm_runtime *runtime = substream->runtime;
2397 struct sndrv_pcm_sync_ptr sync_ptr; 2425 struct snd_pcm_sync_ptr sync_ptr;
2398 volatile struct sndrv_pcm_mmap_status *status; 2426 volatile struct snd_pcm_mmap_status *status;
2399 volatile struct sndrv_pcm_mmap_control *control; 2427 volatile struct snd_pcm_mmap_control *control;
2400 int err; 2428 int err;
2401 2429
2402 memset(&sync_ptr, 0, sizeof(sync_ptr)); 2430 memset(&sync_ptr, 0, sizeof(sync_ptr));
2403 if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) 2431 if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags)))
2404 return -EFAULT; 2432 return -EFAULT;
2405 if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct sndrv_pcm_mmap_control))) 2433 if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control)))
2406 return -EFAULT; 2434 return -EFAULT;
2407 status = runtime->status; 2435 status = runtime->status;
2408 control = runtime->control; 2436 control = runtime->control;
@@ -2430,12 +2458,12 @@ static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_syn
2430 return 0; 2458 return 0;
2431} 2459}
2432 2460
2433static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, 2461static int snd_pcm_playback_ioctl1(struct snd_pcm_substream *substream,
2434 unsigned int cmd, void __user *arg); 2462 unsigned int cmd, void __user *arg);
2435static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, 2463static int snd_pcm_capture_ioctl1(struct snd_pcm_substream *substream,
2436 unsigned int cmd, void __user *arg); 2464 unsigned int cmd, void __user *arg);
2437 2465
2438static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, 2466static int snd_pcm_common_ioctl1(struct snd_pcm_substream *substream,
2439 unsigned int cmd, void __user *arg) 2467 unsigned int cmd, void __user *arg)
2440{ 2468{
2441 snd_assert(substream != NULL, return -ENXIO); 2469 snd_assert(substream != NULL, return -ENXIO);
@@ -2492,7 +2520,7 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream,
2492 return -ENOTTY; 2520 return -ENOTTY;
2493} 2521}
2494 2522
2495static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, 2523static int snd_pcm_playback_ioctl1(struct snd_pcm_substream *substream,
2496 unsigned int cmd, void __user *arg) 2524 unsigned int cmd, void __user *arg)
2497{ 2525{
2498 snd_assert(substream != NULL, return -ENXIO); 2526 snd_assert(substream != NULL, return -ENXIO);
@@ -2500,9 +2528,9 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
2500 switch (cmd) { 2528 switch (cmd) {
2501 case SNDRV_PCM_IOCTL_WRITEI_FRAMES: 2529 case SNDRV_PCM_IOCTL_WRITEI_FRAMES:
2502 { 2530 {
2503 snd_xferi_t xferi; 2531 struct snd_xferi xferi;
2504 snd_xferi_t __user *_xferi = arg; 2532 struct snd_xferi __user *_xferi = arg;
2505 snd_pcm_runtime_t *runtime = substream->runtime; 2533 struct snd_pcm_runtime *runtime = substream->runtime;
2506 snd_pcm_sframes_t result; 2534 snd_pcm_sframes_t result;
2507 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 2535 if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
2508 return -EBADFD; 2536 return -EBADFD;
@@ -2516,9 +2544,9 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
2516 } 2544 }
2517 case SNDRV_PCM_IOCTL_WRITEN_FRAMES: 2545 case SNDRV_PCM_IOCTL_WRITEN_FRAMES:
2518 { 2546 {
2519 snd_xfern_t xfern; 2547 struct snd_xfern xfern;
2520 snd_xfern_t __user *_xfern = arg; 2548 struct snd_xfern __user *_xfern = arg;
2521 snd_pcm_runtime_t *runtime = substream->runtime; 2549 struct snd_pcm_runtime *runtime = substream->runtime;
2522 void __user **bufs; 2550 void __user **bufs;
2523 snd_pcm_sframes_t result; 2551 snd_pcm_sframes_t result;
2524 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 2552 if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
@@ -2579,7 +2607,7 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
2579 return snd_pcm_common_ioctl1(substream, cmd, arg); 2607 return snd_pcm_common_ioctl1(substream, cmd, arg);
2580} 2608}
2581 2609
2582static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, 2610static int snd_pcm_capture_ioctl1(struct snd_pcm_substream *substream,
2583 unsigned int cmd, void __user *arg) 2611 unsigned int cmd, void __user *arg)
2584{ 2612{
2585 snd_assert(substream != NULL, return -ENXIO); 2613 snd_assert(substream != NULL, return -ENXIO);
@@ -2587,9 +2615,9 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
2587 switch (cmd) { 2615 switch (cmd) {
2588 case SNDRV_PCM_IOCTL_READI_FRAMES: 2616 case SNDRV_PCM_IOCTL_READI_FRAMES:
2589 { 2617 {
2590 snd_xferi_t xferi; 2618 struct snd_xferi xferi;
2591 snd_xferi_t __user *_xferi = arg; 2619 struct snd_xferi __user *_xferi = arg;
2592 snd_pcm_runtime_t *runtime = substream->runtime; 2620 struct snd_pcm_runtime *runtime = substream->runtime;
2593 snd_pcm_sframes_t result; 2621 snd_pcm_sframes_t result;
2594 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 2622 if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
2595 return -EBADFD; 2623 return -EBADFD;
@@ -2603,9 +2631,9 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
2603 } 2631 }
2604 case SNDRV_PCM_IOCTL_READN_FRAMES: 2632 case SNDRV_PCM_IOCTL_READN_FRAMES:
2605 { 2633 {
2606 snd_xfern_t xfern; 2634 struct snd_xfern xfern;
2607 snd_xfern_t __user *_xfern = arg; 2635 struct snd_xfern __user *_xfern = arg;
2608 snd_pcm_runtime_t *runtime = substream->runtime; 2636 struct snd_pcm_runtime *runtime = substream->runtime;
2609 void *bufs; 2637 void *bufs;
2610 snd_pcm_sframes_t result; 2638 snd_pcm_sframes_t result;
2611 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 2639 if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
@@ -2658,9 +2686,10 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
2658 return snd_pcm_common_ioctl1(substream, cmd, arg); 2686 return snd_pcm_common_ioctl1(substream, cmd, arg);
2659} 2687}
2660 2688
2661static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2689static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd,
2690 unsigned long arg)
2662{ 2691{
2663 snd_pcm_file_t *pcm_file; 2692 struct snd_pcm_file *pcm_file;
2664 2693
2665 pcm_file = file->private_data; 2694 pcm_file = file->private_data;
2666 2695
@@ -2670,9 +2699,10 @@ static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd, unsigned
2670 return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg); 2699 return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
2671} 2700}
2672 2701
2673static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2702static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd,
2703 unsigned long arg)
2674{ 2704{
2675 snd_pcm_file_t *pcm_file; 2705 struct snd_pcm_file *pcm_file;
2676 2706
2677 pcm_file = file->private_data; 2707 pcm_file = file->private_data;
2678 2708
@@ -2682,7 +2712,7 @@ static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, unsigned
2682 return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg); 2712 return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
2683} 2713}
2684 2714
2685int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, 2715int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream,
2686 unsigned int cmd, void *arg) 2716 unsigned int cmd, void *arg)
2687{ 2717{
2688 mm_segment_t fs; 2718 mm_segment_t fs;
@@ -2694,7 +2724,7 @@ int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream,
2694 return result; 2724 return result;
2695} 2725}
2696 2726
2697int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, 2727int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream,
2698 unsigned int cmd, void *arg) 2728 unsigned int cmd, void *arg)
2699{ 2729{
2700 mm_segment_t fs; 2730 mm_segment_t fs;
@@ -2706,7 +2736,7 @@ int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream,
2706 return result; 2736 return result;
2707} 2737}
2708 2738
2709int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, 2739int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
2710 unsigned int cmd, void *arg) 2740 unsigned int cmd, void *arg)
2711{ 2741{
2712 switch (substream->stream) { 2742 switch (substream->stream) {
@@ -2719,11 +2749,12 @@ int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream,
2719 } 2749 }
2720} 2750}
2721 2751
2722static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, loff_t * offset) 2752static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count,
2753 loff_t * offset)
2723{ 2754{
2724 snd_pcm_file_t *pcm_file; 2755 struct snd_pcm_file *pcm_file;
2725 snd_pcm_substream_t *substream; 2756 struct snd_pcm_substream *substream;
2726 snd_pcm_runtime_t *runtime; 2757 struct snd_pcm_runtime *runtime;
2727 snd_pcm_sframes_t result; 2758 snd_pcm_sframes_t result;
2728 2759
2729 pcm_file = file->private_data; 2760 pcm_file = file->private_data;
@@ -2741,11 +2772,12 @@ static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, l
2741 return result; 2772 return result;
2742} 2773}
2743 2774
2744static ssize_t snd_pcm_write(struct file *file, const char __user *buf, size_t count, loff_t * offset) 2775static ssize_t snd_pcm_write(struct file *file, const char __user *buf,
2776 size_t count, loff_t * offset)
2745{ 2777{
2746 snd_pcm_file_t *pcm_file; 2778 struct snd_pcm_file *pcm_file;
2747 snd_pcm_substream_t *substream; 2779 struct snd_pcm_substream *substream;
2748 snd_pcm_runtime_t *runtime; 2780 struct snd_pcm_runtime *runtime;
2749 snd_pcm_sframes_t result; 2781 snd_pcm_sframes_t result;
2750 2782
2751 pcm_file = file->private_data; 2783 pcm_file = file->private_data;
@@ -2772,9 +2804,9 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
2772 unsigned long count, loff_t * offset) 2804 unsigned long count, loff_t * offset)
2773 2805
2774{ 2806{
2775 snd_pcm_file_t *pcm_file; 2807 struct snd_pcm_file *pcm_file;
2776 snd_pcm_substream_t *substream; 2808 struct snd_pcm_substream *substream;
2777 snd_pcm_runtime_t *runtime; 2809 struct snd_pcm_runtime *runtime;
2778 snd_pcm_sframes_t result; 2810 snd_pcm_sframes_t result;
2779 unsigned long i; 2811 unsigned long i;
2780 void __user **bufs; 2812 void __user **bufs;
@@ -2806,9 +2838,9 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
2806static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, 2838static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
2807 unsigned long count, loff_t * offset) 2839 unsigned long count, loff_t * offset)
2808{ 2840{
2809 snd_pcm_file_t *pcm_file; 2841 struct snd_pcm_file *pcm_file;
2810 snd_pcm_substream_t *substream; 2842 struct snd_pcm_substream *substream;
2811 snd_pcm_runtime_t *runtime; 2843 struct snd_pcm_runtime *runtime;
2812 snd_pcm_sframes_t result; 2844 snd_pcm_sframes_t result;
2813 unsigned long i; 2845 unsigned long i;
2814 void __user **bufs; 2846 void __user **bufs;
@@ -2843,9 +2875,9 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
2843 2875
2844static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) 2876static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
2845{ 2877{
2846 snd_pcm_file_t *pcm_file; 2878 struct snd_pcm_file *pcm_file;
2847 snd_pcm_substream_t *substream; 2879 struct snd_pcm_substream *substream;
2848 snd_pcm_runtime_t *runtime; 2880 struct snd_pcm_runtime *runtime;
2849 unsigned int mask; 2881 unsigned int mask;
2850 snd_pcm_uframes_t avail; 2882 snd_pcm_uframes_t avail;
2851 2883
@@ -2881,9 +2913,9 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
2881 2913
2882static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait) 2914static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)
2883{ 2915{
2884 snd_pcm_file_t *pcm_file; 2916 struct snd_pcm_file *pcm_file;
2885 snd_pcm_substream_t *substream; 2917 struct snd_pcm_substream *substream;
2886 snd_pcm_runtime_t *runtime; 2918 struct snd_pcm_runtime *runtime;
2887 unsigned int mask; 2919 unsigned int mask;
2888 snd_pcm_uframes_t avail; 2920 snd_pcm_uframes_t avail;
2889 2921
@@ -2933,10 +2965,11 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)
2933/* 2965/*
2934 * mmap status record 2966 * mmap status record
2935 */ 2967 */
2936static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area, unsigned long address, int *type) 2968static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area,
2969 unsigned long address, int *type)
2937{ 2970{
2938 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 2971 struct snd_pcm_substream *substream = area->vm_private_data;
2939 snd_pcm_runtime_t *runtime; 2972 struct snd_pcm_runtime *runtime;
2940 struct page * page; 2973 struct page * page;
2941 2974
2942 if (substream == NULL) 2975 if (substream == NULL)
@@ -2954,17 +2987,17 @@ static struct vm_operations_struct snd_pcm_vm_ops_status =
2954 .nopage = snd_pcm_mmap_status_nopage, 2987 .nopage = snd_pcm_mmap_status_nopage,
2955}; 2988};
2956 2989
2957static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file, 2990static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file,
2958 struct vm_area_struct *area) 2991 struct vm_area_struct *area)
2959{ 2992{
2960 snd_pcm_runtime_t *runtime; 2993 struct snd_pcm_runtime *runtime;
2961 long size; 2994 long size;
2962 if (!(area->vm_flags & VM_READ)) 2995 if (!(area->vm_flags & VM_READ))
2963 return -EINVAL; 2996 return -EINVAL;
2964 runtime = substream->runtime; 2997 runtime = substream->runtime;
2965 snd_assert(runtime != NULL, return -EAGAIN); 2998 snd_assert(runtime != NULL, return -EAGAIN);
2966 size = area->vm_end - area->vm_start; 2999 size = area->vm_end - area->vm_start;
2967 if (size != PAGE_ALIGN(sizeof(snd_pcm_mmap_status_t))) 3000 if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)))
2968 return -EINVAL; 3001 return -EINVAL;
2969 area->vm_ops = &snd_pcm_vm_ops_status; 3002 area->vm_ops = &snd_pcm_vm_ops_status;
2970 area->vm_private_data = substream; 3003 area->vm_private_data = substream;
@@ -2975,10 +3008,11 @@ static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file
2975/* 3008/*
2976 * mmap control record 3009 * mmap control record
2977 */ 3010 */
2978static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area, unsigned long address, int *type) 3011static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area,
3012 unsigned long address, int *type)
2979{ 3013{
2980 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 3014 struct snd_pcm_substream *substream = area->vm_private_data;
2981 snd_pcm_runtime_t *runtime; 3015 struct snd_pcm_runtime *runtime;
2982 struct page * page; 3016 struct page * page;
2983 3017
2984 if (substream == NULL) 3018 if (substream == NULL)
@@ -2996,17 +3030,17 @@ static struct vm_operations_struct snd_pcm_vm_ops_control =
2996 .nopage = snd_pcm_mmap_control_nopage, 3030 .nopage = snd_pcm_mmap_control_nopage,
2997}; 3031};
2998 3032
2999static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *file, 3033static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file,
3000 struct vm_area_struct *area) 3034 struct vm_area_struct *area)
3001{ 3035{
3002 snd_pcm_runtime_t *runtime; 3036 struct snd_pcm_runtime *runtime;
3003 long size; 3037 long size;
3004 if (!(area->vm_flags & VM_READ)) 3038 if (!(area->vm_flags & VM_READ))
3005 return -EINVAL; 3039 return -EINVAL;
3006 runtime = substream->runtime; 3040 runtime = substream->runtime;
3007 snd_assert(runtime != NULL, return -EAGAIN); 3041 snd_assert(runtime != NULL, return -EAGAIN);
3008 size = area->vm_end - area->vm_start; 3042 size = area->vm_end - area->vm_start;
3009 if (size != PAGE_ALIGN(sizeof(snd_pcm_mmap_control_t))) 3043 if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)))
3010 return -EINVAL; 3044 return -EINVAL;
3011 area->vm_ops = &snd_pcm_vm_ops_control; 3045 area->vm_ops = &snd_pcm_vm_ops_control;
3012 area->vm_private_data = substream; 3046 area->vm_private_data = substream;
@@ -3017,12 +3051,12 @@ static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *fil
3017/* 3051/*
3018 * don't support mmap for status and control records. 3052 * don't support mmap for status and control records.
3019 */ 3053 */
3020static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file, 3054static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file,
3021 struct vm_area_struct *area) 3055 struct vm_area_struct *area)
3022{ 3056{
3023 return -ENXIO; 3057 return -ENXIO;
3024} 3058}
3025static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *file, 3059static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file,
3026 struct vm_area_struct *area) 3060 struct vm_area_struct *area)
3027{ 3061{
3028 return -ENXIO; 3062 return -ENXIO;
@@ -3032,10 +3066,11 @@ static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *fil
3032/* 3066/*
3033 * nopage callback for mmapping a RAM page 3067 * nopage callback for mmapping a RAM page
3034 */ 3068 */
3035static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area, unsigned long address, int *type) 3069static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
3070 unsigned long address, int *type)
3036{ 3071{
3037 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 3072 struct snd_pcm_substream *substream = area->vm_private_data;
3038 snd_pcm_runtime_t *runtime; 3073 struct snd_pcm_runtime *runtime;
3039 unsigned long offset; 3074 unsigned long offset;
3040 struct page * page; 3075 struct page * page;
3041 void *vaddr; 3076 void *vaddr;
@@ -3074,7 +3109,8 @@ static struct vm_operations_struct snd_pcm_vm_ops_data =
3074/* 3109/*
3075 * mmap the DMA buffer on RAM 3110 * mmap the DMA buffer on RAM
3076 */ 3111 */
3077static int snd_pcm_default_mmap(snd_pcm_substream_t *substream, struct vm_area_struct *area) 3112static int snd_pcm_default_mmap(struct snd_pcm_substream *substream,
3113 struct vm_area_struct *area)
3078{ 3114{
3079 area->vm_ops = &snd_pcm_vm_ops_data; 3115 area->vm_ops = &snd_pcm_vm_ops_data;
3080 area->vm_private_data = substream; 3116 area->vm_private_data = substream;
@@ -3093,7 +3129,8 @@ static struct vm_operations_struct snd_pcm_vm_ops_data_mmio =
3093 .close = snd_pcm_mmap_data_close, 3129 .close = snd_pcm_mmap_data_close,
3094}; 3130};
3095 3131
3096int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area) 3132int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
3133 struct vm_area_struct *area)
3097{ 3134{
3098 long size; 3135 long size;
3099 unsigned long offset; 3136 unsigned long offset;
@@ -3118,10 +3155,10 @@ int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct
3118/* 3155/*
3119 * mmap DMA buffer 3156 * mmap DMA buffer
3120 */ 3157 */
3121int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, 3158int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file,
3122 struct vm_area_struct *area) 3159 struct vm_area_struct *area)
3123{ 3160{
3124 snd_pcm_runtime_t *runtime; 3161 struct snd_pcm_runtime *runtime;
3125 long size; 3162 long size;
3126 unsigned long offset; 3163 unsigned long offset;
3127 size_t dma_bytes; 3164 size_t dma_bytes;
@@ -3158,8 +3195,8 @@ int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file,
3158 3195
3159static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) 3196static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
3160{ 3197{
3161 snd_pcm_file_t * pcm_file; 3198 struct snd_pcm_file * pcm_file;
3162 snd_pcm_substream_t *substream; 3199 struct snd_pcm_substream *substream;
3163 unsigned long offset; 3200 unsigned long offset;
3164 3201
3165 pcm_file = file->private_data; 3202 pcm_file = file->private_data;
@@ -3184,9 +3221,9 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
3184 3221
3185static int snd_pcm_fasync(int fd, struct file * file, int on) 3222static int snd_pcm_fasync(int fd, struct file * file, int on)
3186{ 3223{
3187 snd_pcm_file_t * pcm_file; 3224 struct snd_pcm_file * pcm_file;
3188 snd_pcm_substream_t *substream; 3225 struct snd_pcm_substream *substream;
3189 snd_pcm_runtime_t *runtime; 3226 struct snd_pcm_runtime *runtime;
3190 int err; 3227 int err;
3191 3228
3192 pcm_file = file->private_data; 3229 pcm_file = file->private_data;
@@ -3216,7 +3253,8 @@ static int snd_pcm_fasync(int fd, struct file * file, int on)
3216#define __OLD_TO_NEW_MASK(x) ((x&7)|((x&0x07fffff8)<<5)) 3253#define __OLD_TO_NEW_MASK(x) ((x&7)|((x&0x07fffff8)<<5))
3217#define __NEW_TO_OLD_MASK(x) ((x&7)|((x&0xffffff00)>>5)) 3254#define __NEW_TO_OLD_MASK(x) ((x&7)|((x&0xffffff00)>>5))
3218 3255
3219static void snd_pcm_hw_convert_from_old_params(snd_pcm_hw_params_t *params, struct sndrv_pcm_hw_params_old *oparams) 3256static void snd_pcm_hw_convert_from_old_params(struct snd_pcm_hw_params *params,
3257 struct snd_pcm_hw_params_old *oparams)
3220{ 3258{
3221 unsigned int i; 3259 unsigned int i;
3222 3260
@@ -3234,7 +3272,8 @@ static void snd_pcm_hw_convert_from_old_params(snd_pcm_hw_params_t *params, stru
3234 params->fifo_size = oparams->fifo_size; 3272 params->fifo_size = oparams->fifo_size;
3235} 3273}
3236 3274
3237static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *oparams, snd_pcm_hw_params_t *params) 3275static void snd_pcm_hw_convert_to_old_params(struct snd_pcm_hw_params_old *oparams,
3276 struct snd_pcm_hw_params *params)
3238{ 3277{
3239 unsigned int i; 3278 unsigned int i;
3240 3279
@@ -3252,10 +3291,11 @@ static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *opa
3252 oparams->fifo_size = params->fifo_size; 3291 oparams->fifo_size = params->fifo_size;
3253} 3292}
3254 3293
3255static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) 3294static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
3295 struct snd_pcm_hw_params_old __user * _oparams)
3256{ 3296{
3257 snd_pcm_hw_params_t *params; 3297 struct snd_pcm_hw_params *params;
3258 struct sndrv_pcm_hw_params_old *oparams = NULL; 3298 struct snd_pcm_hw_params_old *oparams = NULL;
3259 int err; 3299 int err;
3260 3300
3261 params = kmalloc(sizeof(*params), GFP_KERNEL); 3301 params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -3286,10 +3326,11 @@ out:
3286 return err; 3326 return err;
3287} 3327}
3288 3328
3289static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) 3329static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
3330 struct snd_pcm_hw_params_old __user * _oparams)
3290{ 3331{
3291 snd_pcm_hw_params_t *params; 3332 struct snd_pcm_hw_params *params;
3292 struct sndrv_pcm_hw_params_old *oparams = NULL; 3333 struct snd_pcm_hw_params_old *oparams = NULL;
3293 int err; 3334 int err;
3294 3335
3295 params = kmalloc(sizeof(*params), GFP_KERNEL); 3336 params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -3349,7 +3390,7 @@ static struct file_operations snd_pcm_f_ops_capture = {
3349 .fasync = snd_pcm_fasync, 3390 .fasync = snd_pcm_fasync,
3350}; 3391};
3351 3392
3352snd_minor_t snd_pcm_reg[2] = 3393struct snd_minor snd_pcm_reg[2] =
3353{ 3394{
3354 { 3395 {
3355 .comment = "digital audio playback", 3396 .comment = "digital audio playback",