aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/pcm_oss.h41
-rw-r--r--sound/core/oss/copy.c16
-rw-r--r--sound/core/oss/io.c28
-rw-r--r--sound/core/oss/linear.c38
-rw-r--r--sound/core/oss/mulaw.c54
-rw-r--r--sound/core/oss/pcm_oss.c364
-rw-r--r--sound/core/oss/pcm_plugin.c110
-rw-r--r--sound/core/oss/pcm_plugin.h208
-rw-r--r--sound/core/oss/rate.c83
-rw-r--r--sound/core/oss/route.c134
10 files changed, 543 insertions, 533 deletions
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index 0b67c9d105a..fddaddde47b 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -22,10 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25typedef struct _snd_pcm_plugin snd_pcm_plugin_t; 25struct snd_pcm_oss_setup {
26typedef struct _snd_pcm_oss_setup snd_pcm_oss_setup_t;
27
28struct _snd_pcm_oss_setup {
29 char *task_name; 26 char *task_name;
30 unsigned int disable:1, 27 unsigned int disable:1,
31 direct:1, 28 direct:1,
@@ -36,10 +33,10 @@ struct _snd_pcm_oss_setup {
36 buggyptr:1; 33 buggyptr:1;
37 unsigned int periods; 34 unsigned int periods;
38 unsigned int period_size; 35 unsigned int period_size;
39 snd_pcm_oss_setup_t *next; 36 struct snd_pcm_oss_setup *next;
40}; 37};
41 38
42typedef struct _snd_pcm_oss_runtime { 39struct snd_pcm_oss_runtime {
43 unsigned params: 1, /* format/parameter change */ 40 unsigned params: 1, /* format/parameter change */
44 prepare: 1, /* need to prepare the operation */ 41 prepare: 1, /* need to prepare the operation */
45 trigger: 1, /* trigger flag */ 42 trigger: 1, /* trigger flag */
@@ -59,30 +56,30 @@ typedef struct _snd_pcm_oss_runtime {
59 size_t mmap_bytes; 56 size_t mmap_bytes;
60 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
61 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
62 snd_pcm_plugin_t *plugin_first; 59 struct snd_pcm_plugin *plugin_first;
63 snd_pcm_plugin_t *plugin_last; 60 struct snd_pcm_plugin *plugin_last;
64 unsigned int prev_hw_ptr_interrupt; 61 unsigned int prev_hw_ptr_interrupt;
65} snd_pcm_oss_runtime_t; 62};
66 63
67typedef struct _snd_pcm_oss_file { 64struct snd_pcm_oss_file {
68 snd_pcm_substream_t *streams[2]; 65 struct snd_pcm_substream *streams[2];
69} snd_pcm_oss_file_t; 66};
70 67
71typedef struct _snd_pcm_oss_substream { 68struct snd_pcm_oss_substream {
72 unsigned oss: 1; /* oss mode */ 69 unsigned oss: 1; /* oss mode */
73 snd_pcm_oss_setup_t *setup; /* active setup */ 70 struct snd_pcm_oss_setup *setup; /* active setup */
74 snd_pcm_oss_file_t *file; 71 struct snd_pcm_oss_file *file;
75} snd_pcm_oss_substream_t; 72};
76 73
77typedef struct _snd_pcm_oss_stream { 74struct snd_pcm_oss_stream {
78 snd_pcm_oss_setup_t *setup_list; /* setup list */ 75 struct snd_pcm_oss_setup *setup_list; /* setup list */
79 struct semaphore setup_mutex; 76 struct semaphore setup_mutex;
80 snd_info_entry_t *proc_entry; 77 struct snd_info_entry *proc_entry;
81} snd_pcm_oss_stream_t; 78};
82 79
83typedef struct _snd_pcm_oss { 80struct snd_pcm_oss {
84 int reg; 81 int reg;
85 unsigned int reg_mask; 82 unsigned int reg_mask;
86} snd_pcm_oss_t; 83};
87 84
88#endif /* __SOUND_PCM_OSS_H */ 85#endif /* __SOUND_PCM_OSS_H */
diff --git a/sound/core/oss/copy.c b/sound/core/oss/copy.c
index edecbe7417b..d6a04c2d5a7 100644
--- a/sound/core/oss/copy.c
+++ b/sound/core/oss/copy.c
@@ -25,9 +25,9 @@
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26#include "pcm_plugin.h" 26#include "pcm_plugin.h"
27 27
28static snd_pcm_sframes_t copy_transfer(snd_pcm_plugin_t *plugin, 28static snd_pcm_sframes_t copy_transfer(struct snd_pcm_plugin *plugin,
29 const snd_pcm_plugin_channel_t *src_channels, 29 const struct snd_pcm_plugin_channel *src_channels,
30 snd_pcm_plugin_channel_t *dst_channels, 30 struct snd_pcm_plugin_channel *dst_channels,
31 snd_pcm_uframes_t frames) 31 snd_pcm_uframes_t frames)
32{ 32{
33 unsigned int channel; 33 unsigned int channel;
@@ -58,13 +58,13 @@ static snd_pcm_sframes_t copy_transfer(snd_pcm_plugin_t *plugin,
58 return frames; 58 return frames;
59} 59}
60 60
61int snd_pcm_plugin_build_copy(snd_pcm_plug_t *plug, 61int snd_pcm_plugin_build_copy(struct snd_pcm_substream *plug,
62 snd_pcm_plugin_format_t *src_format, 62 struct snd_pcm_plugin_format *src_format,
63 snd_pcm_plugin_format_t *dst_format, 63 struct snd_pcm_plugin_format *dst_format,
64 snd_pcm_plugin_t **r_plugin) 64 struct snd_pcm_plugin **r_plugin)
65{ 65{
66 int err; 66 int err;
67 snd_pcm_plugin_t *plugin; 67 struct snd_pcm_plugin *plugin;
68 int width; 68 int width;
69 69
70 snd_assert(r_plugin != NULL, return -ENXIO); 70 snd_assert(r_plugin != NULL, return -ENXIO);
diff --git a/sound/core/oss/io.c b/sound/core/oss/io.c
index 63eca9aec96..322702e05f3 100644
--- a/sound/core/oss/io.c
+++ b/sound/core/oss/io.c
@@ -35,9 +35,9 @@
35 * Basic io plugin 35 * Basic io plugin
36 */ 36 */
37 37
38static snd_pcm_sframes_t io_playback_transfer(snd_pcm_plugin_t *plugin, 38static snd_pcm_sframes_t io_playback_transfer(struct snd_pcm_plugin *plugin,
39 const snd_pcm_plugin_channel_t *src_channels, 39 const struct snd_pcm_plugin_channel *src_channels,
40 snd_pcm_plugin_channel_t *dst_channels, 40 struct snd_pcm_plugin_channel *dst_channels,
41 snd_pcm_uframes_t frames) 41 snd_pcm_uframes_t frames)
42{ 42{
43 snd_assert(plugin != NULL, return -ENXIO); 43 snd_assert(plugin != NULL, return -ENXIO);
@@ -58,9 +58,9 @@ static snd_pcm_sframes_t io_playback_transfer(snd_pcm_plugin_t *plugin,
58 } 58 }
59} 59}
60 60
61static snd_pcm_sframes_t io_capture_transfer(snd_pcm_plugin_t *plugin, 61static snd_pcm_sframes_t io_capture_transfer(struct snd_pcm_plugin *plugin,
62 const snd_pcm_plugin_channel_t *src_channels, 62 const struct snd_pcm_plugin_channel *src_channels,
63 snd_pcm_plugin_channel_t *dst_channels, 63 struct snd_pcm_plugin_channel *dst_channels,
64 snd_pcm_uframes_t frames) 64 snd_pcm_uframes_t frames)
65{ 65{
66 snd_assert(plugin != NULL, return -ENXIO); 66 snd_assert(plugin != NULL, return -ENXIO);
@@ -82,13 +82,13 @@ static snd_pcm_sframes_t io_capture_transfer(snd_pcm_plugin_t *plugin,
82 return 0; 82 return 0;
83} 83}
84 84
85static snd_pcm_sframes_t io_src_channels(snd_pcm_plugin_t *plugin, 85static snd_pcm_sframes_t io_src_channels(struct snd_pcm_plugin *plugin,
86 snd_pcm_uframes_t frames, 86 snd_pcm_uframes_t frames,
87 snd_pcm_plugin_channel_t **channels) 87 struct snd_pcm_plugin_channel **channels)
88{ 88{
89 int err; 89 int err;
90 unsigned int channel; 90 unsigned int channel;
91 snd_pcm_plugin_channel_t *v; 91 struct snd_pcm_plugin_channel *v;
92 err = snd_pcm_plugin_client_channels(plugin, frames, &v); 92 err = snd_pcm_plugin_client_channels(plugin, frames, &v);
93 if (err < 0) 93 if (err < 0)
94 return err; 94 return err;
@@ -100,13 +100,13 @@ static snd_pcm_sframes_t io_src_channels(snd_pcm_plugin_t *plugin,
100 return frames; 100 return frames;
101} 101}
102 102
103int snd_pcm_plugin_build_io(snd_pcm_plug_t *plug, 103int snd_pcm_plugin_build_io(struct snd_pcm_substream *plug,
104 snd_pcm_hw_params_t *params, 104 struct snd_pcm_hw_params *params,
105 snd_pcm_plugin_t **r_plugin) 105 struct snd_pcm_plugin **r_plugin)
106{ 106{
107 int err; 107 int err;
108 snd_pcm_plugin_format_t format; 108 struct snd_pcm_plugin_format format;
109 snd_pcm_plugin_t *plugin; 109 struct snd_pcm_plugin *plugin;
110 110
111 snd_assert(r_plugin != NULL, return -ENXIO); 111 snd_assert(r_plugin != NULL, return -ENXIO);
112 *r_plugin = NULL; 112 *r_plugin = NULL;
diff --git a/sound/core/oss/linear.c b/sound/core/oss/linear.c
index 12ed27a57b2..8cbfa415ce4 100644
--- a/sound/core/oss/linear.c
+++ b/sound/core/oss/linear.c
@@ -30,19 +30,19 @@
30 * Basic linear conversion plugin 30 * Basic linear conversion plugin
31 */ 31 */
32 32
33typedef struct linear_private_data { 33struct linear_priv {
34 int conv; 34 int conv;
35} linear_t; 35};
36 36
37static void convert(snd_pcm_plugin_t *plugin, 37static void convert(struct snd_pcm_plugin *plugin,
38 const snd_pcm_plugin_channel_t *src_channels, 38 const struct snd_pcm_plugin_channel *src_channels,
39 snd_pcm_plugin_channel_t *dst_channels, 39 struct snd_pcm_plugin_channel *dst_channels,
40 snd_pcm_uframes_t frames) 40 snd_pcm_uframes_t frames)
41{ 41{
42#define CONV_LABELS 42#define CONV_LABELS
43#include "plugin_ops.h" 43#include "plugin_ops.h"
44#undef CONV_LABELS 44#undef CONV_LABELS
45 linear_t *data = (linear_t *)plugin->extra_data; 45 struct linear_priv *data = (struct linear_priv *)plugin->extra_data;
46 void *conv = conv_labels[data->conv]; 46 void *conv = conv_labels[data->conv];
47 int channel; 47 int channel;
48 int nchannels = plugin->src_format.channels; 48 int nchannels = plugin->src_format.channels;
@@ -75,15 +75,15 @@ static void convert(snd_pcm_plugin_t *plugin,
75 } 75 }
76} 76}
77 77
78static snd_pcm_sframes_t linear_transfer(snd_pcm_plugin_t *plugin, 78static snd_pcm_sframes_t linear_transfer(struct snd_pcm_plugin *plugin,
79 const snd_pcm_plugin_channel_t *src_channels, 79 const struct snd_pcm_plugin_channel *src_channels,
80 snd_pcm_plugin_channel_t *dst_channels, 80 struct snd_pcm_plugin_channel *dst_channels,
81 snd_pcm_uframes_t frames) 81 snd_pcm_uframes_t frames)
82{ 82{
83 linear_t *data; 83 struct linear_priv *data;
84 84
85 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO); 85 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO);
86 data = (linear_t *)plugin->extra_data; 86 data = (struct linear_priv *)plugin->extra_data;
87 if (frames == 0) 87 if (frames == 0)
88 return 0; 88 return 0;
89#ifdef CONFIG_SND_DEBUG 89#ifdef CONFIG_SND_DEBUG
@@ -128,14 +128,14 @@ int conv_index(int src_format, int dst_format)
128 return src_width * 32 + src_endian * 16 + sign * 8 + dst_width * 2 + dst_endian; 128 return src_width * 32 + src_endian * 16 + sign * 8 + dst_width * 2 + dst_endian;
129} 129}
130 130
131int snd_pcm_plugin_build_linear(snd_pcm_plug_t *plug, 131int snd_pcm_plugin_build_linear(struct snd_pcm_substream *plug,
132 snd_pcm_plugin_format_t *src_format, 132 struct snd_pcm_plugin_format *src_format,
133 snd_pcm_plugin_format_t *dst_format, 133 struct snd_pcm_plugin_format *dst_format,
134 snd_pcm_plugin_t **r_plugin) 134 struct snd_pcm_plugin **r_plugin)
135{ 135{
136 int err; 136 int err;
137 struct linear_private_data *data; 137 struct linear_priv *data;
138 snd_pcm_plugin_t *plugin; 138 struct snd_pcm_plugin *plugin;
139 139
140 snd_assert(r_plugin != NULL, return -ENXIO); 140 snd_assert(r_plugin != NULL, return -ENXIO);
141 *r_plugin = NULL; 141 *r_plugin = NULL;
@@ -147,10 +147,10 @@ int snd_pcm_plugin_build_linear(snd_pcm_plug_t *plug,
147 147
148 err = snd_pcm_plugin_build(plug, "linear format conversion", 148 err = snd_pcm_plugin_build(plug, "linear format conversion",
149 src_format, dst_format, 149 src_format, dst_format,
150 sizeof(linear_t), &plugin); 150 sizeof(struct linear_priv), &plugin);
151 if (err < 0) 151 if (err < 0)
152 return err; 152 return err;
153 data = (linear_t *)plugin->extra_data; 153 data = (struct linear_priv *)plugin->extra_data;
154 data->conv = conv_index(src_format->format, dst_format->format); 154 data->conv = conv_index(src_format->format, dst_format->format);
155 plugin->transfer = linear_transfer; 155 plugin->transfer = linear_transfer;
156 *r_plugin = plugin; 156 *r_plugin = plugin;
diff --git a/sound/core/oss/mulaw.c b/sound/core/oss/mulaw.c
index 44ec4c66eb1..14f5578ec7a 100644
--- a/sound/core/oss/mulaw.c
+++ b/sound/core/oss/mulaw.c
@@ -139,25 +139,25 @@ static int ulaw2linear(unsigned char u_val)
139 * Basic Mu-Law plugin 139 * Basic Mu-Law plugin
140 */ 140 */
141 141
142typedef void (*mulaw_f)(snd_pcm_plugin_t *plugin, 142typedef void (*mulaw_f)(struct snd_pcm_plugin *plugin,
143 const snd_pcm_plugin_channel_t *src_channels, 143 const struct snd_pcm_plugin_channel *src_channels,
144 snd_pcm_plugin_channel_t *dst_channels, 144 struct snd_pcm_plugin_channel *dst_channels,
145 snd_pcm_uframes_t frames); 145 snd_pcm_uframes_t frames);
146 146
147typedef struct mulaw_private_data { 147struct mulaw_priv {
148 mulaw_f func; 148 mulaw_f func;
149 int conv; 149 int conv;
150} mulaw_t; 150};
151 151
152static void mulaw_decode(snd_pcm_plugin_t *plugin, 152static void mulaw_decode(struct snd_pcm_plugin *plugin,
153 const snd_pcm_plugin_channel_t *src_channels, 153 const struct snd_pcm_plugin_channel *src_channels,
154 snd_pcm_plugin_channel_t *dst_channels, 154 struct snd_pcm_plugin_channel *dst_channels,
155 snd_pcm_uframes_t frames) 155 snd_pcm_uframes_t frames)
156{ 156{
157#define PUT_S16_LABELS 157#define PUT_S16_LABELS
158#include "plugin_ops.h" 158#include "plugin_ops.h"
159#undef PUT_S16_LABELS 159#undef PUT_S16_LABELS
160 mulaw_t *data = (mulaw_t *)plugin->extra_data; 160 struct mulaw_priv *data = (struct mulaw_priv *)plugin->extra_data;
161 void *put = put_s16_labels[data->conv]; 161 void *put = put_s16_labels[data->conv];
162 int channel; 162 int channel;
163 int nchannels = plugin->src_format.channels; 163 int nchannels = plugin->src_format.channels;
@@ -191,15 +191,15 @@ static void mulaw_decode(snd_pcm_plugin_t *plugin,
191 } 191 }
192} 192}
193 193
194static void mulaw_encode(snd_pcm_plugin_t *plugin, 194static void mulaw_encode(struct snd_pcm_plugin *plugin,
195 const snd_pcm_plugin_channel_t *src_channels, 195 const struct snd_pcm_plugin_channel *src_channels,
196 snd_pcm_plugin_channel_t *dst_channels, 196 struct snd_pcm_plugin_channel *dst_channels,
197 snd_pcm_uframes_t frames) 197 snd_pcm_uframes_t frames)
198{ 198{
199#define GET_S16_LABELS 199#define GET_S16_LABELS
200#include "plugin_ops.h" 200#include "plugin_ops.h"
201#undef GET_S16_LABELS 201#undef GET_S16_LABELS
202 mulaw_t *data = (mulaw_t *)plugin->extra_data; 202 struct mulaw_priv *data = (struct mulaw_priv *)plugin->extra_data;
203 void *get = get_s16_labels[data->conv]; 203 void *get = get_s16_labels[data->conv];
204 int channel; 204 int channel;
205 int nchannels = plugin->src_format.channels; 205 int nchannels = plugin->src_format.channels;
@@ -234,12 +234,12 @@ static void mulaw_encode(snd_pcm_plugin_t *plugin,
234 } 234 }
235} 235}
236 236
237static snd_pcm_sframes_t mulaw_transfer(snd_pcm_plugin_t *plugin, 237static snd_pcm_sframes_t mulaw_transfer(struct snd_pcm_plugin *plugin,
238 const snd_pcm_plugin_channel_t *src_channels, 238 const struct snd_pcm_plugin_channel *src_channels,
239 snd_pcm_plugin_channel_t *dst_channels, 239 struct snd_pcm_plugin_channel *dst_channels,
240 snd_pcm_uframes_t frames) 240 snd_pcm_uframes_t frames)
241{ 241{
242 mulaw_t *data; 242 struct mulaw_priv *data;
243 243
244 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO); 244 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO);
245 if (frames == 0) 245 if (frames == 0)
@@ -257,20 +257,20 @@ static snd_pcm_sframes_t mulaw_transfer(snd_pcm_plugin_t *plugin,
257 } 257 }
258 } 258 }
259#endif 259#endif
260 data = (mulaw_t *)plugin->extra_data; 260 data = (struct mulaw_priv *)plugin->extra_data;
261 data->func(plugin, src_channels, dst_channels, frames); 261 data->func(plugin, src_channels, dst_channels, frames);
262 return frames; 262 return frames;
263} 263}
264 264
265int snd_pcm_plugin_build_mulaw(snd_pcm_plug_t *plug, 265int snd_pcm_plugin_build_mulaw(struct snd_pcm_substream *plug,
266 snd_pcm_plugin_format_t *src_format, 266 struct snd_pcm_plugin_format *src_format,
267 snd_pcm_plugin_format_t *dst_format, 267 struct snd_pcm_plugin_format *dst_format,
268 snd_pcm_plugin_t **r_plugin) 268 struct snd_pcm_plugin **r_plugin)
269{ 269{
270 int err; 270 int err;
271 mulaw_t *data; 271 struct mulaw_priv *data;
272 snd_pcm_plugin_t *plugin; 272 struct snd_pcm_plugin *plugin;
273 snd_pcm_plugin_format_t *format; 273 struct snd_pcm_plugin_format *format;
274 mulaw_f func; 274 mulaw_f func;
275 275
276 snd_assert(r_plugin != NULL, return -ENXIO); 276 snd_assert(r_plugin != NULL, return -ENXIO);
@@ -295,10 +295,10 @@ int snd_pcm_plugin_build_mulaw(snd_pcm_plug_t *plug,
295 295
296 err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion", 296 err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion",
297 src_format, dst_format, 297 src_format, dst_format,
298 sizeof(mulaw_t), &plugin); 298 sizeof(struct mulaw_priv), &plugin);
299 if (err < 0) 299 if (err < 0)
300 return err; 300 return err;
301 data = (mulaw_t*)plugin->extra_data; 301 data = (struct mulaw_priv *)plugin->extra_data;
302 data->func = func; 302 data->func = func;
303 data->conv = getput_index(format->format); 303 data->conv = getput_index(format->format);
304 snd_assert(data->conv >= 0 && data->conv < 4*2*2, return -EINVAL); 304 snd_assert(data->conv >= 0 && data->conv < 4*2*2, return -EINVAL);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index bcc97075913..ffc13b9194b 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -61,10 +61,10 @@ MODULE_PARM_DESC(nonblock_open, "Don't block opening busy PCM devices.");
61MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM); 61MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM);
62MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM1); 62MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM1);
63 63
64extern int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long arg); 64extern int snd_mixer_oss_ioctl_card(struct snd_card *card, unsigned int cmd, unsigned long arg);
65static int snd_pcm_oss_get_rate(snd_pcm_oss_file_t *pcm_oss_file); 65static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file);
66static int snd_pcm_oss_get_channels(snd_pcm_oss_file_t *pcm_oss_file); 66static int snd_pcm_oss_get_channels(struct snd_pcm_oss_file *pcm_oss_file);
67static int snd_pcm_oss_get_format(snd_pcm_oss_file_t *pcm_oss_file); 67static int snd_pcm_oss_get_format(struct snd_pcm_oss_file *pcm_oss_file);
68 68
69static inline mm_segment_t snd_enter_user(void) 69static inline mm_segment_t snd_enter_user(void)
70{ 70{
@@ -78,10 +78,10 @@ static inline void snd_leave_user(mm_segment_t fs)
78 set_fs(fs); 78 set_fs(fs);
79} 79}
80 80
81static int snd_pcm_oss_plugin_clear(snd_pcm_substream_t *substream) 81static int snd_pcm_oss_plugin_clear(struct snd_pcm_substream *substream)
82{ 82{
83 snd_pcm_runtime_t *runtime = substream->runtime; 83 struct snd_pcm_runtime *runtime = substream->runtime;
84 snd_pcm_plugin_t *plugin, *next; 84 struct snd_pcm_plugin *plugin, *next;
85 85
86 plugin = runtime->oss.plugin_first; 86 plugin = runtime->oss.plugin_first;
87 while (plugin) { 87 while (plugin) {
@@ -93,9 +93,9 @@ static int snd_pcm_oss_plugin_clear(snd_pcm_substream_t *substream)
93 return 0; 93 return 0;
94} 94}
95 95
96static int snd_pcm_plugin_insert(snd_pcm_plugin_t *plugin) 96static int snd_pcm_plugin_insert(struct snd_pcm_plugin *plugin)
97{ 97{
98 snd_pcm_runtime_t *runtime = plugin->plug->runtime; 98 struct snd_pcm_runtime *runtime = plugin->plug->runtime;
99 plugin->next = runtime->oss.plugin_first; 99 plugin->next = runtime->oss.plugin_first;
100 plugin->prev = NULL; 100 plugin->prev = NULL;
101 if (runtime->oss.plugin_first) { 101 if (runtime->oss.plugin_first) {
@@ -108,9 +108,9 @@ static int snd_pcm_plugin_insert(snd_pcm_plugin_t *plugin)
108 return 0; 108 return 0;
109} 109}
110 110
111int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin) 111int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin)
112{ 112{
113 snd_pcm_runtime_t *runtime = plugin->plug->runtime; 113 struct snd_pcm_runtime *runtime = plugin->plug->runtime;
114 plugin->next = NULL; 114 plugin->next = NULL;
115 plugin->prev = runtime->oss.plugin_last; 115 plugin->prev = runtime->oss.plugin_last;
116 if (runtime->oss.plugin_last) { 116 if (runtime->oss.plugin_last) {
@@ -123,9 +123,9 @@ int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin)
123 return 0; 123 return 0;
124} 124}
125 125
126static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames) 126static long snd_pcm_oss_bytes(struct snd_pcm_substream *substream, long frames)
127{ 127{
128 snd_pcm_runtime_t *runtime = substream->runtime; 128 struct snd_pcm_runtime *runtime = substream->runtime;
129 long buffer_size = snd_pcm_lib_buffer_bytes(substream); 129 long buffer_size = snd_pcm_lib_buffer_bytes(substream);
130 long bytes = frames_to_bytes(runtime, frames); 130 long bytes = frames_to_bytes(runtime, frames);
131 if (buffer_size == runtime->oss.buffer_bytes) 131 if (buffer_size == runtime->oss.buffer_bytes)
@@ -142,9 +142,9 @@ static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames)
142#endif 142#endif
143} 143}
144 144
145static long snd_pcm_alsa_frames(snd_pcm_substream_t *substream, long bytes) 145static long snd_pcm_alsa_frames(struct snd_pcm_substream *substream, long bytes)
146{ 146{
147 snd_pcm_runtime_t *runtime = substream->runtime; 147 struct snd_pcm_runtime *runtime = substream->runtime;
148 long buffer_size = snd_pcm_lib_buffer_bytes(substream); 148 long buffer_size = snd_pcm_lib_buffer_bytes(substream);
149 if (buffer_size == runtime->oss.buffer_bytes) 149 if (buffer_size == runtime->oss.buffer_bytes)
150 return bytes_to_frames(runtime, bytes); 150 return bytes_to_frames(runtime, bytes);
@@ -185,14 +185,14 @@ static int snd_pcm_oss_format_to(int format)
185 } 185 }
186} 186}
187 187
188static int snd_pcm_oss_period_size(snd_pcm_substream_t *substream, 188static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
189 snd_pcm_hw_params_t *oss_params, 189 struct snd_pcm_hw_params *oss_params,
190 snd_pcm_hw_params_t *slave_params) 190 struct snd_pcm_hw_params *slave_params)
191{ 191{
192 size_t s; 192 size_t s;
193 size_t oss_buffer_size, oss_period_size, oss_periods; 193 size_t oss_buffer_size, oss_period_size, oss_periods;
194 size_t min_period_size, max_period_size; 194 size_t min_period_size, max_period_size;
195 snd_pcm_runtime_t *runtime = substream->runtime; 195 struct snd_pcm_runtime *runtime = substream->runtime;
196 size_t oss_frame_size; 196 size_t oss_frame_size;
197 197
198 oss_frame_size = snd_pcm_format_physical_width(params_format(oss_params)) * 198 oss_frame_size = snd_pcm_format_physical_width(params_format(oss_params)) *
@@ -277,11 +277,11 @@ static int snd_pcm_oss_period_size(snd_pcm_substream_t *substream,
277 return 0; 277 return 0;
278} 278}
279 279
280static int choose_rate(snd_pcm_substream_t *substream, 280static int choose_rate(struct snd_pcm_substream *substream,
281 snd_pcm_hw_params_t *params, unsigned int best_rate) 281 struct snd_pcm_hw_params *params, unsigned int best_rate)
282{ 282{
283 snd_interval_t *it; 283 struct snd_interval *it;
284 snd_pcm_hw_params_t *save; 284 struct snd_pcm_hw_params *save;
285 unsigned int rate, prev; 285 unsigned int rate, prev;
286 286
287 save = kmalloc(sizeof(*save), GFP_KERNEL); 287 save = kmalloc(sizeof(*save), GFP_KERNEL);
@@ -317,18 +317,18 @@ static int choose_rate(snd_pcm_substream_t *substream,
317 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); 317 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL);
318} 318}
319 319
320static int snd_pcm_oss_change_params(snd_pcm_substream_t *substream) 320static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
321{ 321{
322 snd_pcm_runtime_t *runtime = substream->runtime; 322 struct snd_pcm_runtime *runtime = substream->runtime;
323 snd_pcm_hw_params_t *params, *sparams; 323 struct snd_pcm_hw_params *params, *sparams;
324 snd_pcm_sw_params_t *sw_params; 324 struct snd_pcm_sw_params *sw_params;
325 ssize_t oss_buffer_size, oss_period_size; 325 ssize_t oss_buffer_size, oss_period_size;
326 size_t oss_frame_size; 326 size_t oss_frame_size;
327 int err; 327 int err;
328 int direct; 328 int direct;
329 int format, sformat, n; 329 int format, sformat, n;
330 snd_mask_t sformat_mask; 330 struct snd_mask sformat_mask;
331 snd_mask_t mask; 331 struct snd_mask mask;
332 332
333 sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL); 333 sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL);
334 params = kmalloc(sizeof(*params), GFP_KERNEL); 334 params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -342,7 +342,7 @@ static int snd_pcm_oss_change_params(snd_pcm_substream_t *substream)
342 if (atomic_read(&runtime->mmap_count)) { 342 if (atomic_read(&runtime->mmap_count)) {
343 direct = 1; 343 direct = 1;
344 } else { 344 } else {
345 snd_pcm_oss_setup_t *setup = substream->oss.setup; 345 struct snd_pcm_oss_setup *setup = substream->oss.setup;
346 direct = (setup != NULL && setup->direct); 346 direct = (setup != NULL && setup->direct);
347 } 347 }
348 348
@@ -424,7 +424,7 @@ static int snd_pcm_oss_change_params(snd_pcm_substream_t *substream)
424 goto failure; 424 goto failure;
425 } 425 }
426 if (runtime->oss.plugin_first) { 426 if (runtime->oss.plugin_first) {
427 snd_pcm_plugin_t *plugin; 427 struct snd_pcm_plugin *plugin;
428 if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) { 428 if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) {
429 snd_printd("snd_pcm_plugin_build_io failed: %i\n", err); 429 snd_printd("snd_pcm_plugin_build_io failed: %i\n", err);
430 snd_pcm_oss_plugin_clear(substream); 430 snd_pcm_oss_plugin_clear(substream);
@@ -540,10 +540,10 @@ failure:
540 return err; 540 return err;
541} 541}
542 542
543static int snd_pcm_oss_get_active_substream(snd_pcm_oss_file_t *pcm_oss_file, snd_pcm_substream_t **r_substream) 543static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_file, struct snd_pcm_substream **r_substream)
544{ 544{
545 int idx, err; 545 int idx, err;
546 snd_pcm_substream_t *asubstream = NULL, *substream; 546 struct snd_pcm_substream *asubstream = NULL, *substream;
547 547
548 for (idx = 0; idx < 2; idx++) { 548 for (idx = 0; idx < 2; idx++) {
549 substream = pcm_oss_file->streams[idx]; 549 substream = pcm_oss_file->streams[idx];
@@ -563,10 +563,10 @@ static int snd_pcm_oss_get_active_substream(snd_pcm_oss_file_t *pcm_oss_file, sn
563 return 0; 563 return 0;
564} 564}
565 565
566static int snd_pcm_oss_prepare(snd_pcm_substream_t *substream) 566static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream)
567{ 567{
568 int err; 568 int err;
569 snd_pcm_runtime_t *runtime = substream->runtime; 569 struct snd_pcm_runtime *runtime = substream->runtime;
570 570
571 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); 571 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL);
572 if (err < 0) { 572 if (err < 0) {
@@ -581,9 +581,9 @@ static int snd_pcm_oss_prepare(snd_pcm_substream_t *substream)
581 return 0; 581 return 0;
582} 582}
583 583
584static int snd_pcm_oss_make_ready(snd_pcm_substream_t *substream) 584static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream)
585{ 585{
586 snd_pcm_runtime_t *runtime; 586 struct snd_pcm_runtime *runtime;
587 int err; 587 int err;
588 588
589 if (substream == NULL) 589 if (substream == NULL)
@@ -602,9 +602,9 @@ static int snd_pcm_oss_make_ready(snd_pcm_substream_t *substream)
602 return 0; 602 return 0;
603} 603}
604 604
605static int snd_pcm_oss_capture_position_fixup(snd_pcm_substream_t *substream, snd_pcm_sframes_t *delay) 605static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_t *delay)
606{ 606{
607 snd_pcm_runtime_t *runtime; 607 struct snd_pcm_runtime *runtime;
608 snd_pcm_uframes_t frames; 608 snd_pcm_uframes_t frames;
609 int err = 0; 609 int err = 0;
610 610
@@ -627,9 +627,9 @@ static int snd_pcm_oss_capture_position_fixup(snd_pcm_substream_t *substream, sn
627 return err; 627 return err;
628} 628}
629 629
630snd_pcm_sframes_t snd_pcm_oss_write3(snd_pcm_substream_t *substream, const char *ptr, snd_pcm_uframes_t frames, int in_kernel) 630snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_uframes_t frames, int in_kernel)
631{ 631{
632 snd_pcm_runtime_t *runtime = substream->runtime; 632 struct snd_pcm_runtime *runtime = substream->runtime;
633 int ret; 633 int ret;
634 while (1) { 634 while (1) {
635 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || 635 if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
@@ -662,9 +662,9 @@ snd_pcm_sframes_t snd_pcm_oss_write3(snd_pcm_substream_t *substream, const char
662 return ret; 662 return ret;
663} 663}
664 664
665snd_pcm_sframes_t snd_pcm_oss_read3(snd_pcm_substream_t *substream, char *ptr, snd_pcm_uframes_t frames, int in_kernel) 665snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes_t frames, int in_kernel)
666{ 666{
667 snd_pcm_runtime_t *runtime = substream->runtime; 667 struct snd_pcm_runtime *runtime = substream->runtime;
668 snd_pcm_sframes_t delay; 668 snd_pcm_sframes_t delay;
669 int ret; 669 int ret;
670 while (1) { 670 while (1) {
@@ -709,9 +709,9 @@ snd_pcm_sframes_t snd_pcm_oss_read3(snd_pcm_substream_t *substream, char *ptr, s
709 return ret; 709 return ret;
710} 710}
711 711
712snd_pcm_sframes_t snd_pcm_oss_writev3(snd_pcm_substream_t *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel) 712snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel)
713{ 713{
714 snd_pcm_runtime_t *runtime = substream->runtime; 714 struct snd_pcm_runtime *runtime = substream->runtime;
715 int ret; 715 int ret;
716 while (1) { 716 while (1) {
717 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || 717 if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
@@ -745,9 +745,9 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(snd_pcm_substream_t *substream, void **buf
745 return ret; 745 return ret;
746} 746}
747 747
748snd_pcm_sframes_t snd_pcm_oss_readv3(snd_pcm_substream_t *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel) 748snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel)
749{ 749{
750 snd_pcm_runtime_t *runtime = substream->runtime; 750 struct snd_pcm_runtime *runtime = substream->runtime;
751 int ret; 751 int ret;
752 while (1) { 752 while (1) {
753 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || 753 if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
@@ -780,12 +780,12 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(snd_pcm_substream_t *substream, void **bufs
780 return ret; 780 return ret;
781} 781}
782 782
783static ssize_t snd_pcm_oss_write2(snd_pcm_substream_t *substream, const char *buf, size_t bytes, int in_kernel) 783static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t bytes, int in_kernel)
784{ 784{
785 snd_pcm_runtime_t *runtime = substream->runtime; 785 struct snd_pcm_runtime *runtime = substream->runtime;
786 snd_pcm_sframes_t frames, frames1; 786 snd_pcm_sframes_t frames, frames1;
787 if (runtime->oss.plugin_first) { 787 if (runtime->oss.plugin_first) {
788 snd_pcm_plugin_channel_t *channels; 788 struct snd_pcm_plugin_channel *channels;
789 size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8; 789 size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8;
790 if (!in_kernel) { 790 if (!in_kernel) {
791 if (copy_from_user(runtime->oss.buffer, (const char __user *)buf, bytes)) 791 if (copy_from_user(runtime->oss.buffer, (const char __user *)buf, bytes))
@@ -810,11 +810,11 @@ static ssize_t snd_pcm_oss_write2(snd_pcm_substream_t *substream, const char *bu
810 return bytes; 810 return bytes;
811} 811}
812 812
813static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __user *buf, size_t bytes) 813static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size_t bytes)
814{ 814{
815 size_t xfer = 0; 815 size_t xfer = 0;
816 ssize_t tmp; 816 ssize_t tmp;
817 snd_pcm_runtime_t *runtime = substream->runtime; 817 struct snd_pcm_runtime *runtime = substream->runtime;
818 818
819 if (atomic_read(&runtime->mmap_count)) 819 if (atomic_read(&runtime->mmap_count))
820 return -ENXIO; 820 return -ENXIO;
@@ -867,13 +867,13 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __u
867 return xfer; 867 return xfer;
868} 868}
869 869
870static ssize_t snd_pcm_oss_read2(snd_pcm_substream_t *substream, char *buf, size_t bytes, int in_kernel) 870static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int in_kernel)
871{ 871{
872 snd_pcm_runtime_t *runtime = substream->runtime; 872 struct snd_pcm_runtime *runtime = substream->runtime;
873 snd_pcm_sframes_t frames, frames1; 873 snd_pcm_sframes_t frames, frames1;
874 char __user *final_dst = (char __user *)buf; 874 char __user *final_dst = (char __user *)buf;
875 if (runtime->oss.plugin_first) { 875 if (runtime->oss.plugin_first) {
876 snd_pcm_plugin_channel_t *channels; 876 struct snd_pcm_plugin_channel *channels;
877 size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_format.channels) / 8; 877 size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_format.channels) / 8;
878 if (!in_kernel) 878 if (!in_kernel)
879 buf = runtime->oss.buffer; 879 buf = runtime->oss.buffer;
@@ -897,11 +897,11 @@ static ssize_t snd_pcm_oss_read2(snd_pcm_substream_t *substream, char *buf, size
897 return bytes; 897 return bytes;
898} 898}
899 899
900static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *buf, size_t bytes) 900static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t bytes)
901{ 901{
902 size_t xfer = 0; 902 size_t xfer = 0;
903 ssize_t tmp; 903 ssize_t tmp;
904 snd_pcm_runtime_t *runtime = substream->runtime; 904 struct snd_pcm_runtime *runtime = substream->runtime;
905 905
906 if (atomic_read(&runtime->mmap_count)) 906 if (atomic_read(&runtime->mmap_count))
907 return -ENXIO; 907 return -ENXIO;
@@ -941,9 +941,9 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu
941 return xfer; 941 return xfer;
942} 942}
943 943
944static int snd_pcm_oss_reset(snd_pcm_oss_file_t *pcm_oss_file) 944static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
945{ 945{
946 snd_pcm_substream_t *substream; 946 struct snd_pcm_substream *substream;
947 947
948 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 948 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
949 if (substream != NULL) { 949 if (substream != NULL) {
@@ -958,9 +958,9 @@ static int snd_pcm_oss_reset(snd_pcm_oss_file_t *pcm_oss_file)
958 return 0; 958 return 0;
959} 959}
960 960
961static int snd_pcm_oss_post(snd_pcm_oss_file_t *pcm_oss_file) 961static int snd_pcm_oss_post(struct snd_pcm_oss_file *pcm_oss_file)
962{ 962{
963 snd_pcm_substream_t *substream; 963 struct snd_pcm_substream *substream;
964 int err; 964 int err;
965 965
966 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 966 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -974,9 +974,9 @@ static int snd_pcm_oss_post(snd_pcm_oss_file_t *pcm_oss_file)
974 return 0; 974 return 0;
975} 975}
976 976
977static int snd_pcm_oss_sync1(snd_pcm_substream_t *substream, size_t size) 977static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
978{ 978{
979 snd_pcm_runtime_t *runtime; 979 struct snd_pcm_runtime *runtime;
980 ssize_t result = 0; 980 ssize_t result = 0;
981 long res; 981 long res;
982 wait_queue_t wait; 982 wait_queue_t wait;
@@ -1020,12 +1020,12 @@ static int snd_pcm_oss_sync1(snd_pcm_substream_t *substream, size_t size)
1020 return result; 1020 return result;
1021} 1021}
1022 1022
1023static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file) 1023static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
1024{ 1024{
1025 int err = 0; 1025 int err = 0;
1026 unsigned int saved_f_flags; 1026 unsigned int saved_f_flags;
1027 snd_pcm_substream_t *substream; 1027 struct snd_pcm_substream *substream;
1028 snd_pcm_runtime_t *runtime; 1028 struct snd_pcm_runtime *runtime;
1029 snd_pcm_format_t format; 1029 snd_pcm_format_t format;
1030 unsigned long width; 1030 unsigned long width;
1031 size_t size; 1031 size_t size;
@@ -1117,13 +1117,13 @@ static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file)
1117 return 0; 1117 return 0;
1118} 1118}
1119 1119
1120static int snd_pcm_oss_set_rate(snd_pcm_oss_file_t *pcm_oss_file, int rate) 1120static int snd_pcm_oss_set_rate(struct snd_pcm_oss_file *pcm_oss_file, int rate)
1121{ 1121{
1122 int idx; 1122 int idx;
1123 1123
1124 for (idx = 1; idx >= 0; --idx) { 1124 for (idx = 1; idx >= 0; --idx) {
1125 snd_pcm_substream_t *substream = pcm_oss_file->streams[idx]; 1125 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
1126 snd_pcm_runtime_t *runtime; 1126 struct snd_pcm_runtime *runtime;
1127 if (substream == NULL) 1127 if (substream == NULL)
1128 continue; 1128 continue;
1129 runtime = substream->runtime; 1129 runtime = substream->runtime;
@@ -1139,9 +1139,9 @@ static int snd_pcm_oss_set_rate(snd_pcm_oss_file_t *pcm_oss_file, int rate)
1139 return snd_pcm_oss_get_rate(pcm_oss_file); 1139 return snd_pcm_oss_get_rate(pcm_oss_file);
1140} 1140}
1141 1141
1142static int snd_pcm_oss_get_rate(snd_pcm_oss_file_t *pcm_oss_file) 1142static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file)
1143{ 1143{
1144 snd_pcm_substream_t *substream; 1144 struct snd_pcm_substream *substream;
1145 int err; 1145 int err;
1146 1146
1147 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) 1147 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0)
@@ -1149,7 +1149,7 @@ static int snd_pcm_oss_get_rate(snd_pcm_oss_file_t *pcm_oss_file)
1149 return substream->runtime->oss.rate; 1149 return substream->runtime->oss.rate;
1150} 1150}
1151 1151
1152static int snd_pcm_oss_set_channels(snd_pcm_oss_file_t *pcm_oss_file, unsigned int channels) 1152static int snd_pcm_oss_set_channels(struct snd_pcm_oss_file *pcm_oss_file, unsigned int channels)
1153{ 1153{
1154 int idx; 1154 int idx;
1155 if (channels < 1) 1155 if (channels < 1)
@@ -1157,8 +1157,8 @@ static int snd_pcm_oss_set_channels(snd_pcm_oss_file_t *pcm_oss_file, unsigned i
1157 if (channels > 128) 1157 if (channels > 128)
1158 return -EINVAL; 1158 return -EINVAL;
1159 for (idx = 1; idx >= 0; --idx) { 1159 for (idx = 1; idx >= 0; --idx) {
1160 snd_pcm_substream_t *substream = pcm_oss_file->streams[idx]; 1160 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
1161 snd_pcm_runtime_t *runtime; 1161 struct snd_pcm_runtime *runtime;
1162 if (substream == NULL) 1162 if (substream == NULL)
1163 continue; 1163 continue;
1164 runtime = substream->runtime; 1164 runtime = substream->runtime;
@@ -1170,9 +1170,9 @@ static int snd_pcm_oss_set_channels(snd_pcm_oss_file_t *pcm_oss_file, unsigned i
1170 return snd_pcm_oss_get_channels(pcm_oss_file); 1170 return snd_pcm_oss_get_channels(pcm_oss_file);
1171} 1171}
1172 1172
1173static int snd_pcm_oss_get_channels(snd_pcm_oss_file_t *pcm_oss_file) 1173static int snd_pcm_oss_get_channels(struct snd_pcm_oss_file *pcm_oss_file)
1174{ 1174{
1175 snd_pcm_substream_t *substream; 1175 struct snd_pcm_substream *substream;
1176 int err; 1176 int err;
1177 1177
1178 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) 1178 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0)
@@ -1180,9 +1180,9 @@ static int snd_pcm_oss_get_channels(snd_pcm_oss_file_t *pcm_oss_file)
1180 return substream->runtime->oss.channels; 1180 return substream->runtime->oss.channels;
1181} 1181}
1182 1182
1183static int snd_pcm_oss_get_block_size(snd_pcm_oss_file_t *pcm_oss_file) 1183static int snd_pcm_oss_get_block_size(struct snd_pcm_oss_file *pcm_oss_file)
1184{ 1184{
1185 snd_pcm_substream_t *substream; 1185 struct snd_pcm_substream *substream;
1186 int err; 1186 int err;
1187 1187
1188 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) 1188 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0)
@@ -1190,14 +1190,14 @@ static int snd_pcm_oss_get_block_size(snd_pcm_oss_file_t *pcm_oss_file)
1190 return substream->runtime->oss.period_bytes; 1190 return substream->runtime->oss.period_bytes;
1191} 1191}
1192 1192
1193static int snd_pcm_oss_get_formats(snd_pcm_oss_file_t *pcm_oss_file) 1193static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
1194{ 1194{
1195 snd_pcm_substream_t *substream; 1195 struct snd_pcm_substream *substream;
1196 int err; 1196 int err;
1197 int direct; 1197 int direct;
1198 snd_pcm_hw_params_t *params; 1198 struct snd_pcm_hw_params *params;
1199 unsigned int formats = 0; 1199 unsigned int formats = 0;
1200 snd_mask_t format_mask; 1200 struct snd_mask format_mask;
1201 int fmt; 1201 int fmt;
1202 1202
1203 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) 1203 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0)
@@ -1205,7 +1205,7 @@ static int snd_pcm_oss_get_formats(snd_pcm_oss_file_t *pcm_oss_file)
1205 if (atomic_read(&substream->runtime->mmap_count)) { 1205 if (atomic_read(&substream->runtime->mmap_count)) {
1206 direct = 1; 1206 direct = 1;
1207 } else { 1207 } else {
1208 snd_pcm_oss_setup_t *setup = substream->oss.setup; 1208 struct snd_pcm_oss_setup *setup = substream->oss.setup;
1209 direct = (setup != NULL && setup->direct); 1209 direct = (setup != NULL && setup->direct);
1210 } 1210 }
1211 if (!direct) 1211 if (!direct)
@@ -1231,7 +1231,7 @@ static int snd_pcm_oss_get_formats(snd_pcm_oss_file_t *pcm_oss_file)
1231 return formats; 1231 return formats;
1232} 1232}
1233 1233
1234static int snd_pcm_oss_set_format(snd_pcm_oss_file_t *pcm_oss_file, int format) 1234static int snd_pcm_oss_set_format(struct snd_pcm_oss_file *pcm_oss_file, int format)
1235{ 1235{
1236 int formats, idx; 1236 int formats, idx;
1237 1237
@@ -1240,8 +1240,8 @@ static int snd_pcm_oss_set_format(snd_pcm_oss_file_t *pcm_oss_file, int format)
1240 if (!(formats & format)) 1240 if (!(formats & format))
1241 format = AFMT_U8; 1241 format = AFMT_U8;
1242 for (idx = 1; idx >= 0; --idx) { 1242 for (idx = 1; idx >= 0; --idx) {
1243 snd_pcm_substream_t *substream = pcm_oss_file->streams[idx]; 1243 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
1244 snd_pcm_runtime_t *runtime; 1244 struct snd_pcm_runtime *runtime;
1245 if (substream == NULL) 1245 if (substream == NULL)
1246 continue; 1246 continue;
1247 runtime = substream->runtime; 1247 runtime = substream->runtime;
@@ -1254,9 +1254,9 @@ static int snd_pcm_oss_set_format(snd_pcm_oss_file_t *pcm_oss_file, int format)
1254 return snd_pcm_oss_get_format(pcm_oss_file); 1254 return snd_pcm_oss_get_format(pcm_oss_file);
1255} 1255}
1256 1256
1257static int snd_pcm_oss_get_format(snd_pcm_oss_file_t *pcm_oss_file) 1257static int snd_pcm_oss_get_format(struct snd_pcm_oss_file *pcm_oss_file)
1258{ 1258{
1259 snd_pcm_substream_t *substream; 1259 struct snd_pcm_substream *substream;
1260 int err; 1260 int err;
1261 1261
1262 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) 1262 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0)
@@ -1264,9 +1264,9 @@ static int snd_pcm_oss_get_format(snd_pcm_oss_file_t *pcm_oss_file)
1264 return substream->runtime->oss.format; 1264 return substream->runtime->oss.format;
1265} 1265}
1266 1266
1267static int snd_pcm_oss_set_subdivide1(snd_pcm_substream_t *substream, int subdivide) 1267static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide)
1268{ 1268{
1269 snd_pcm_runtime_t *runtime; 1269 struct snd_pcm_runtime *runtime;
1270 1270
1271 if (substream == NULL) 1271 if (substream == NULL)
1272 return 0; 1272 return 0;
@@ -1287,12 +1287,12 @@ static int snd_pcm_oss_set_subdivide1(snd_pcm_substream_t *substream, int subdiv
1287 return subdivide; 1287 return subdivide;
1288} 1288}
1289 1289
1290static int snd_pcm_oss_set_subdivide(snd_pcm_oss_file_t *pcm_oss_file, int subdivide) 1290static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int subdivide)
1291{ 1291{
1292 int err = -EINVAL, idx; 1292 int err = -EINVAL, idx;
1293 1293
1294 for (idx = 1; idx >= 0; --idx) { 1294 for (idx = 1; idx >= 0; --idx) {
1295 snd_pcm_substream_t *substream = pcm_oss_file->streams[idx]; 1295 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
1296 if (substream == NULL) 1296 if (substream == NULL)
1297 continue; 1297 continue;
1298 if ((err = snd_pcm_oss_set_subdivide1(substream, subdivide)) < 0) 1298 if ((err = snd_pcm_oss_set_subdivide1(substream, subdivide)) < 0)
@@ -1301,9 +1301,9 @@ static int snd_pcm_oss_set_subdivide(snd_pcm_oss_file_t *pcm_oss_file, int subdi
1301 return err; 1301 return err;
1302} 1302}
1303 1303
1304static int snd_pcm_oss_set_fragment1(snd_pcm_substream_t *substream, unsigned int val) 1304static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val)
1305{ 1305{
1306 snd_pcm_runtime_t *runtime; 1306 struct snd_pcm_runtime *runtime;
1307 1307
1308 if (substream == NULL) 1308 if (substream == NULL)
1309 return 0; 1309 return 0;
@@ -1320,12 +1320,12 @@ static int snd_pcm_oss_set_fragment1(snd_pcm_substream_t *substream, unsigned in
1320 return 0; 1320 return 0;
1321} 1321}
1322 1322
1323static int snd_pcm_oss_set_fragment(snd_pcm_oss_file_t *pcm_oss_file, unsigned int val) 1323static int snd_pcm_oss_set_fragment(struct snd_pcm_oss_file *pcm_oss_file, unsigned int val)
1324{ 1324{
1325 int err = -EINVAL, idx; 1325 int err = -EINVAL, idx;
1326 1326
1327 for (idx = 1; idx >= 0; --idx) { 1327 for (idx = 1; idx >= 0; --idx) {
1328 snd_pcm_substream_t *substream = pcm_oss_file->streams[idx]; 1328 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
1329 if (substream == NULL) 1329 if (substream == NULL)
1330 continue; 1330 continue;
1331 if ((err = snd_pcm_oss_set_fragment1(substream, val)) < 0) 1331 if ((err = snd_pcm_oss_set_fragment1(substream, val)) < 0)
@@ -1340,7 +1340,7 @@ static int snd_pcm_oss_nonblock(struct file * file)
1340 return 0; 1340 return 0;
1341} 1341}
1342 1342
1343static int snd_pcm_oss_get_caps1(snd_pcm_substream_t *substream, int res) 1343static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res)
1344{ 1344{
1345 1345
1346 if (substream == NULL) { 1346 if (substream == NULL) {
@@ -1356,7 +1356,7 @@ static int snd_pcm_oss_get_caps1(snd_pcm_substream_t *substream, int res)
1356 /* all ALSA drivers can return actual pointer in ring buffer */ 1356 /* all ALSA drivers can return actual pointer in ring buffer */
1357#if defined(DSP_CAP_REALTIME) && 0 1357#if defined(DSP_CAP_REALTIME) && 0
1358 { 1358 {
1359 snd_pcm_runtime_t *runtime = substream->runtime; 1359 struct snd_pcm_runtime *runtime = substream->runtime;
1360 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) 1360 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH))
1361 res &= ~DSP_CAP_REALTIME; 1361 res &= ~DSP_CAP_REALTIME;
1362 } 1362 }
@@ -1364,32 +1364,32 @@ static int snd_pcm_oss_get_caps1(snd_pcm_substream_t *substream, int res)
1364 return res; 1364 return res;
1365} 1365}
1366 1366
1367static int snd_pcm_oss_get_caps(snd_pcm_oss_file_t *pcm_oss_file) 1367static int snd_pcm_oss_get_caps(struct snd_pcm_oss_file *pcm_oss_file)
1368{ 1368{
1369 int result, idx; 1369 int result, idx;
1370 1370
1371 result = DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_DUPLEX | DSP_CAP_REALTIME; 1371 result = DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_DUPLEX | DSP_CAP_REALTIME;
1372 for (idx = 0; idx < 2; idx++) { 1372 for (idx = 0; idx < 2; idx++) {
1373 snd_pcm_substream_t *substream = pcm_oss_file->streams[idx]; 1373 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
1374 result = snd_pcm_oss_get_caps1(substream, result); 1374 result = snd_pcm_oss_get_caps1(substream, result);
1375 } 1375 }
1376 result |= 0x0001; /* revision - same as SB AWE 64 */ 1376 result |= 0x0001; /* revision - same as SB AWE 64 */
1377 return result; 1377 return result;
1378} 1378}
1379 1379
1380static void snd_pcm_oss_simulate_fill(snd_pcm_substream_t *substream, snd_pcm_uframes_t hw_ptr) 1380static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, snd_pcm_uframes_t hw_ptr)
1381{ 1381{
1382 snd_pcm_runtime_t *runtime = substream->runtime; 1382 struct snd_pcm_runtime *runtime = substream->runtime;
1383 snd_pcm_uframes_t appl_ptr; 1383 snd_pcm_uframes_t appl_ptr;
1384 appl_ptr = hw_ptr + runtime->buffer_size; 1384 appl_ptr = hw_ptr + runtime->buffer_size;
1385 appl_ptr %= runtime->boundary; 1385 appl_ptr %= runtime->boundary;
1386 runtime->control->appl_ptr = appl_ptr; 1386 runtime->control->appl_ptr = appl_ptr;
1387} 1387}
1388 1388
1389static int snd_pcm_oss_set_trigger(snd_pcm_oss_file_t *pcm_oss_file, int trigger) 1389static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int trigger)
1390{ 1390{
1391 snd_pcm_runtime_t *runtime; 1391 struct snd_pcm_runtime *runtime;
1392 snd_pcm_substream_t *psubstream = NULL, *csubstream = NULL; 1392 struct snd_pcm_substream *psubstream = NULL, *csubstream = NULL;
1393 int err, cmd; 1393 int err, cmd;
1394 1394
1395#ifdef OSS_DEBUG 1395#ifdef OSS_DEBUG
@@ -1454,9 +1454,9 @@ static int snd_pcm_oss_set_trigger(snd_pcm_oss_file_t *pcm_oss_file, int trigger
1454 return 0; 1454 return 0;
1455} 1455}
1456 1456
1457static int snd_pcm_oss_get_trigger(snd_pcm_oss_file_t *pcm_oss_file) 1457static int snd_pcm_oss_get_trigger(struct snd_pcm_oss_file *pcm_oss_file)
1458{ 1458{
1459 snd_pcm_substream_t *psubstream = NULL, *csubstream = NULL; 1459 struct snd_pcm_substream *psubstream = NULL, *csubstream = NULL;
1460 int result = 0; 1460 int result = 0;
1461 1461
1462 psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 1462 psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -1468,10 +1468,10 @@ static int snd_pcm_oss_get_trigger(snd_pcm_oss_file_t *pcm_oss_file)
1468 return result; 1468 return result;
1469} 1469}
1470 1470
1471static int snd_pcm_oss_get_odelay(snd_pcm_oss_file_t *pcm_oss_file) 1471static int snd_pcm_oss_get_odelay(struct snd_pcm_oss_file *pcm_oss_file)
1472{ 1472{
1473 snd_pcm_substream_t *substream; 1473 struct snd_pcm_substream *substream;
1474 snd_pcm_runtime_t *runtime; 1474 struct snd_pcm_runtime *runtime;
1475 snd_pcm_sframes_t delay; 1475 snd_pcm_sframes_t delay;
1476 int err; 1476 int err;
1477 1477
@@ -1491,10 +1491,10 @@ static int snd_pcm_oss_get_odelay(snd_pcm_oss_file_t *pcm_oss_file)
1491 return snd_pcm_oss_bytes(substream, delay); 1491 return snd_pcm_oss_bytes(substream, delay);
1492} 1492}
1493 1493
1494static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info __user * _info) 1494static int snd_pcm_oss_get_ptr(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct count_info __user * _info)
1495{ 1495{
1496 snd_pcm_substream_t *substream; 1496 struct snd_pcm_substream *substream;
1497 snd_pcm_runtime_t *runtime; 1497 struct snd_pcm_runtime *runtime;
1498 snd_pcm_sframes_t delay; 1498 snd_pcm_sframes_t delay;
1499 int fixup; 1499 int fixup;
1500 struct count_info info; 1500 struct count_info info;
@@ -1543,7 +1543,7 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str
1543 } else { 1543 } else {
1544 delay = snd_pcm_oss_bytes(substream, delay); 1544 delay = snd_pcm_oss_bytes(substream, delay);
1545 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1545 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
1546 snd_pcm_oss_setup_t *setup = substream->oss.setup; 1546 struct snd_pcm_oss_setup *setup = substream->oss.setup;
1547 if (setup && setup->buggyptr) 1547 if (setup && setup->buggyptr)
1548 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; 1548 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
1549 else 1549 else
@@ -1560,10 +1560,10 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str
1560 return 0; 1560 return 0;
1561} 1561}
1562 1562
1563static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info __user *_info) 1563static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct audio_buf_info __user *_info)
1564{ 1564{
1565 snd_pcm_substream_t *substream; 1565 struct snd_pcm_substream *substream;
1566 snd_pcm_runtime_t *runtime; 1566 struct snd_pcm_runtime *runtime;
1567 snd_pcm_sframes_t avail; 1567 snd_pcm_sframes_t avail;
1568 int fixup; 1568 int fixup;
1569 struct audio_buf_info info; 1569 struct audio_buf_info info;
@@ -1619,17 +1619,17 @@ static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, s
1619 return 0; 1619 return 0;
1620} 1620}
1621 1621
1622static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc __user * _info) 1622static int snd_pcm_oss_get_mapbuf(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct buffmem_desc __user * _info)
1623{ 1623{
1624 // it won't be probably implemented 1624 // it won't be probably implemented
1625 // snd_printd("TODO: snd_pcm_oss_get_mapbuf\n"); 1625 // snd_printd("TODO: snd_pcm_oss_get_mapbuf\n");
1626 return -EINVAL; 1626 return -EINVAL;
1627} 1627}
1628 1628
1629static snd_pcm_oss_setup_t *snd_pcm_oss_look_for_setup(snd_pcm_t *pcm, int stream, const char *task_name) 1629static struct snd_pcm_oss_setup *snd_pcm_oss_look_for_setup(struct snd_pcm *pcm, int stream, const char *task_name)
1630{ 1630{
1631 const char *ptr, *ptrl; 1631 const char *ptr, *ptrl;
1632 snd_pcm_oss_setup_t *setup; 1632 struct snd_pcm_oss_setup *setup;
1633 1633
1634 down(&pcm->streams[stream].oss.setup_mutex); 1634 down(&pcm->streams[stream].oss.setup_mutex);
1635 for (setup = pcm->streams[stream].oss.setup_list; setup; setup = setup->next) { 1635 for (setup = pcm->streams[stream].oss.setup_list; setup; setup = setup->next) {
@@ -1659,11 +1659,11 @@ static snd_pcm_oss_setup_t *snd_pcm_oss_look_for_setup(snd_pcm_t *pcm, int strea
1659 return NULL; 1659 return NULL;
1660} 1660}
1661 1661
1662static void snd_pcm_oss_init_substream(snd_pcm_substream_t *substream, 1662static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream,
1663 snd_pcm_oss_setup_t *setup, 1663 struct snd_pcm_oss_setup *setup,
1664 int minor) 1664 int minor)
1665{ 1665{
1666 snd_pcm_runtime_t *runtime; 1666 struct snd_pcm_runtime *runtime;
1667 1667
1668 substream->oss.oss = 1; 1668 substream->oss.oss = 1;
1669 substream->oss.setup = setup; 1669 substream->oss.setup = setup;
@@ -1687,9 +1687,9 @@ static void snd_pcm_oss_init_substream(snd_pcm_substream_t *substream,
1687 runtime->oss.subdivision = 0; 1687 runtime->oss.subdivision = 0;
1688} 1688}
1689 1689
1690static void snd_pcm_oss_release_substream(snd_pcm_substream_t *substream) 1690static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream)
1691{ 1691{
1692 snd_pcm_runtime_t *runtime; 1692 struct snd_pcm_runtime *runtime;
1693 runtime = substream->runtime; 1693 runtime = substream->runtime;
1694 vfree(runtime->oss.buffer); 1694 vfree(runtime->oss.buffer);
1695 snd_pcm_oss_plugin_clear(substream); 1695 snd_pcm_oss_plugin_clear(substream);
@@ -1697,13 +1697,13 @@ static void snd_pcm_oss_release_substream(snd_pcm_substream_t *substream)
1697 substream->oss.oss = 0; 1697 substream->oss.oss = 0;
1698} 1698}
1699 1699
1700static int snd_pcm_oss_release_file(snd_pcm_oss_file_t *pcm_oss_file) 1700static int snd_pcm_oss_release_file(struct snd_pcm_oss_file *pcm_oss_file)
1701{ 1701{
1702 int cidx; 1702 int cidx;
1703 snd_assert(pcm_oss_file != NULL, return -ENXIO); 1703 snd_assert(pcm_oss_file != NULL, return -ENXIO);
1704 for (cidx = 0; cidx < 2; ++cidx) { 1704 for (cidx = 0; cidx < 2; ++cidx) {
1705 snd_pcm_substream_t *substream = pcm_oss_file->streams[cidx]; 1705 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
1706 snd_pcm_runtime_t *runtime; 1706 struct snd_pcm_runtime *runtime;
1707 if (substream == NULL) 1707 if (substream == NULL)
1708 continue; 1708 continue;
1709 runtime = substream->runtime; 1709 runtime = substream->runtime;
@@ -1726,15 +1726,15 @@ static int snd_pcm_oss_release_file(snd_pcm_oss_file_t *pcm_oss_file)
1726} 1726}
1727 1727
1728static int snd_pcm_oss_open_file(struct file *file, 1728static int snd_pcm_oss_open_file(struct file *file,
1729 snd_pcm_t *pcm, 1729 struct snd_pcm *pcm,
1730 snd_pcm_oss_file_t **rpcm_oss_file, 1730 struct snd_pcm_oss_file **rpcm_oss_file,
1731 int minor, 1731 int minor,
1732 snd_pcm_oss_setup_t *psetup, 1732 struct snd_pcm_oss_setup *psetup,
1733 snd_pcm_oss_setup_t *csetup) 1733 struct snd_pcm_oss_setup *csetup)
1734{ 1734{
1735 int err = 0; 1735 int err = 0;
1736 snd_pcm_oss_file_t *pcm_oss_file; 1736 struct snd_pcm_oss_file *pcm_oss_file;
1737 snd_pcm_substream_t *psubstream = NULL, *csubstream = NULL; 1737 struct snd_pcm_substream *psubstream = NULL, *csubstream = NULL;
1738 unsigned int f_mode = file->f_mode; 1738 unsigned int f_mode = file->f_mode;
1739 1739
1740 snd_assert(rpcm_oss_file != NULL, return -EINVAL); 1740 snd_assert(rpcm_oss_file != NULL, return -EINVAL);
@@ -1839,9 +1839,9 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
1839 int device; 1839 int device;
1840 int err; 1840 int err;
1841 char task_name[32]; 1841 char task_name[32];
1842 snd_pcm_t *pcm; 1842 struct snd_pcm *pcm;
1843 snd_pcm_oss_file_t *pcm_oss_file; 1843 struct snd_pcm_oss_file *pcm_oss_file;
1844 snd_pcm_oss_setup_t *psetup = NULL, *csetup = NULL; 1844 struct snd_pcm_oss_setup *psetup = NULL, *csetup = NULL;
1845 int nonblock; 1845 int nonblock;
1846 wait_queue_t wait; 1846 wait_queue_t wait;
1847 1847
@@ -1925,9 +1925,9 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
1925 1925
1926static int snd_pcm_oss_release(struct inode *inode, struct file *file) 1926static int snd_pcm_oss_release(struct inode *inode, struct file *file)
1927{ 1927{
1928 snd_pcm_t *pcm; 1928 struct snd_pcm *pcm;
1929 snd_pcm_substream_t *substream; 1929 struct snd_pcm_substream *substream;
1930 snd_pcm_oss_file_t *pcm_oss_file; 1930 struct snd_pcm_oss_file *pcm_oss_file;
1931 1931
1932 pcm_oss_file = file->private_data; 1932 pcm_oss_file = file->private_data;
1933 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 1933 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -1947,7 +1947,7 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file)
1947 1947
1948static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1948static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1949{ 1949{
1950 snd_pcm_oss_file_t *pcm_oss_file; 1950 struct snd_pcm_oss_file *pcm_oss_file;
1951 int __user *p = (int __user *)arg; 1951 int __user *p = (int __user *)arg;
1952 int res; 1952 int res;
1953 1953
@@ -1958,7 +1958,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
1958 return put_user(1, p); 1958 return put_user(1, p);
1959#if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE)) 1959#if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE))
1960 if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */ 1960 if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */
1961 snd_pcm_substream_t *substream; 1961 struct snd_pcm_substream *substream;
1962 int idx; 1962 int idx;
1963 for (idx = 0; idx < 2; ++idx) { 1963 for (idx = 0; idx < 2; ++idx) {
1964 substream = pcm_oss_file->streams[idx]; 1964 substream = pcm_oss_file->streams[idx];
@@ -2113,8 +2113,8 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
2113 2113
2114static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset) 2114static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
2115{ 2115{
2116 snd_pcm_oss_file_t *pcm_oss_file; 2116 struct snd_pcm_oss_file *pcm_oss_file;
2117 snd_pcm_substream_t *substream; 2117 struct snd_pcm_substream *substream;
2118 2118
2119 pcm_oss_file = file->private_data; 2119 pcm_oss_file = file->private_data;
2120 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; 2120 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
@@ -2133,8 +2133,8 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun
2133 2133
2134static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) 2134static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
2135{ 2135{
2136 snd_pcm_oss_file_t *pcm_oss_file; 2136 struct snd_pcm_oss_file *pcm_oss_file;
2137 snd_pcm_substream_t *substream; 2137 struct snd_pcm_substream *substream;
2138 long result; 2138 long result;
2139 2139
2140 pcm_oss_file = file->private_data; 2140 pcm_oss_file = file->private_data;
@@ -2150,18 +2150,18 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size
2150 return result; 2150 return result;
2151} 2151}
2152 2152
2153static int snd_pcm_oss_playback_ready(snd_pcm_substream_t *substream) 2153static int snd_pcm_oss_playback_ready(struct snd_pcm_substream *substream)
2154{ 2154{
2155 snd_pcm_runtime_t *runtime = substream->runtime; 2155 struct snd_pcm_runtime *runtime = substream->runtime;
2156 if (atomic_read(&runtime->mmap_count)) 2156 if (atomic_read(&runtime->mmap_count))
2157 return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt; 2157 return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt;
2158 else 2158 else
2159 return snd_pcm_playback_avail(runtime) >= runtime->oss.period_frames; 2159 return snd_pcm_playback_avail(runtime) >= runtime->oss.period_frames;
2160} 2160}
2161 2161
2162static int snd_pcm_oss_capture_ready(snd_pcm_substream_t *substream) 2162static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream)
2163{ 2163{
2164 snd_pcm_runtime_t *runtime = substream->runtime; 2164 struct snd_pcm_runtime *runtime = substream->runtime;
2165 if (atomic_read(&runtime->mmap_count)) 2165 if (atomic_read(&runtime->mmap_count))
2166 return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt; 2166 return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt;
2167 else 2167 else
@@ -2170,9 +2170,9 @@ static int snd_pcm_oss_capture_ready(snd_pcm_substream_t *substream)
2170 2170
2171static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait) 2171static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
2172{ 2172{
2173 snd_pcm_oss_file_t *pcm_oss_file; 2173 struct snd_pcm_oss_file *pcm_oss_file;
2174 unsigned int mask; 2174 unsigned int mask;
2175 snd_pcm_substream_t *psubstream = NULL, *csubstream = NULL; 2175 struct snd_pcm_substream *psubstream = NULL, *csubstream = NULL;
2176 2176
2177 pcm_oss_file = file->private_data; 2177 pcm_oss_file = file->private_data;
2178 2178
@@ -2181,7 +2181,7 @@ static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
2181 2181
2182 mask = 0; 2182 mask = 0;
2183 if (psubstream != NULL) { 2183 if (psubstream != NULL) {
2184 snd_pcm_runtime_t *runtime = psubstream->runtime; 2184 struct snd_pcm_runtime *runtime = psubstream->runtime;
2185 poll_wait(file, &runtime->sleep, wait); 2185 poll_wait(file, &runtime->sleep, wait);
2186 snd_pcm_stream_lock_irq(psubstream); 2186 snd_pcm_stream_lock_irq(psubstream);
2187 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING && 2187 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING &&
@@ -2191,8 +2191,8 @@ static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
2191 snd_pcm_stream_unlock_irq(psubstream); 2191 snd_pcm_stream_unlock_irq(psubstream);
2192 } 2192 }
2193 if (csubstream != NULL) { 2193 if (csubstream != NULL) {
2194 snd_pcm_runtime_t *runtime = csubstream->runtime; 2194 struct snd_pcm_runtime *runtime = csubstream->runtime;
2195 enum sndrv_pcm_state ostate; 2195 snd_pcm_state_t ostate;
2196 poll_wait(file, &runtime->sleep, wait); 2196 poll_wait(file, &runtime->sleep, wait);
2197 snd_pcm_stream_lock_irq(csubstream); 2197 snd_pcm_stream_lock_irq(csubstream);
2198 if ((ostate = runtime->status->state) != SNDRV_PCM_STATE_RUNNING || 2198 if ((ostate = runtime->status->state) != SNDRV_PCM_STATE_RUNNING ||
@@ -2200,7 +2200,7 @@ static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
2200 mask |= POLLIN | POLLRDNORM; 2200 mask |= POLLIN | POLLRDNORM;
2201 snd_pcm_stream_unlock_irq(csubstream); 2201 snd_pcm_stream_unlock_irq(csubstream);
2202 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { 2202 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) {
2203 snd_pcm_oss_file_t ofile; 2203 struct snd_pcm_oss_file ofile;
2204 memset(&ofile, 0, sizeof(ofile)); 2204 memset(&ofile, 0, sizeof(ofile));
2205 ofile.streams[SNDRV_PCM_STREAM_CAPTURE] = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; 2205 ofile.streams[SNDRV_PCM_STREAM_CAPTURE] = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
2206 runtime->oss.trigger = 0; 2206 runtime->oss.trigger = 0;
@@ -2213,9 +2213,9 @@ static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
2213 2213
2214static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) 2214static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
2215{ 2215{
2216 snd_pcm_oss_file_t *pcm_oss_file; 2216 struct snd_pcm_oss_file *pcm_oss_file;
2217 snd_pcm_substream_t *substream = NULL; 2217 struct snd_pcm_substream *substream = NULL;
2218 snd_pcm_runtime_t *runtime; 2218 struct snd_pcm_runtime *runtime;
2219 int err; 2219 int err;
2220 2220
2221#ifdef OSS_DEBUG 2221#ifdef OSS_DEBUG
@@ -2279,11 +2279,11 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
2279 * /proc interface 2279 * /proc interface
2280 */ 2280 */
2281 2281
2282static void snd_pcm_oss_proc_read(snd_info_entry_t *entry, 2282static void snd_pcm_oss_proc_read(struct snd_info_entry *entry,
2283 snd_info_buffer_t * buffer) 2283 struct snd_info_buffer *buffer)
2284{ 2284{
2285 snd_pcm_str_t *pstr = (snd_pcm_str_t *)entry->private_data; 2285 struct snd_pcm_str *pstr = entry->private_data;
2286 snd_pcm_oss_setup_t *setup = pstr->oss.setup_list; 2286 struct snd_pcm_oss_setup *setup = pstr->oss.setup_list;
2287 down(&pstr->oss.setup_mutex); 2287 down(&pstr->oss.setup_mutex);
2288 while (setup) { 2288 while (setup) {
2289 snd_iprintf(buffer, "%s %u %u%s%s%s%s%s%s\n", 2289 snd_iprintf(buffer, "%s %u %u%s%s%s%s%s%s\n",
@@ -2301,11 +2301,11 @@ static void snd_pcm_oss_proc_read(snd_info_entry_t *entry,
2301 up(&pstr->oss.setup_mutex); 2301 up(&pstr->oss.setup_mutex);
2302} 2302}
2303 2303
2304static void snd_pcm_oss_proc_free_setup_list(snd_pcm_str_t * pstr) 2304static void snd_pcm_oss_proc_free_setup_list(struct snd_pcm_str * pstr)
2305{ 2305{
2306 unsigned int idx; 2306 unsigned int idx;
2307 snd_pcm_substream_t *substream; 2307 struct snd_pcm_substream *substream;
2308 snd_pcm_oss_setup_t *setup, *setupn; 2308 struct snd_pcm_oss_setup *setup, *setupn;
2309 2309
2310 for (idx = 0, substream = pstr->substream; 2310 for (idx = 0, substream = pstr->substream;
2311 idx < pstr->substream_count; idx++, substream = substream->next) 2311 idx < pstr->substream_count; idx++, substream = substream->next)
@@ -2319,13 +2319,13 @@ static void snd_pcm_oss_proc_free_setup_list(snd_pcm_str_t * pstr)
2319 pstr->oss.setup_list = NULL; 2319 pstr->oss.setup_list = NULL;
2320} 2320}
2321 2321
2322static void snd_pcm_oss_proc_write(snd_info_entry_t *entry, 2322static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
2323 snd_info_buffer_t * buffer) 2323 struct snd_info_buffer *buffer)
2324{ 2324{
2325 snd_pcm_str_t *pstr = (snd_pcm_str_t *)entry->private_data; 2325 struct snd_pcm_str *pstr = entry->private_data;
2326 char line[128], str[32], task_name[32], *ptr; 2326 char line[128], str[32], task_name[32], *ptr;
2327 int idx1; 2327 int idx1;
2328 snd_pcm_oss_setup_t *setup, *setup1, template; 2328 struct snd_pcm_oss_setup *setup, *setup1, template;
2329 2329
2330 while (!snd_info_get_line(buffer, line, sizeof(line))) { 2330 while (!snd_info_get_line(buffer, line, sizeof(line))) {
2331 down(&pstr->oss.setup_mutex); 2331 down(&pstr->oss.setup_mutex);
@@ -2370,7 +2370,7 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
2370 } 2370 }
2371 } while (*str); 2371 } while (*str);
2372 if (setup == NULL) { 2372 if (setup == NULL) {
2373 setup = (snd_pcm_oss_setup_t *) kmalloc(sizeof(snd_pcm_oss_setup_t), GFP_KERNEL); 2373 setup = kmalloc(sizeof(struct snd_pcm_oss_setup), GFP_KERNEL);
2374 if (setup) { 2374 if (setup) {
2375 if (pstr->oss.setup_list == NULL) { 2375 if (pstr->oss.setup_list == NULL) {
2376 pstr->oss.setup_list = setup; 2376 pstr->oss.setup_list = setup;
@@ -2389,12 +2389,12 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
2389 } 2389 }
2390} 2390}
2391 2391
2392static void snd_pcm_oss_proc_init(snd_pcm_t *pcm) 2392static void snd_pcm_oss_proc_init(struct snd_pcm *pcm)
2393{ 2393{
2394 int stream; 2394 int stream;
2395 for (stream = 0; stream < 2; ++stream) { 2395 for (stream = 0; stream < 2; ++stream) {
2396 snd_info_entry_t *entry; 2396 struct snd_info_entry *entry;
2397 snd_pcm_str_t *pstr = &pcm->streams[stream]; 2397 struct snd_pcm_str *pstr = &pcm->streams[stream];
2398 if (pstr->substream_count == 0) 2398 if (pstr->substream_count == 0)
2399 continue; 2399 continue;
2400 if ((entry = snd_info_create_card_entry(pcm->card, "oss", pstr->proc_root)) != NULL) { 2400 if ((entry = snd_info_create_card_entry(pcm->card, "oss", pstr->proc_root)) != NULL) {
@@ -2414,11 +2414,11 @@ static void snd_pcm_oss_proc_init(snd_pcm_t *pcm)
2414 } 2414 }
2415} 2415}
2416 2416
2417static void snd_pcm_oss_proc_done(snd_pcm_t *pcm) 2417static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
2418{ 2418{
2419 int stream; 2419 int stream;
2420 for (stream = 0; stream < 2; ++stream) { 2420 for (stream = 0; stream < 2; ++stream) {
2421 snd_pcm_str_t *pstr = &pcm->streams[stream]; 2421 struct snd_pcm_str *pstr = &pcm->streams[stream];
2422 if (pstr->oss.proc_entry) { 2422 if (pstr->oss.proc_entry) {
2423 snd_info_unregister(pstr->oss.proc_entry); 2423 snd_info_unregister(pstr->oss.proc_entry);
2424 pstr->oss.proc_entry = NULL; 2424 pstr->oss.proc_entry = NULL;
@@ -2444,13 +2444,13 @@ static struct file_operations snd_pcm_oss_f_reg =
2444 .mmap = snd_pcm_oss_mmap, 2444 .mmap = snd_pcm_oss_mmap,
2445}; 2445};
2446 2446
2447static snd_minor_t snd_pcm_oss_reg = 2447static struct snd_minor snd_pcm_oss_reg =
2448{ 2448{
2449 .comment = "digital audio", 2449 .comment = "digital audio",
2450 .f_ops = &snd_pcm_oss_f_reg, 2450 .f_ops = &snd_pcm_oss_f_reg,
2451}; 2451};
2452 2452
2453static void register_oss_dsp(snd_pcm_t *pcm, int index) 2453static void register_oss_dsp(struct snd_pcm *pcm, int index)
2454{ 2454{
2455 char name[128]; 2455 char name[128];
2456 sprintf(name, "dsp%i%i", pcm->card->number, pcm->device); 2456 sprintf(name, "dsp%i%i", pcm->card->number, pcm->device);
@@ -2462,7 +2462,7 @@ static void register_oss_dsp(snd_pcm_t *pcm, int index)
2462 } 2462 }
2463} 2463}
2464 2464
2465static int snd_pcm_oss_register_minor(snd_pcm_t * pcm) 2465static int snd_pcm_oss_register_minor(struct snd_pcm *pcm)
2466{ 2466{
2467 pcm->oss.reg = 0; 2467 pcm->oss.reg = 0;
2468 if (dsp_map[pcm->card->number] == (int)pcm->device) { 2468 if (dsp_map[pcm->card->number] == (int)pcm->device) {
@@ -2493,7 +2493,7 @@ static int snd_pcm_oss_register_minor(snd_pcm_t * pcm)
2493 return 0; 2493 return 0;
2494} 2494}
2495 2495
2496static int snd_pcm_oss_disconnect_minor(snd_pcm_t * pcm) 2496static int snd_pcm_oss_disconnect_minor(struct snd_pcm *pcm)
2497{ 2497{
2498 if (pcm->oss.reg) { 2498 if (pcm->oss.reg) {
2499 if (pcm->oss.reg_mask & 1) { 2499 if (pcm->oss.reg_mask & 1) {
@@ -2510,7 +2510,7 @@ static int snd_pcm_oss_disconnect_minor(snd_pcm_t * pcm)
2510 return 0; 2510 return 0;
2511} 2511}
2512 2512
2513static int snd_pcm_oss_unregister_minor(snd_pcm_t * pcm) 2513static int snd_pcm_oss_unregister_minor(struct snd_pcm *pcm)
2514{ 2514{
2515 snd_pcm_oss_disconnect_minor(pcm); 2515 snd_pcm_oss_disconnect_minor(pcm);
2516 if (pcm->oss.reg) { 2516 if (pcm->oss.reg) {
@@ -2525,7 +2525,7 @@ static int snd_pcm_oss_unregister_minor(snd_pcm_t * pcm)
2525 return 0; 2525 return 0;
2526} 2526}
2527 2527
2528static snd_pcm_notify_t snd_pcm_oss_notify = 2528static struct snd_pcm_notify snd_pcm_oss_notify =
2529{ 2529{
2530 .n_register = snd_pcm_oss_register_minor, 2530 .n_register = snd_pcm_oss_register_minor,
2531 .n_disconnect = snd_pcm_oss_disconnect_minor, 2531 .n_disconnect = snd_pcm_oss_disconnect_minor,
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 312ae1f2bfc..7e8676880dd 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -36,7 +36,7 @@
36#define snd_pcm_plug_first(plug) ((plug)->runtime->oss.plugin_first) 36#define snd_pcm_plug_first(plug) ((plug)->runtime->oss.plugin_first)
37#define snd_pcm_plug_last(plug) ((plug)->runtime->oss.plugin_last) 37#define snd_pcm_plug_last(plug) ((plug)->runtime->oss.plugin_last)
38 38
39static int snd_pcm_plugin_src_channels_mask(snd_pcm_plugin_t *plugin, 39static int snd_pcm_plugin_src_channels_mask(struct snd_pcm_plugin *plugin,
40 unsigned long *dst_vmask, 40 unsigned long *dst_vmask,
41 unsigned long **src_vmask) 41 unsigned long **src_vmask)
42{ 42{
@@ -46,7 +46,7 @@ static int snd_pcm_plugin_src_channels_mask(snd_pcm_plugin_t *plugin,
46 return 0; 46 return 0;
47} 47}
48 48
49static int snd_pcm_plugin_dst_channels_mask(snd_pcm_plugin_t *plugin, 49static int snd_pcm_plugin_dst_channels_mask(struct snd_pcm_plugin *plugin,
50 unsigned long *src_vmask, 50 unsigned long *src_vmask,
51 unsigned long **dst_vmask) 51 unsigned long **dst_vmask)
52{ 52{
@@ -67,13 +67,13 @@ static int rate_match(unsigned int src_rate, unsigned int dst_rate)
67 return dst_rate >= low && dst_rate <= high; 67 return dst_rate >= low && dst_rate <= high;
68} 68}
69 69
70static int snd_pcm_plugin_alloc(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t frames) 70static int snd_pcm_plugin_alloc(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t frames)
71{ 71{
72 snd_pcm_plugin_format_t *format; 72 struct snd_pcm_plugin_format *format;
73 ssize_t width; 73 ssize_t width;
74 size_t size; 74 size_t size;
75 unsigned int channel; 75 unsigned int channel;
76 snd_pcm_plugin_channel_t *c; 76 struct snd_pcm_plugin_channel *c;
77 77
78 if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) { 78 if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) {
79 format = &plugin->src_format; 79 format = &plugin->src_format;
@@ -120,12 +120,12 @@ static int snd_pcm_plugin_alloc(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t fram
120 return 0; 120 return 0;
121} 121}
122 122
123int snd_pcm_plug_alloc(snd_pcm_plug_t *plug, snd_pcm_uframes_t frames) 123int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames)
124{ 124{
125 int err; 125 int err;
126 snd_assert(snd_pcm_plug_first(plug) != NULL, return -ENXIO); 126 snd_assert(snd_pcm_plug_first(plug) != NULL, return -ENXIO);
127 if (snd_pcm_plug_stream(plug) == SNDRV_PCM_STREAM_PLAYBACK) { 127 if (snd_pcm_plug_stream(plug) == SNDRV_PCM_STREAM_PLAYBACK) {
128 snd_pcm_plugin_t *plugin = snd_pcm_plug_first(plug); 128 struct snd_pcm_plugin *plugin = snd_pcm_plug_first(plug);
129 while (plugin->next) { 129 while (plugin->next) {
130 if (plugin->dst_frames) 130 if (plugin->dst_frames)
131 frames = plugin->dst_frames(plugin, frames); 131 frames = plugin->dst_frames(plugin, frames);
@@ -136,7 +136,7 @@ int snd_pcm_plug_alloc(snd_pcm_plug_t *plug, snd_pcm_uframes_t frames)
136 return err; 136 return err;
137 } 137 }
138 } else { 138 } else {
139 snd_pcm_plugin_t *plugin = snd_pcm_plug_last(plug); 139 struct snd_pcm_plugin *plugin = snd_pcm_plug_last(plug);
140 while (plugin->prev) { 140 while (plugin->prev) {
141 if (plugin->src_frames) 141 if (plugin->src_frames)
142 frames = plugin->src_frames(plugin, frames); 142 frames = plugin->src_frames(plugin, frames);
@@ -151,22 +151,22 @@ int snd_pcm_plug_alloc(snd_pcm_plug_t *plug, snd_pcm_uframes_t frames)
151} 151}
152 152
153 153
154snd_pcm_sframes_t snd_pcm_plugin_client_channels(snd_pcm_plugin_t *plugin, 154snd_pcm_sframes_t snd_pcm_plugin_client_channels(struct snd_pcm_plugin *plugin,
155 snd_pcm_uframes_t frames, 155 snd_pcm_uframes_t frames,
156 snd_pcm_plugin_channel_t **channels) 156 struct snd_pcm_plugin_channel **channels)
157{ 157{
158 *channels = plugin->buf_channels; 158 *channels = plugin->buf_channels;
159 return frames; 159 return frames;
160} 160}
161 161
162int snd_pcm_plugin_build(snd_pcm_plug_t *plug, 162int snd_pcm_plugin_build(struct snd_pcm_substream *plug,
163 const char *name, 163 const char *name,
164 snd_pcm_plugin_format_t *src_format, 164 struct snd_pcm_plugin_format *src_format,
165 snd_pcm_plugin_format_t *dst_format, 165 struct snd_pcm_plugin_format *dst_format,
166 size_t extra, 166 size_t extra,
167 snd_pcm_plugin_t **ret) 167 struct snd_pcm_plugin **ret)
168{ 168{
169 snd_pcm_plugin_t *plugin; 169 struct snd_pcm_plugin *plugin;
170 unsigned int channels; 170 unsigned int channels;
171 171
172 snd_assert(plug != NULL, return -ENXIO); 172 snd_assert(plug != NULL, return -ENXIO);
@@ -210,7 +210,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug,
210 return 0; 210 return 0;
211} 211}
212 212
213int snd_pcm_plugin_free(snd_pcm_plugin_t *plugin) 213int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin)
214{ 214{
215 if (! plugin) 215 if (! plugin)
216 return 0; 216 return 0;
@@ -224,9 +224,9 @@ int snd_pcm_plugin_free(snd_pcm_plugin_t *plugin)
224 return 0; 224 return 0;
225} 225}
226 226
227snd_pcm_sframes_t snd_pcm_plug_client_size(snd_pcm_plug_t *plug, snd_pcm_uframes_t drv_frames) 227snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames)
228{ 228{
229 snd_pcm_plugin_t *plugin, *plugin_prev, *plugin_next; 229 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
230 int stream = snd_pcm_plug_stream(plug); 230 int stream = snd_pcm_plug_stream(plug);
231 231
232 snd_assert(plug != NULL, return -ENXIO); 232 snd_assert(plug != NULL, return -ENXIO);
@@ -253,9 +253,9 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(snd_pcm_plug_t *plug, snd_pcm_uframes
253 return drv_frames; 253 return drv_frames;
254} 254}
255 255
256snd_pcm_sframes_t snd_pcm_plug_slave_size(snd_pcm_plug_t *plug, snd_pcm_uframes_t clt_frames) 256snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t clt_frames)
257{ 257{
258 snd_pcm_plugin_t *plugin, *plugin_prev, *plugin_next; 258 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
259 snd_pcm_sframes_t frames; 259 snd_pcm_sframes_t frames;
260 int stream = snd_pcm_plug_stream(plug); 260 int stream = snd_pcm_plug_stream(plug);
261 261
@@ -290,9 +290,9 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(snd_pcm_plug_t *plug, snd_pcm_uframes_
290 return frames; 290 return frames;
291} 291}
292 292
293static int snd_pcm_plug_formats(snd_mask_t *mask, int format) 293static int snd_pcm_plug_formats(struct snd_mask *mask, int format)
294{ 294{
295 snd_mask_t formats = *mask; 295 struct snd_mask formats = *mask;
296 u64 linfmts = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 | 296 u64 linfmts = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 |
297 SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_S16_LE | 297 SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_S16_LE |
298 SNDRV_PCM_FMTBIT_U16_BE | SNDRV_PCM_FMTBIT_S16_BE | 298 SNDRV_PCM_FMTBIT_U16_BE | SNDRV_PCM_FMTBIT_S16_BE |
@@ -326,7 +326,7 @@ static int preferred_formats[] = {
326 SNDRV_PCM_FORMAT_U8 326 SNDRV_PCM_FORMAT_U8
327}; 327};
328 328
329int snd_pcm_plug_slave_format(int format, snd_mask_t *format_mask) 329int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask)
330{ 330{
331 if (snd_mask_test(format_mask, format)) 331 if (snd_mask_test(format_mask, format))
332 return format; 332 return format;
@@ -376,15 +376,15 @@ int snd_pcm_plug_slave_format(int format, snd_mask_t *format_mask)
376 } 376 }
377} 377}
378 378
379int snd_pcm_plug_format_plugins(snd_pcm_plug_t *plug, 379int snd_pcm_plug_format_plugins(struct snd_pcm_substream *plug,
380 snd_pcm_hw_params_t *params, 380 struct snd_pcm_hw_params *params,
381 snd_pcm_hw_params_t *slave_params) 381 struct snd_pcm_hw_params *slave_params)
382{ 382{
383 snd_pcm_plugin_format_t tmpformat; 383 struct snd_pcm_plugin_format tmpformat;
384 snd_pcm_plugin_format_t dstformat; 384 struct snd_pcm_plugin_format dstformat;
385 snd_pcm_plugin_format_t srcformat; 385 struct snd_pcm_plugin_format srcformat;
386 int src_access, dst_access; 386 int src_access, dst_access;
387 snd_pcm_plugin_t *plugin = NULL; 387 struct snd_pcm_plugin *plugin = NULL;
388 int err; 388 int err;
389 int stream = snd_pcm_plug_stream(plug); 389 int stream = snd_pcm_plug_stream(plug);
390 int slave_interleaved = (params_channels(slave_params) == 1 || 390 int slave_interleaved = (params_channels(slave_params) == 1 ||
@@ -462,7 +462,7 @@ int snd_pcm_plug_format_plugins(snd_pcm_plug_t *plug,
462 if (srcformat.channels > dstformat.channels) { 462 if (srcformat.channels > dstformat.channels) {
463 int sv = srcformat.channels; 463 int sv = srcformat.channels;
464 int dv = dstformat.channels; 464 int dv = dstformat.channels;
465 route_ttable_entry_t *ttable = kcalloc(dv * sv, sizeof(*ttable), GFP_KERNEL); 465 int *ttable = kcalloc(dv * sv, sizeof(*ttable), GFP_KERNEL);
466 if (ttable == NULL) 466 if (ttable == NULL)
467 return -ENOMEM; 467 return -ENOMEM;
468#if 1 468#if 1
@@ -525,7 +525,7 @@ int snd_pcm_plug_format_plugins(snd_pcm_plug_t *plug,
525 if (srcformat.channels < dstformat.channels) { 525 if (srcformat.channels < dstformat.channels) {
526 int sv = srcformat.channels; 526 int sv = srcformat.channels;
527 int dv = dstformat.channels; 527 int dv = dstformat.channels;
528 route_ttable_entry_t *ttable = kcalloc(dv * sv, sizeof(*ttable), GFP_KERNEL); 528 int *ttable = kcalloc(dv * sv, sizeof(*ttable), GFP_KERNEL);
529 if (ttable == NULL) 529 if (ttable == NULL)
530 return -ENOMEM; 530 return -ENOMEM;
531#if 0 531#if 0
@@ -614,14 +614,14 @@ int snd_pcm_plug_format_plugins(snd_pcm_plug_t *plug,
614 return 0; 614 return 0;
615} 615}
616 616
617snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(snd_pcm_plug_t *plug, 617snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(struct snd_pcm_substream *plug,
618 char *buf, 618 char *buf,
619 snd_pcm_uframes_t count, 619 snd_pcm_uframes_t count,
620 snd_pcm_plugin_channel_t **channels) 620 struct snd_pcm_plugin_channel **channels)
621{ 621{
622 snd_pcm_plugin_t *plugin; 622 struct snd_pcm_plugin *plugin;
623 snd_pcm_plugin_channel_t *v; 623 struct snd_pcm_plugin_channel *v;
624 snd_pcm_plugin_format_t *format; 624 struct snd_pcm_plugin_format *format;
625 int width, nchannels, channel; 625 int width, nchannels, channel;
626 int stream = snd_pcm_plug_stream(plug); 626 int stream = snd_pcm_plug_stream(plug);
627 627
@@ -650,10 +650,10 @@ snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(snd_pcm_plug_t *plug,
650 return count; 650 return count;
651} 651}
652 652
653static int snd_pcm_plug_playback_channels_mask(snd_pcm_plug_t *plug, 653static int snd_pcm_plug_playback_channels_mask(struct snd_pcm_substream *plug,
654 unsigned long *client_vmask) 654 unsigned long *client_vmask)
655{ 655{
656 snd_pcm_plugin_t *plugin = snd_pcm_plug_last(plug); 656 struct snd_pcm_plugin *plugin = snd_pcm_plug_last(plug);
657 if (plugin == NULL) { 657 if (plugin == NULL) {
658 return 0; 658 return 0;
659 } else { 659 } else {
@@ -678,10 +678,10 @@ static int snd_pcm_plug_playback_channels_mask(snd_pcm_plug_t *plug,
678 } 678 }
679} 679}
680 680
681static int snd_pcm_plug_playback_disable_useless_channels(snd_pcm_plug_t *plug, 681static int snd_pcm_plug_playback_disable_useless_channels(struct snd_pcm_substream *plug,
682 snd_pcm_plugin_channel_t *src_channels) 682 struct snd_pcm_plugin_channel *src_channels)
683{ 683{
684 snd_pcm_plugin_t *plugin = snd_pcm_plug_first(plug); 684 struct snd_pcm_plugin *plugin = snd_pcm_plug_first(plug);
685 unsigned int nchannels = plugin->src_format.channels; 685 unsigned int nchannels = plugin->src_format.channels;
686 DECLARE_BITMAP(bs, nchannels); 686 DECLARE_BITMAP(bs, nchannels);
687 unsigned long *srcmask = bs; 687 unsigned long *srcmask = bs;
@@ -703,11 +703,11 @@ static int snd_pcm_plug_playback_disable_useless_channels(snd_pcm_plug_t *plug,
703 return 0; 703 return 0;
704} 704}
705 705
706static int snd_pcm_plug_capture_disable_useless_channels(snd_pcm_plug_t *plug, 706static int snd_pcm_plug_capture_disable_useless_channels(struct snd_pcm_substream *plug,
707 snd_pcm_plugin_channel_t *src_channels, 707 struct snd_pcm_plugin_channel *src_channels,
708 snd_pcm_plugin_channel_t *client_channels) 708 struct snd_pcm_plugin_channel *client_channels)
709{ 709{
710 snd_pcm_plugin_t *plugin = snd_pcm_plug_last(plug); 710 struct snd_pcm_plugin *plugin = snd_pcm_plug_last(plug);
711 unsigned int nchannels = plugin->dst_format.channels; 711 unsigned int nchannels = plugin->dst_format.channels;
712 DECLARE_BITMAP(bs, nchannels); 712 DECLARE_BITMAP(bs, nchannels);
713 unsigned long *dstmask = bs; 713 unsigned long *dstmask = bs;
@@ -736,10 +736,10 @@ static int snd_pcm_plug_capture_disable_useless_channels(snd_pcm_plug_t *plug,
736 return 0; 736 return 0;
737} 737}
738 738
739snd_pcm_sframes_t snd_pcm_plug_write_transfer(snd_pcm_plug_t *plug, snd_pcm_plugin_channel_t *src_channels, snd_pcm_uframes_t size) 739snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *plug, struct snd_pcm_plugin_channel *src_channels, snd_pcm_uframes_t size)
740{ 740{
741 snd_pcm_plugin_t *plugin, *next; 741 struct snd_pcm_plugin *plugin, *next;
742 snd_pcm_plugin_channel_t *dst_channels; 742 struct snd_pcm_plugin_channel *dst_channels;
743 int err; 743 int err;
744 snd_pcm_sframes_t frames = size; 744 snd_pcm_sframes_t frames = size;
745 745
@@ -771,10 +771,10 @@ snd_pcm_sframes_t snd_pcm_plug_write_transfer(snd_pcm_plug_t *plug, snd_pcm_plug
771 return snd_pcm_plug_client_size(plug, frames); 771 return snd_pcm_plug_client_size(plug, frames);
772} 772}
773 773
774snd_pcm_sframes_t snd_pcm_plug_read_transfer(snd_pcm_plug_t *plug, snd_pcm_plugin_channel_t *dst_channels_final, snd_pcm_uframes_t size) 774snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, struct snd_pcm_plugin_channel *dst_channels_final, snd_pcm_uframes_t size)
775{ 775{
776 snd_pcm_plugin_t *plugin, *next; 776 struct snd_pcm_plugin *plugin, *next;
777 snd_pcm_plugin_channel_t *src_channels, *dst_channels; 777 struct snd_pcm_plugin_channel *src_channels, *dst_channels;
778 snd_pcm_sframes_t frames = size; 778 snd_pcm_sframes_t frames = size;
779 int err; 779 int err;
780 780
@@ -806,7 +806,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(snd_pcm_plug_t *plug, snd_pcm_plugi
806 return frames; 806 return frames;
807} 807}
808 808
809int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, size_t dst_offset, 809int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst_offset,
810 size_t samples, int format) 810 size_t samples, int format)
811{ 811{
812 /* FIXME: sub byte resolution and odd dst_offset */ 812 /* FIXME: sub byte resolution and odd dst_offset */
@@ -852,8 +852,8 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, size_t dst_offs
852 return 0; 852 return 0;
853} 853}
854 854
855int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_area, size_t src_offset, 855int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_area, size_t src_offset,
856 const snd_pcm_channel_area_t *dst_area, size_t dst_offset, 856 const struct snd_pcm_channel_area *dst_area, size_t dst_offset,
857 size_t samples, int format) 857 size_t samples, int format)
858{ 858{
859 /* FIXME: sub byte resolution and odd dst_offset */ 859 /* FIXME: sub byte resolution and odd dst_offset */
diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
index 69a43172142..29198da615c 100644
--- a/sound/core/oss/pcm_plugin.h
+++ b/sound/core/oss/pcm_plugin.h
@@ -29,147 +29,157 @@ static inline unsigned long *bitmap_alloc(unsigned int nbits)
29 return kmalloc(BITS_TO_LONGS(nbits), GFP_KERNEL); 29 return kmalloc(BITS_TO_LONGS(nbits), GFP_KERNEL);
30} 30}
31 31
32#define snd_pcm_plug_t snd_pcm_substream_t
33#define snd_pcm_plug_stream(plug) ((plug)->stream) 32#define snd_pcm_plug_stream(plug) ((plug)->stream)
34 33
35typedef enum { 34enum snd_pcm_plugin_action {
36 INIT = 0, 35 INIT = 0,
37 PREPARE = 1, 36 PREPARE = 1,
38} snd_pcm_plugin_action_t; 37};
39 38
40typedef struct _snd_pcm_channel_area { 39struct snd_pcm_channel_area {
41 void *addr; /* base address of channel samples */ 40 void *addr; /* base address of channel samples */
42 unsigned int first; /* offset to first sample in bits */ 41 unsigned int first; /* offset to first sample in bits */
43 unsigned int step; /* samples distance in bits */ 42 unsigned int step; /* samples distance in bits */
44} snd_pcm_channel_area_t; 43};
45 44
46typedef struct _snd_pcm_plugin_channel { 45struct snd_pcm_plugin_channel {
47 void *aptr; /* pointer to the allocated area */ 46 void *aptr; /* pointer to the allocated area */
48 snd_pcm_channel_area_t area; 47 struct snd_pcm_channel_area area;
49 snd_pcm_uframes_t frames; /* allocated frames */ 48 snd_pcm_uframes_t frames; /* allocated frames */
50 unsigned int enabled:1; /* channel need to be processed */ 49 unsigned int enabled:1; /* channel need to be processed */
51 unsigned int wanted:1; /* channel is wanted */ 50 unsigned int wanted:1; /* channel is wanted */
52} snd_pcm_plugin_channel_t; 51};
53 52
54typedef struct _snd_pcm_plugin_format { 53struct snd_pcm_plugin_format {
55 int format; 54 int format;
56 unsigned int rate; 55 unsigned int rate;
57 unsigned int channels; 56 unsigned int channels;
58} snd_pcm_plugin_format_t; 57};
59 58
60struct _snd_pcm_plugin { 59struct snd_pcm_plugin {
61 const char *name; /* plug-in name */ 60 const char *name; /* plug-in name */
62 int stream; 61 int stream;
63 snd_pcm_plugin_format_t src_format; /* source format */ 62 struct snd_pcm_plugin_format src_format; /* source format */
64 snd_pcm_plugin_format_t dst_format; /* destination format */ 63 struct snd_pcm_plugin_format dst_format; /* destination format */
65 int src_width; /* sample width in bits */ 64 int src_width; /* sample width in bits */
66 int dst_width; /* sample width in bits */ 65 int dst_width; /* sample width in bits */
67 int access; 66 int access;
68 snd_pcm_sframes_t (*src_frames)(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t dst_frames); 67 snd_pcm_sframes_t (*src_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t dst_frames);
69 snd_pcm_sframes_t (*dst_frames)(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t src_frames); 68 snd_pcm_sframes_t (*dst_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t src_frames);
70 snd_pcm_sframes_t (*client_channels)(snd_pcm_plugin_t *plugin, 69 snd_pcm_sframes_t (*client_channels)(struct snd_pcm_plugin *plugin,
71 snd_pcm_uframes_t frames, 70 snd_pcm_uframes_t frames,
72 snd_pcm_plugin_channel_t **channels); 71 struct snd_pcm_plugin_channel **channels);
73 int (*src_channels_mask)(snd_pcm_plugin_t *plugin, 72 int (*src_channels_mask)(struct snd_pcm_plugin *plugin,
74 unsigned long *dst_vmask, 73 unsigned long *dst_vmask,
75 unsigned long **src_vmask); 74 unsigned long **src_vmask);
76 int (*dst_channels_mask)(snd_pcm_plugin_t *plugin, 75 int (*dst_channels_mask)(struct snd_pcm_plugin *plugin,
77 unsigned long *src_vmask, 76 unsigned long *src_vmask,
78 unsigned long **dst_vmask); 77 unsigned long **dst_vmask);
79 snd_pcm_sframes_t (*transfer)(snd_pcm_plugin_t *plugin, 78 snd_pcm_sframes_t (*transfer)(struct snd_pcm_plugin *plugin,
80 const snd_pcm_plugin_channel_t *src_channels, 79 const struct snd_pcm_plugin_channel *src_channels,
81 snd_pcm_plugin_channel_t *dst_channels, 80 struct snd_pcm_plugin_channel *dst_channels,
82 snd_pcm_uframes_t frames); 81 snd_pcm_uframes_t frames);
83 int (*action)(snd_pcm_plugin_t *plugin, 82 int (*action)(struct snd_pcm_plugin *plugin,
84 snd_pcm_plugin_action_t action, 83 enum snd_pcm_plugin_action action,
85 unsigned long data); 84 unsigned long data);
86 snd_pcm_plugin_t *prev; 85 struct snd_pcm_plugin *prev;
87 snd_pcm_plugin_t *next; 86 struct snd_pcm_plugin *next;
88 snd_pcm_plug_t *plug; 87 struct snd_pcm_substream *plug;
89 void *private_data; 88 void *private_data;
90 void (*private_free)(snd_pcm_plugin_t *plugin); 89 void (*private_free)(struct snd_pcm_plugin *plugin);
91 char *buf; 90 char *buf;
92 snd_pcm_uframes_t buf_frames; 91 snd_pcm_uframes_t buf_frames;
93 snd_pcm_plugin_channel_t *buf_channels; 92 struct snd_pcm_plugin_channel *buf_channels;
94 unsigned long *src_vmask; 93 unsigned long *src_vmask;
95 unsigned long *dst_vmask; 94 unsigned long *dst_vmask;
96 char extra_data[0]; 95 char extra_data[0];
97}; 96};
98 97
99int snd_pcm_plugin_build(snd_pcm_plug_t *handle, 98int snd_pcm_plugin_build(struct snd_pcm_substream *handle,
100 const char *name, 99 const char *name,
101 snd_pcm_plugin_format_t *src_format, 100 struct snd_pcm_plugin_format *src_format,
102 snd_pcm_plugin_format_t *dst_format, 101 struct snd_pcm_plugin_format *dst_format,
103 size_t extra, 102 size_t extra,
104 snd_pcm_plugin_t **ret); 103 struct snd_pcm_plugin **ret);
105int snd_pcm_plugin_free(snd_pcm_plugin_t *plugin); 104int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin);
106int snd_pcm_plugin_clear(snd_pcm_plugin_t **first); 105int snd_pcm_plugin_clear(struct snd_pcm_plugin **first);
107int snd_pcm_plug_alloc(snd_pcm_plug_t *plug, snd_pcm_uframes_t frames); 106int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames);
108snd_pcm_sframes_t snd_pcm_plug_client_size(snd_pcm_plug_t *handle, snd_pcm_uframes_t drv_size); 107snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t drv_size);
109snd_pcm_sframes_t snd_pcm_plug_slave_size(snd_pcm_plug_t *handle, snd_pcm_uframes_t clt_size); 108snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t clt_size);
110 109
111#define FULL ROUTE_PLUGIN_RESOLUTION 110#define FULL ROUTE_PLUGIN_RESOLUTION
112#define HALF ROUTE_PLUGIN_RESOLUTION / 2 111#define HALF ROUTE_PLUGIN_RESOLUTION / 2
113typedef int route_ttable_entry_t; 112
114 113int snd_pcm_plugin_build_io(struct snd_pcm_substream *handle,
115int snd_pcm_plugin_build_io(snd_pcm_plug_t *handle, 114 struct snd_pcm_hw_params *params,
116 snd_pcm_hw_params_t *params, 115 struct snd_pcm_plugin **r_plugin);
117 snd_pcm_plugin_t **r_plugin); 116int snd_pcm_plugin_build_linear(struct snd_pcm_substream *handle,
118int snd_pcm_plugin_build_linear(snd_pcm_plug_t *handle, 117 struct snd_pcm_plugin_format *src_format,
119 snd_pcm_plugin_format_t *src_format, 118 struct snd_pcm_plugin_format *dst_format,
120 snd_pcm_plugin_format_t *dst_format, 119 struct snd_pcm_plugin **r_plugin);
121 snd_pcm_plugin_t **r_plugin); 120int snd_pcm_plugin_build_mulaw(struct snd_pcm_substream *handle,
122int snd_pcm_plugin_build_mulaw(snd_pcm_plug_t *handle, 121 struct snd_pcm_plugin_format *src_format,
123 snd_pcm_plugin_format_t *src_format, 122 struct snd_pcm_plugin_format *dst_format,
124 snd_pcm_plugin_format_t *dst_format, 123 struct snd_pcm_plugin **r_plugin);
125 snd_pcm_plugin_t **r_plugin); 124int snd_pcm_plugin_build_rate(struct snd_pcm_substream *handle,
126int snd_pcm_plugin_build_rate(snd_pcm_plug_t *handle, 125 struct snd_pcm_plugin_format *src_format,
127 snd_pcm_plugin_format_t *src_format, 126 struct snd_pcm_plugin_format *dst_format,
128 snd_pcm_plugin_format_t *dst_format, 127 struct snd_pcm_plugin **r_plugin);
129 snd_pcm_plugin_t **r_plugin); 128int snd_pcm_plugin_build_route(struct snd_pcm_substream *handle,
130int snd_pcm_plugin_build_route(snd_pcm_plug_t *handle, 129 struct snd_pcm_plugin_format *src_format,
131 snd_pcm_plugin_format_t *src_format, 130 struct snd_pcm_plugin_format *dst_format,
132 snd_pcm_plugin_format_t *dst_format, 131 int *ttable,
133 route_ttable_entry_t *ttable, 132 struct snd_pcm_plugin **r_plugin);
134 snd_pcm_plugin_t **r_plugin); 133int snd_pcm_plugin_build_copy(struct snd_pcm_substream *handle,
135int snd_pcm_plugin_build_copy(snd_pcm_plug_t *handle, 134 struct snd_pcm_plugin_format *src_format,
136 snd_pcm_plugin_format_t *src_format, 135 struct snd_pcm_plugin_format *dst_format,
137 snd_pcm_plugin_format_t *dst_format, 136 struct snd_pcm_plugin **r_plugin);
138 snd_pcm_plugin_t **r_plugin); 137
139 138int snd_pcm_plug_format_plugins(struct snd_pcm_substream *substream,
140int snd_pcm_plug_format_plugins(snd_pcm_plug_t *substream, 139 struct snd_pcm_hw_params *params,
141 snd_pcm_hw_params_t *params, 140 struct snd_pcm_hw_params *slave_params);
142 snd_pcm_hw_params_t *slave_params); 141
143 142int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask);
144int snd_pcm_plug_slave_format(int format, snd_mask_t *format_mask); 143
145 144int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin);
146int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin); 145
147 146snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *handle,
148snd_pcm_sframes_t snd_pcm_plug_write_transfer(snd_pcm_plug_t *handle, snd_pcm_plugin_channel_t *src_channels, snd_pcm_uframes_t size); 147 struct snd_pcm_plugin_channel *src_channels,
149snd_pcm_sframes_t snd_pcm_plug_read_transfer(snd_pcm_plug_t *handle, snd_pcm_plugin_channel_t *dst_channels_final, snd_pcm_uframes_t size); 148 snd_pcm_uframes_t size);
150 149snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *handle,
151snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(snd_pcm_plug_t *handle, 150 struct snd_pcm_plugin_channel *dst_channels_final,
152 char *buf, snd_pcm_uframes_t count, 151 snd_pcm_uframes_t size);
153 snd_pcm_plugin_channel_t **channels); 152
154 153snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(struct snd_pcm_substream *handle,
155snd_pcm_sframes_t snd_pcm_plugin_client_channels(snd_pcm_plugin_t *plugin, 154 char *buf, snd_pcm_uframes_t count,
156 snd_pcm_uframes_t frames, 155 struct snd_pcm_plugin_channel **channels);
157 snd_pcm_plugin_channel_t **channels); 156
158 157snd_pcm_sframes_t snd_pcm_plugin_client_channels(struct snd_pcm_plugin *plugin,
159int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, size_t dst_offset, 158 snd_pcm_uframes_t frames,
159 struct snd_pcm_plugin_channel **channels);
160
161int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_channel,
162 size_t dst_offset,
160 size_t samples, int format); 163 size_t samples, int format);
161int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_channel, size_t src_offset, 164int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_channel,
162 const snd_pcm_channel_area_t *dst_channel, size_t dst_offset, 165 size_t src_offset,
166 const struct snd_pcm_channel_area *dst_channel,
167 size_t dst_offset,
163 size_t samples, int format); 168 size_t samples, int format);
164 169
165void *snd_pcm_plug_buf_alloc(snd_pcm_plug_t *plug, snd_pcm_uframes_t size); 170void *snd_pcm_plug_buf_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t size);
166void snd_pcm_plug_buf_unlock(snd_pcm_plug_t *plug, void *ptr); 171void snd_pcm_plug_buf_unlock(struct snd_pcm_substream *plug, void *ptr);
167snd_pcm_sframes_t snd_pcm_oss_write3(snd_pcm_substream_t *substream, const char *ptr, snd_pcm_uframes_t size, int in_kernel); 172snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream,
168snd_pcm_sframes_t snd_pcm_oss_read3(snd_pcm_substream_t *substream, char *ptr, snd_pcm_uframes_t size, int in_kernel); 173 const char *ptr, snd_pcm_uframes_t size,
169snd_pcm_sframes_t snd_pcm_oss_writev3(snd_pcm_substream_t *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel); 174 int in_kernel);
170snd_pcm_sframes_t snd_pcm_oss_readv3(snd_pcm_substream_t *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel); 175snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream,
171 176 char *ptr, snd_pcm_uframes_t size, int in_kernel);
172 177snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream,
178 void **bufs, snd_pcm_uframes_t frames,
179 int in_kernel);
180snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream,
181 void **bufs, snd_pcm_uframes_t frames,
182 int in_kernel);
173 183
174#define ROUTE_PLUGIN_RESOLUTION 16 184#define ROUTE_PLUGIN_RESOLUTION 16
175 185
@@ -177,8 +187,8 @@ int getput_index(int format);
177int copy_index(int format); 187int copy_index(int format);
178int conv_index(int src_format, int dst_format); 188int conv_index(int src_format, int dst_format);
179 189
180void zero_channel(snd_pcm_plugin_t *plugin, 190void zero_channel(struct snd_pcm_plugin *plugin,
181 const snd_pcm_plugin_channel_t *dst_channel, 191 const struct snd_pcm_plugin_channel *dst_channel,
182 size_t samples); 192 size_t samples);
183 193
184#ifdef PLUGIN_DEBUG 194#ifdef PLUGIN_DEBUG
diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c
index 7e325ca5870..4854cef6fb4 100644
--- a/sound/core/oss/rate.c
+++ b/sound/core/oss/rate.c
@@ -33,29 +33,29 @@
33 * Basic rate conversion plugin 33 * Basic rate conversion plugin
34 */ 34 */
35 35
36typedef struct { 36struct rate_channel {
37 signed short last_S1; 37 signed short last_S1;
38 signed short last_S2; 38 signed short last_S2;
39} rate_channel_t; 39};
40 40
41typedef void (*rate_f)(snd_pcm_plugin_t *plugin, 41typedef void (*rate_f)(struct snd_pcm_plugin *plugin,
42 const snd_pcm_plugin_channel_t *src_channels, 42 const struct snd_pcm_plugin_channel *src_channels,
43 snd_pcm_plugin_channel_t *dst_channels, 43 struct snd_pcm_plugin_channel *dst_channels,
44 int src_frames, int dst_frames); 44 int src_frames, int dst_frames);
45 45
46typedef struct rate_private_data { 46struct rate_priv {
47 unsigned int pitch; 47 unsigned int pitch;
48 unsigned int pos; 48 unsigned int pos;
49 rate_f func; 49 rate_f func;
50 int get, put; 50 int get, put;
51 snd_pcm_sframes_t old_src_frames, old_dst_frames; 51 snd_pcm_sframes_t old_src_frames, old_dst_frames;
52 rate_channel_t channels[0]; 52 struct rate_channel channels[0];
53} rate_t; 53};
54 54
55static void rate_init(snd_pcm_plugin_t *plugin) 55static void rate_init(struct snd_pcm_plugin *plugin)
56{ 56{
57 unsigned int channel; 57 unsigned int channel;
58 rate_t *data = (rate_t *)plugin->extra_data; 58 struct rate_priv *data = (struct rate_priv *)plugin->extra_data;
59 data->pos = 0; 59 data->pos = 0;
60 for (channel = 0; channel < plugin->src_format.channels; channel++) { 60 for (channel = 0; channel < plugin->src_format.channels; channel++) {
61 data->channels[channel].last_S1 = 0; 61 data->channels[channel].last_S1 = 0;
@@ -63,9 +63,9 @@ static void rate_init(snd_pcm_plugin_t *plugin)
63 } 63 }
64} 64}
65 65
66static void resample_expand(snd_pcm_plugin_t *plugin, 66static void resample_expand(struct snd_pcm_plugin *plugin,
67 const snd_pcm_plugin_channel_t *src_channels, 67 const struct snd_pcm_plugin_channel *src_channels,
68 snd_pcm_plugin_channel_t *dst_channels, 68 struct snd_pcm_plugin_channel *dst_channels,
69 int src_frames, int dst_frames) 69 int src_frames, int dst_frames)
70{ 70{
71 unsigned int pos = 0; 71 unsigned int pos = 0;
@@ -75,8 +75,8 @@ static void resample_expand(snd_pcm_plugin_t *plugin,
75 unsigned int channel; 75 unsigned int channel;
76 int src_step, dst_step; 76 int src_step, dst_step;
77 int src_frames1, dst_frames1; 77 int src_frames1, dst_frames1;
78 rate_t *data = (rate_t *)plugin->extra_data; 78 struct rate_priv *data = (struct rate_priv *)plugin->extra_data;
79 rate_channel_t *rchannels = data->channels; 79 struct rate_channel *rchannels = data->channels;
80 80
81#define GET_S16_LABELS 81#define GET_S16_LABELS
82#define PUT_S16_LABELS 82#define PUT_S16_LABELS
@@ -139,9 +139,9 @@ static void resample_expand(snd_pcm_plugin_t *plugin,
139 data->pos = pos; 139 data->pos = pos;
140} 140}
141 141
142static void resample_shrink(snd_pcm_plugin_t *plugin, 142static void resample_shrink(struct snd_pcm_plugin *plugin,
143 const snd_pcm_plugin_channel_t *src_channels, 143 const struct snd_pcm_plugin_channel *src_channels,
144 snd_pcm_plugin_channel_t *dst_channels, 144 struct snd_pcm_plugin_channel *dst_channels,
145 int src_frames, int dst_frames) 145 int src_frames, int dst_frames)
146{ 146{
147 unsigned int pos = 0; 147 unsigned int pos = 0;
@@ -151,8 +151,8 @@ static void resample_shrink(snd_pcm_plugin_t *plugin,
151 unsigned int channel; 151 unsigned int channel;
152 int src_step, dst_step; 152 int src_step, dst_step;
153 int src_frames1, dst_frames1; 153 int src_frames1, dst_frames1;
154 rate_t *data = (rate_t *)plugin->extra_data; 154 struct rate_priv *data = (struct rate_priv *)plugin->extra_data;
155 rate_channel_t *rchannels = data->channels; 155 struct rate_channel *rchannels = data->channels;
156 156
157#define GET_S16_LABELS 157#define GET_S16_LABELS
158#define PUT_S16_LABELS 158#define PUT_S16_LABELS
@@ -216,15 +216,15 @@ static void resample_shrink(snd_pcm_plugin_t *plugin,
216 data->pos = pos; 216 data->pos = pos;
217} 217}
218 218
219static snd_pcm_sframes_t rate_src_frames(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t frames) 219static snd_pcm_sframes_t rate_src_frames(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t frames)
220{ 220{
221 rate_t *data; 221 struct rate_priv *data;
222 snd_pcm_sframes_t res; 222 snd_pcm_sframes_t res;
223 223
224 snd_assert(plugin != NULL, return -ENXIO); 224 snd_assert(plugin != NULL, return -ENXIO);
225 if (frames == 0) 225 if (frames == 0)
226 return 0; 226 return 0;
227 data = (rate_t *)plugin->extra_data; 227 data = (struct rate_priv *)plugin->extra_data;
228 if (plugin->src_format.rate < plugin->dst_format.rate) { 228 if (plugin->src_format.rate < plugin->dst_format.rate) {
229 res = (((frames * data->pitch) + (BITS/2)) >> SHIFT); 229 res = (((frames * data->pitch) + (BITS/2)) >> SHIFT);
230 } else { 230 } else {
@@ -248,15 +248,15 @@ static snd_pcm_sframes_t rate_src_frames(snd_pcm_plugin_t *plugin, snd_pcm_ufram
248 return res; 248 return res;
249} 249}
250 250
251static snd_pcm_sframes_t rate_dst_frames(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t frames) 251static snd_pcm_sframes_t rate_dst_frames(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t frames)
252{ 252{
253 rate_t *data; 253 struct rate_priv *data;
254 snd_pcm_sframes_t res; 254 snd_pcm_sframes_t res;
255 255
256 snd_assert(plugin != NULL, return -ENXIO); 256 snd_assert(plugin != NULL, return -ENXIO);
257 if (frames == 0) 257 if (frames == 0)
258 return 0; 258 return 0;
259 data = (rate_t *)plugin->extra_data; 259 data = (struct rate_priv *)plugin->extra_data;
260 if (plugin->src_format.rate < plugin->dst_format.rate) { 260 if (plugin->src_format.rate < plugin->dst_format.rate) {
261 res = (((frames << SHIFT) + (data->pitch / 2)) / data->pitch); 261 res = (((frames << SHIFT) + (data->pitch / 2)) / data->pitch);
262 } else { 262 } else {
@@ -280,13 +280,13 @@ static snd_pcm_sframes_t rate_dst_frames(snd_pcm_plugin_t *plugin, snd_pcm_ufram
280 return res; 280 return res;
281} 281}
282 282
283static snd_pcm_sframes_t rate_transfer(snd_pcm_plugin_t *plugin, 283static snd_pcm_sframes_t rate_transfer(struct snd_pcm_plugin *plugin,
284 const snd_pcm_plugin_channel_t *src_channels, 284 const struct snd_pcm_plugin_channel *src_channels,
285 snd_pcm_plugin_channel_t *dst_channels, 285 struct snd_pcm_plugin_channel *dst_channels,
286 snd_pcm_uframes_t frames) 286 snd_pcm_uframes_t frames)
287{ 287{
288 snd_pcm_uframes_t dst_frames; 288 snd_pcm_uframes_t dst_frames;
289 rate_t *data; 289 struct rate_priv *data;
290 290
291 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO); 291 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO);
292 if (frames == 0) 292 if (frames == 0)
@@ -308,13 +308,13 @@ static snd_pcm_sframes_t rate_transfer(snd_pcm_plugin_t *plugin,
308 dst_frames = rate_dst_frames(plugin, frames); 308 dst_frames = rate_dst_frames(plugin, frames);
309 if (dst_frames > dst_channels[0].frames) 309 if (dst_frames > dst_channels[0].frames)
310 dst_frames = dst_channels[0].frames; 310 dst_frames = dst_channels[0].frames;
311 data = (rate_t *)plugin->extra_data; 311 data = (struct rate_priv *)plugin->extra_data;
312 data->func(plugin, src_channels, dst_channels, frames, dst_frames); 312 data->func(plugin, src_channels, dst_channels, frames, dst_frames);
313 return dst_frames; 313 return dst_frames;
314} 314}
315 315
316static int rate_action(snd_pcm_plugin_t *plugin, 316static int rate_action(struct snd_pcm_plugin *plugin,
317 snd_pcm_plugin_action_t action, 317 enum snd_pcm_plugin_action action,
318 unsigned long udata) 318 unsigned long udata)
319{ 319{
320 snd_assert(plugin != NULL, return -ENXIO); 320 snd_assert(plugin != NULL, return -ENXIO);
@@ -329,14 +329,14 @@ static int rate_action(snd_pcm_plugin_t *plugin,
329 return 0; /* silenty ignore other actions */ 329 return 0; /* silenty ignore other actions */
330} 330}
331 331
332int snd_pcm_plugin_build_rate(snd_pcm_plug_t *plug, 332int snd_pcm_plugin_build_rate(struct snd_pcm_substream *plug,
333 snd_pcm_plugin_format_t *src_format, 333 struct snd_pcm_plugin_format *src_format,
334 snd_pcm_plugin_format_t *dst_format, 334 struct snd_pcm_plugin_format *dst_format,
335 snd_pcm_plugin_t **r_plugin) 335 struct snd_pcm_plugin **r_plugin)
336{ 336{
337 int err; 337 int err;
338 rate_t *data; 338 struct rate_priv *data;
339 snd_pcm_plugin_t *plugin; 339 struct snd_pcm_plugin *plugin;
340 340
341 snd_assert(r_plugin != NULL, return -ENXIO); 341 snd_assert(r_plugin != NULL, return -ENXIO);
342 *r_plugin = NULL; 342 *r_plugin = NULL;
@@ -349,11 +349,12 @@ int snd_pcm_plugin_build_rate(snd_pcm_plug_t *plug,
349 349
350 err = snd_pcm_plugin_build(plug, "rate conversion", 350 err = snd_pcm_plugin_build(plug, "rate conversion",
351 src_format, dst_format, 351 src_format, dst_format,
352 sizeof(rate_t) + src_format->channels * sizeof(rate_channel_t), 352 sizeof(struct rate_priv) +
353 src_format->channels * sizeof(struct rate_channel),
353 &plugin); 354 &plugin);
354 if (err < 0) 355 if (err < 0)
355 return err; 356 return err;
356 data = (rate_t *)plugin->extra_data; 357 data = (struct rate_priv *)plugin->extra_data;
357 data->get = getput_index(src_format->format); 358 data->get = getput_index(src_format->format);
358 snd_assert(data->get >= 0 && data->get < 4*2*2, return -EINVAL); 359 snd_assert(data->get >= 0 && data->get < 4*2*2, return -EINVAL);
359 data->put = getput_index(dst_format->format); 360 data->put = getput_index(dst_format->format);
diff --git a/sound/core/oss/route.c b/sound/core/oss/route.c
index 7519aed757c..726c5caa3fd 100644
--- a/sound/core/oss/route.c
+++ b/sound/core/oss/route.c
@@ -35,61 +35,62 @@
35#error "Add some code here" 35#error "Add some code here"
36#endif 36#endif
37 37
38typedef struct ttable_dst ttable_dst_t; 38struct ttable_dst;
39typedef struct route_private_data route_t;
40 39
41typedef void (*route_channel_f)(snd_pcm_plugin_t *plugin, 40typedef void (*route_channel_f)(struct snd_pcm_plugin *plugin,
42 const snd_pcm_plugin_channel_t *src_channels, 41 const struct snd_pcm_plugin_channel *src_channels,
43 snd_pcm_plugin_channel_t *dst_channel, 42 struct snd_pcm_plugin_channel *dst_channel,
44 ttable_dst_t* ttable, snd_pcm_uframes_t frames); 43 struct ttable_dst *ttable, snd_pcm_uframes_t frames);
45 44
46typedef struct { 45struct ttable_src {
47 int channel; 46 int channel;
48 int as_int; 47 int as_int;
49} ttable_src_t; 48};
50 49
51struct ttable_dst { 50struct ttable_dst {
52 int att; /* Attenuated */ 51 int att; /* Attenuated */
53 unsigned int nsrcs; 52 unsigned int nsrcs;
54 ttable_src_t* srcs; 53 struct ttable_src *srcs;
55 route_channel_f func; 54 route_channel_f func;
56}; 55};
57 56
58struct route_private_data { 57struct route_priv {
59 enum {R_UINT32=0, R_UINT64=1} sum_type; 58 enum {R_UINT32=0, R_UINT64=1} sum_type;
60 int get, put; 59 int get, put;
61 int conv; 60 int conv;
62 int src_sample_size; 61 int src_sample_size;
63 ttable_dst_t ttable[0]; 62 struct ttable_dst ttable[0];
64}; 63};
65 64
66typedef union { 65union sum {
67 u_int32_t as_uint32; 66 u_int32_t as_uint32;
68 u_int64_t as_uint64; 67 u_int64_t as_uint64;
69} sum_t; 68};
70 69
71 70
72static void route_to_channel_from_zero(snd_pcm_plugin_t *plugin, 71static void route_to_channel_from_zero(struct snd_pcm_plugin *plugin,
73 const snd_pcm_plugin_channel_t *src_channels, 72 const struct snd_pcm_plugin_channel *src_channels,
74 snd_pcm_plugin_channel_t *dst_channel, 73 struct snd_pcm_plugin_channel *dst_channel,
75 ttable_dst_t* ttable, snd_pcm_uframes_t frames) 74 struct ttable_dst *ttable,
75 snd_pcm_uframes_t frames)
76{ 76{
77 if (dst_channel->wanted) 77 if (dst_channel->wanted)
78 snd_pcm_area_silence(&dst_channel->area, 0, frames, plugin->dst_format.format); 78 snd_pcm_area_silence(&dst_channel->area, 0, frames, plugin->dst_format.format);
79 dst_channel->enabled = 0; 79 dst_channel->enabled = 0;
80} 80}
81 81
82static void route_to_channel_from_one(snd_pcm_plugin_t *plugin, 82static void route_to_channel_from_one(struct snd_pcm_plugin *plugin,
83 const snd_pcm_plugin_channel_t *src_channels, 83 const struct snd_pcm_plugin_channel *src_channels,
84 snd_pcm_plugin_channel_t *dst_channel, 84 struct snd_pcm_plugin_channel *dst_channel,
85 ttable_dst_t* ttable, snd_pcm_uframes_t frames) 85 struct ttable_dst *ttable,
86 snd_pcm_uframes_t frames)
86{ 87{
87#define CONV_LABELS 88#define CONV_LABELS
88#include "plugin_ops.h" 89#include "plugin_ops.h"
89#undef CONV_LABELS 90#undef CONV_LABELS
90 route_t *data = (route_t *)plugin->extra_data; 91 struct route_priv *data = (struct route_priv *)plugin->extra_data;
91 void *conv; 92 void *conv;
92 const snd_pcm_plugin_channel_t *src_channel = NULL; 93 const struct snd_pcm_plugin_channel *src_channel = NULL;
93 unsigned int srcidx; 94 unsigned int srcidx;
94 char *src, *dst; 95 char *src, *dst;
95 int src_step, dst_step; 96 int src_step, dst_step;
@@ -120,10 +121,10 @@ static void route_to_channel_from_one(snd_pcm_plugin_t *plugin,
120 } 121 }
121} 122}
122 123
123static void route_to_channel(snd_pcm_plugin_t *plugin, 124static void route_to_channel(struct snd_pcm_plugin *plugin,
124 const snd_pcm_plugin_channel_t *src_channels, 125 const struct snd_pcm_plugin_channel *src_channels,
125 snd_pcm_plugin_channel_t *dst_channel, 126 struct snd_pcm_plugin_channel *dst_channel,
126 ttable_dst_t* ttable, snd_pcm_uframes_t frames) 127 struct ttable_dst *ttable, snd_pcm_uframes_t frames)
127{ 128{
128#define GET_U_LABELS 129#define GET_U_LABELS
129#define PUT_U32_LABELS 130#define PUT_U32_LABELS
@@ -153,18 +154,18 @@ static void route_to_channel(snd_pcm_plugin_t *plugin,
153 &&norm_int64_16_att, 154 &&norm_int64_16_att,
154 &&norm_int64_24_att, 155 &&norm_int64_24_att,
155 }; 156 };
156 route_t *data = (route_t *)plugin->extra_data; 157 struct route_priv *data = (struct route_priv *)plugin->extra_data;
157 void *zero, *get, *add, *norm, *put_u32; 158 void *zero, *get, *add, *norm, *put_u32;
158 int nsrcs = ttable->nsrcs; 159 int nsrcs = ttable->nsrcs;
159 char *dst; 160 char *dst;
160 int dst_step; 161 int dst_step;
161 char *srcs[nsrcs]; 162 char *srcs[nsrcs];
162 int src_steps[nsrcs]; 163 int src_steps[nsrcs];
163 ttable_src_t src_tt[nsrcs]; 164 struct ttable_src src_tt[nsrcs];
164 u_int32_t sample = 0; 165 u_int32_t sample = 0;
165 int srcidx, srcidx1 = 0; 166 int srcidx, srcidx1 = 0;
166 for (srcidx = 0; srcidx < nsrcs; ++srcidx) { 167 for (srcidx = 0; srcidx < nsrcs; ++srcidx) {
167 const snd_pcm_plugin_channel_t *src_channel = &src_channels[ttable->srcs[srcidx].channel]; 168 const struct snd_pcm_plugin_channel *src_channel = &src_channels[ttable->srcs[srcidx].channel];
168 if (!src_channel->enabled) 169 if (!src_channel->enabled)
169 continue; 170 continue;
170 srcs[srcidx1] = src_channel->area.addr + src_channel->area.first / 8; 171 srcs[srcidx1] = src_channel->area.addr + src_channel->area.first / 8;
@@ -191,8 +192,8 @@ static void route_to_channel(snd_pcm_plugin_t *plugin,
191 dst_step = dst_channel->area.step / 8; 192 dst_step = dst_channel->area.step / 8;
192 193
193 while (frames-- > 0) { 194 while (frames-- > 0) {
194 ttable_src_t *ttp = src_tt; 195 struct ttable_src *ttp = src_tt;
195 sum_t sum; 196 union sum sum;
196 197
197 /* Zero sum */ 198 /* Zero sum */
198 goto *zero; 199 goto *zero;
@@ -297,20 +298,20 @@ static void route_to_channel(snd_pcm_plugin_t *plugin,
297 } 298 }
298} 299}
299 300
300static int route_src_channels_mask(snd_pcm_plugin_t *plugin, 301static int route_src_channels_mask(struct snd_pcm_plugin *plugin,
301 unsigned long *dst_vmask, 302 unsigned long *dst_vmask,
302 unsigned long **src_vmask) 303 unsigned long **src_vmask)
303{ 304{
304 route_t *data = (route_t *)plugin->extra_data; 305 struct route_priv *data = (struct route_priv *)plugin->extra_data;
305 int schannels = plugin->src_format.channels; 306 int schannels = plugin->src_format.channels;
306 int dchannels = plugin->dst_format.channels; 307 int dchannels = plugin->dst_format.channels;
307 unsigned long *vmask = plugin->src_vmask; 308 unsigned long *vmask = plugin->src_vmask;
308 int channel; 309 int channel;
309 ttable_dst_t *dp = data->ttable; 310 struct ttable_dst *dp = data->ttable;
310 bitmap_zero(vmask, schannels); 311 bitmap_zero(vmask, schannels);
311 for (channel = 0; channel < dchannels; channel++, dp++) { 312 for (channel = 0; channel < dchannels; channel++, dp++) {
312 unsigned int src; 313 unsigned int src;
313 ttable_src_t *sp; 314 struct ttable_src *sp;
314 if (!test_bit(channel, dst_vmask)) 315 if (!test_bit(channel, dst_vmask))
315 continue; 316 continue;
316 sp = dp->srcs; 317 sp = dp->srcs;
@@ -321,19 +322,19 @@ static int route_src_channels_mask(snd_pcm_plugin_t *plugin,
321 return 0; 322 return 0;
322} 323}
323 324
324static int route_dst_channels_mask(snd_pcm_plugin_t *plugin, 325static int route_dst_channels_mask(struct snd_pcm_plugin *plugin,
325 unsigned long *src_vmask, 326 unsigned long *src_vmask,
326 unsigned long **dst_vmask) 327 unsigned long **dst_vmask)
327{ 328{
328 route_t *data = (route_t *)plugin->extra_data; 329 struct route_priv *data = (struct route_priv *)plugin->extra_data;
329 int dchannels = plugin->dst_format.channels; 330 int dchannels = plugin->dst_format.channels;
330 unsigned long *vmask = plugin->dst_vmask; 331 unsigned long *vmask = plugin->dst_vmask;
331 int channel; 332 int channel;
332 ttable_dst_t *dp = data->ttable; 333 struct ttable_dst *dp = data->ttable;
333 bitmap_zero(vmask, dchannels); 334 bitmap_zero(vmask, dchannels);
334 for (channel = 0; channel < dchannels; channel++, dp++) { 335 for (channel = 0; channel < dchannels; channel++, dp++) {
335 unsigned int src; 336 unsigned int src;
336 ttable_src_t *sp; 337 struct ttable_src *sp;
337 sp = dp->srcs; 338 sp = dp->srcs;
338 for (src = 0; src < dp->nsrcs; src++, sp++) { 339 for (src = 0; src < dp->nsrcs; src++, sp++) {
339 if (test_bit(sp->channel, src_vmask)) { 340 if (test_bit(sp->channel, src_vmask)) {
@@ -346,33 +347,33 @@ static int route_dst_channels_mask(snd_pcm_plugin_t *plugin,
346 return 0; 347 return 0;
347} 348}
348 349
349static void route_free(snd_pcm_plugin_t *plugin) 350static void route_free(struct snd_pcm_plugin *plugin)
350{ 351{
351 route_t *data = (route_t *)plugin->extra_data; 352 struct route_priv *data = (struct route_priv *)plugin->extra_data;
352 unsigned int dst_channel; 353 unsigned int dst_channel;
353 for (dst_channel = 0; dst_channel < plugin->dst_format.channels; ++dst_channel) { 354 for (dst_channel = 0; dst_channel < plugin->dst_format.channels; ++dst_channel) {
354 kfree(data->ttable[dst_channel].srcs); 355 kfree(data->ttable[dst_channel].srcs);
355 } 356 }
356} 357}
357 358
358static int route_load_ttable(snd_pcm_plugin_t *plugin, 359static int route_load_ttable(struct snd_pcm_plugin *plugin,
359 const route_ttable_entry_t* src_ttable) 360 const int *src_ttable)
360{ 361{
361 route_t *data; 362 struct route_priv *data;
362 unsigned int src_channel, dst_channel; 363 unsigned int src_channel, dst_channel;
363 const route_ttable_entry_t *sptr; 364 const int *sptr;
364 ttable_dst_t *dptr; 365 struct ttable_dst *dptr;
365 if (src_ttable == NULL) 366 if (src_ttable == NULL)
366 return 0; 367 return 0;
367 data = (route_t *)plugin->extra_data; 368 data = (struct route_priv *)plugin->extra_data;
368 dptr = data->ttable; 369 dptr = data->ttable;
369 sptr = src_ttable; 370 sptr = src_ttable;
370 plugin->private_free = route_free; 371 plugin->private_free = route_free;
371 for (dst_channel = 0; dst_channel < plugin->dst_format.channels; ++dst_channel) { 372 for (dst_channel = 0; dst_channel < plugin->dst_format.channels; ++dst_channel) {
372 route_ttable_entry_t t = 0; 373 int t = 0;
373 int att = 0; 374 int att = 0;
374 int nsrcs = 0; 375 int nsrcs = 0;
375 ttable_src_t srcs[plugin->src_format.channels]; 376 struct ttable_src srcs[plugin->src_format.channels];
376 for (src_channel = 0; src_channel < plugin->src_format.channels; ++src_channel) { 377 for (src_channel = 0; src_channel < plugin->src_format.channels; ++src_channel) {
377 snd_assert(*sptr >= 0 || *sptr <= FULL, return -ENXIO); 378 snd_assert(*sptr >= 0 || *sptr <= FULL, return -ENXIO);
378 if (*sptr != 0) { 379 if (*sptr != 0) {
@@ -405,21 +406,21 @@ static int route_load_ttable(snd_pcm_plugin_t *plugin,
405 return 0; 406 return 0;
406} 407}
407 408
408static snd_pcm_sframes_t route_transfer(snd_pcm_plugin_t *plugin, 409static snd_pcm_sframes_t route_transfer(struct snd_pcm_plugin *plugin,
409 const snd_pcm_plugin_channel_t *src_channels, 410 const struct snd_pcm_plugin_channel *src_channels,
410 snd_pcm_plugin_channel_t *dst_channels, 411 struct snd_pcm_plugin_channel *dst_channels,
411 snd_pcm_uframes_t frames) 412 snd_pcm_uframes_t frames)
412{ 413{
413 route_t *data; 414 struct route_priv *data;
414 int src_nchannels, dst_nchannels; 415 int src_nchannels, dst_nchannels;
415 int dst_channel; 416 int dst_channel;
416 ttable_dst_t *ttp; 417 struct ttable_dst *ttp;
417 snd_pcm_plugin_channel_t *dvp; 418 struct snd_pcm_plugin_channel *dvp;
418 419
419 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO); 420 snd_assert(plugin != NULL && src_channels != NULL && dst_channels != NULL, return -ENXIO);
420 if (frames == 0) 421 if (frames == 0)
421 return 0; 422 return 0;
422 data = (route_t *)plugin->extra_data; 423 data = (struct route_priv *)plugin->extra_data;
423 424
424 src_nchannels = plugin->src_format.channels; 425 src_nchannels = plugin->src_format.channels;
425 dst_nchannels = plugin->dst_format.channels; 426 dst_nchannels = plugin->dst_format.channels;
@@ -469,14 +470,14 @@ int getput_index(int format)
469 return width * 4 + endian * 2 + sign; 470 return width * 4 + endian * 2 + sign;
470} 471}
471 472
472int snd_pcm_plugin_build_route(snd_pcm_plug_t *plug, 473int snd_pcm_plugin_build_route(struct snd_pcm_substream *plug,
473 snd_pcm_plugin_format_t *src_format, 474 struct snd_pcm_plugin_format *src_format,
474 snd_pcm_plugin_format_t *dst_format, 475 struct snd_pcm_plugin_format *dst_format,
475 route_ttable_entry_t *ttable, 476 int *ttable,
476 snd_pcm_plugin_t **r_plugin) 477 struct snd_pcm_plugin **r_plugin)
477{ 478{
478 route_t *data; 479 struct route_priv *data;
479 snd_pcm_plugin_t *plugin; 480 struct snd_pcm_plugin *plugin;
480 int err; 481 int err;
481 482
482 snd_assert(r_plugin != NULL, return -ENXIO); 483 snd_assert(r_plugin != NULL, return -ENXIO);
@@ -488,12 +489,13 @@ int snd_pcm_plugin_build_route(snd_pcm_plug_t *plug,
488 489
489 err = snd_pcm_plugin_build(plug, "attenuated route conversion", 490 err = snd_pcm_plugin_build(plug, "attenuated route conversion",
490 src_format, dst_format, 491 src_format, dst_format,
491 sizeof(route_t) + sizeof(data->ttable[0]) * dst_format->channels, 492 sizeof(struct route_priv) +
493 sizeof(data->ttable[0]) * dst_format->channels,
492 &plugin); 494 &plugin);
493 if (err < 0) 495 if (err < 0)
494 return err; 496 return err;
495 497
496 data = (route_t *) plugin->extra_data; 498 data = (struct route_priv *)plugin->extra_data;
497 499
498 data->get = getput_index(src_format->format); 500 data->get = getput_index(src_format->format);
499 snd_assert(data->get >= 0 && data->get < 4*2*2, return -EINVAL); 501 snd_assert(data->get >= 0 && data->get < 4*2*2, return -EINVAL);