aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usx2y/usbusx2yaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usx2y/usbusx2yaudio.c')
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c383
1 files changed, 196 insertions, 187 deletions
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index affda973cece..a6bbc7a6348f 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -67,18 +67,20 @@
67#endif 67#endif
68 68
69 69
70static int usX2Y_urb_capt_retire(snd_usX2Y_substream_t *subs) 70static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs)
71{ 71{
72 struct urb *urb = subs->completed_urb; 72 struct urb *urb = subs->completed_urb;
73 snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; 73 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
74 unsigned char *cp; 74 unsigned char *cp;
75 int i, len, lens = 0, hwptr_done = subs->hwptr_done; 75 int i, len, lens = 0, hwptr_done = subs->hwptr_done;
76 usX2Ydev_t *usX2Y = subs->usX2Y; 76 struct usX2Ydev *usX2Y = subs->usX2Y;
77 77
78 for (i = 0; i < nr_of_packs(); i++) { 78 for (i = 0; i < nr_of_packs(); i++) {
79 cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset; 79 cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
80 if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */ 80 if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */
81 snd_printk(KERN_ERR "activ frame status %i. Most propably some hardware problem.\n", urb->iso_frame_desc[i].status); 81 snd_printk(KERN_ERR "active frame status %i. "
82 "Most propably some hardware problem.\n",
83 urb->iso_frame_desc[i].status);
82 return urb->iso_frame_desc[i].status; 84 return urb->iso_frame_desc[i].status;
83 } 85 }
84 len = urb->iso_frame_desc[i].actual_length / usX2Y->stride; 86 len = urb->iso_frame_desc[i].actual_length / usX2Y->stride;
@@ -94,7 +96,8 @@ static int usX2Y_urb_capt_retire(snd_usX2Y_substream_t *subs)
94 memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, blen); 96 memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, blen);
95 memcpy(runtime->dma_area, cp + blen, len * usX2Y->stride - blen); 97 memcpy(runtime->dma_area, cp + blen, len * usX2Y->stride - blen);
96 } else { 98 } else {
97 memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, len * usX2Y->stride); 99 memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp,
100 len * usX2Y->stride);
98 } 101 }
99 lens += len; 102 lens += len;
100 if ((hwptr_done += len) >= runtime->buffer_size) 103 if ((hwptr_done += len) >= runtime->buffer_size)
@@ -120,13 +123,13 @@ static int usX2Y_urb_capt_retire(snd_usX2Y_substream_t *subs)
120 * it directly from the buffer. thus the data is once copied to 123 * it directly from the buffer. thus the data is once copied to
121 * a temporary buffer and urb points to that. 124 * a temporary buffer and urb points to that.
122 */ 125 */
123static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs, 126static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs,
124 struct urb *cap_urb, 127 struct urb *cap_urb,
125 struct urb *urb) 128 struct urb *urb)
126{ 129{
127 int count, counts, pack; 130 int count, counts, pack;
128 usX2Ydev_t* usX2Y = subs->usX2Y; 131 struct usX2Ydev *usX2Y = subs->usX2Y;
129 snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; 132 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
130 133
131 count = 0; 134 count = 0;
132 for (pack = 0; pack < nr_of_packs(); pack++) { 135 for (pack = 0; pack < nr_of_packs(); pack++) {
@@ -139,7 +142,8 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs,
139 } 142 }
140 /* set up descriptor */ 143 /* set up descriptor */
141 urb->iso_frame_desc[pack].offset = pack ? 144 urb->iso_frame_desc[pack].offset = pack ?
142 urb->iso_frame_desc[pack - 1].offset + urb->iso_frame_desc[pack - 1].length : 145 urb->iso_frame_desc[pack - 1].offset +
146 urb->iso_frame_desc[pack - 1].length :
143 0; 147 0;
144 urb->iso_frame_desc[pack].length = cap_urb->iso_frame_desc[pack].actual_length; 148 urb->iso_frame_desc[pack].length = cap_urb->iso_frame_desc[pack].actual_length;
145 } 149 }
@@ -151,8 +155,10 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs,
151 int len; 155 int len;
152 len = runtime->buffer_size - subs->hwptr; 156 len = runtime->buffer_size - subs->hwptr;
153 urb->transfer_buffer = subs->tmpbuf; 157 urb->transfer_buffer = subs->tmpbuf;
154 memcpy(subs->tmpbuf, runtime->dma_area + subs->hwptr * usX2Y->stride, len * usX2Y->stride); 158 memcpy(subs->tmpbuf, runtime->dma_area +
155 memcpy(subs->tmpbuf + len * usX2Y->stride, runtime->dma_area, (count - len) * usX2Y->stride); 159 subs->hwptr * usX2Y->stride, len * usX2Y->stride);
160 memcpy(subs->tmpbuf + len * usX2Y->stride,
161 runtime->dma_area, (count - len) * usX2Y->stride);
156 subs->hwptr += count; 162 subs->hwptr += count;
157 subs->hwptr -= runtime->buffer_size; 163 subs->hwptr -= runtime->buffer_size;
158 } else { 164 } else {
@@ -172,9 +178,9 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs,
172 * 178 *
173 * update the current position and call callback if a period is processed. 179 * update the current position and call callback if a period is processed.
174 */ 180 */
175static void usX2Y_urb_play_retire(snd_usX2Y_substream_t *subs, struct urb *urb) 181static void usX2Y_urb_play_retire(struct snd_usX2Y_substream *subs, struct urb *urb)
176{ 182{
177 snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; 183 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
178 int len = urb->actual_length / subs->usX2Y->stride; 184 int len = urb->actual_length / subs->usX2Y->stride;
179 185
180 subs->transfer_done += len; 186 subs->transfer_done += len;
@@ -187,7 +193,7 @@ static void usX2Y_urb_play_retire(snd_usX2Y_substream_t *subs, struct urb *urb)
187 } 193 }
188} 194}
189 195
190static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int frame) 196static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, int frame)
191{ 197{
192 int err; 198 int err;
193 if (!urb) 199 if (!urb)
@@ -202,50 +208,47 @@ static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int fr
202 return 0; 208 return 0;
203} 209}
204 210
205static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_usX2Y_substream_t *playbacksubs, int frame) 211static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs,
212 struct snd_usX2Y_substream *playbacksubs,
213 int frame)
206{ 214{
207 int err, state; 215 int err, state;
208 { 216 struct urb *urb = playbacksubs->completed_urb;
209 struct urb *urb = playbacksubs->completed_urb; 217
210 218 state = atomic_read(&playbacksubs->state);
211 state = atomic_read(&playbacksubs->state); 219 if (NULL != urb) {
212 if (NULL != urb) { 220 if (state == state_RUNNING)
213 if (state == state_RUNNING) 221 usX2Y_urb_play_retire(playbacksubs, urb);
214 usX2Y_urb_play_retire(playbacksubs, urb); 222 else if (state >= state_PRERUNNING)
215 else 223 atomic_inc(&playbacksubs->state);
216 if (state >= state_PRERUNNING) { 224 } else {
217 atomic_inc(&playbacksubs->state); 225 switch (state) {
218 } 226 case state_STARTING1:
219 } else { 227 urb = playbacksubs->urb[0];
220 switch (state) { 228 atomic_inc(&playbacksubs->state);
221 case state_STARTING1: 229 break;
222 urb = playbacksubs->urb[0]; 230 case state_STARTING2:
223 atomic_inc(&playbacksubs->state); 231 urb = playbacksubs->urb[1];
224 break; 232 atomic_inc(&playbacksubs->state);
225 case state_STARTING2: 233 break;
226 urb = playbacksubs->urb[1];
227 atomic_inc(&playbacksubs->state);
228 break;
229 }
230 } 234 }
231 if (urb) { 235 }
232 if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || 236 if (urb) {
233 (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { 237 if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) ||
234 return err; 238 (err = usX2Y_urb_submit(playbacksubs, urb, frame))) {
235 } 239 return err;
236 } 240 }
237
238 playbacksubs->completed_urb = NULL;
239 } 241 }
242
243 playbacksubs->completed_urb = NULL;
244
240 state = atomic_read(&capsubs->state); 245 state = atomic_read(&capsubs->state);
241 if (state >= state_PREPARED) { 246 if (state >= state_PREPARED) {
242 if (state == state_RUNNING) { 247 if (state == state_RUNNING) {
243 if ((err = usX2Y_urb_capt_retire(capsubs))) 248 if ((err = usX2Y_urb_capt_retire(capsubs)))
244 return err; 249 return err;
245 } else 250 } else if (state >= state_PRERUNNING)
246 if (state >= state_PRERUNNING) { 251 atomic_inc(&capsubs->state);
247 atomic_inc(&capsubs->state);
248 }
249 if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) 252 if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame)))
250 return err; 253 return err;
251 } 254 }
@@ -254,18 +257,19 @@ static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_us
254} 257}
255 258
256 259
257static void usX2Y_clients_stop(usX2Ydev_t *usX2Y) 260static void usX2Y_clients_stop(struct usX2Ydev *usX2Y)
258{ 261{
259 int s, u; 262 int s, u;
263
260 for (s = 0; s < 4; s++) { 264 for (s = 0; s < 4; s++) {
261 snd_usX2Y_substream_t *subs = usX2Y->subs[s]; 265 struct snd_usX2Y_substream *subs = usX2Y->subs[s];
262 if (subs) { 266 if (subs) {
263 snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state)); 267 snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state));
264 atomic_set(&subs->state, state_STOPPED); 268 atomic_set(&subs->state, state_STOPPED);
265 } 269 }
266 } 270 }
267 for (s = 0; s < 4; s++) { 271 for (s = 0; s < 4; s++) {
268 snd_usX2Y_substream_t *subs = usX2Y->subs[s]; 272 struct snd_usX2Y_substream *subs = usX2Y->subs[s];
269 if (subs) { 273 if (subs) {
270 if (atomic_read(&subs->state) >= state_PRERUNNING) { 274 if (atomic_read(&subs->state) >= state_PRERUNNING) {
271 snd_pcm_stop(subs->pcm_substream, SNDRV_PCM_STATE_XRUN); 275 snd_pcm_stop(subs->pcm_substream, SNDRV_PCM_STATE_XRUN);
@@ -273,7 +277,8 @@ static void usX2Y_clients_stop(usX2Ydev_t *usX2Y)
273 for (u = 0; u < NRURBS; u++) { 277 for (u = 0; u < NRURBS; u++) {
274 struct urb *urb = subs->urb[u]; 278 struct urb *urb = subs->urb[u];
275 if (NULL != urb) 279 if (NULL != urb)
276 snd_printdd("%i status=%i start_frame=%i\n", u, urb->status, urb->start_frame); 280 snd_printdd("%i status=%i start_frame=%i\n",
281 u, urb->status, urb->start_frame);
277 } 282 }
278 } 283 }
279 } 284 }
@@ -281,30 +286,36 @@ static void usX2Y_clients_stop(usX2Ydev_t *usX2Y)
281 wake_up(&usX2Y->prepare_wait_queue); 286 wake_up(&usX2Y->prepare_wait_queue);
282} 287}
283 288
284static void usX2Y_error_urb_status(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) 289static void usX2Y_error_urb_status(struct usX2Ydev *usX2Y,
290 struct snd_usX2Y_substream *subs, struct urb *urb)
285{ 291{
286 snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status); 292 snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status);
287 urb->status = 0; 293 urb->status = 0;
288 usX2Y_clients_stop(usX2Y); 294 usX2Y_clients_stop(usX2Y);
289} 295}
290 296
291static void usX2Y_error_sequence(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) 297static void usX2Y_error_sequence(struct usX2Ydev *usX2Y,
298 struct snd_usX2Y_substream *subs, struct urb *urb)
292{ 299{
293 snd_printk(KERN_ERR "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" 300 snd_printk(KERN_ERR "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n"
294 KERN_ERR "Most propably some urb of usb-frame %i is still missing.\n" 301 KERN_ERR "Most propably some urb of usb-frame %i is still missing.\n"
295 KERN_ERR "Cause could be too long delays in usb-hcd interrupt handling.\n", 302 KERN_ERR "Cause could be too long delays in usb-hcd interrupt handling.\n",
296 usb_get_current_frame_number(usX2Y->chip.dev), 303 usb_get_current_frame_number(usX2Y->chip.dev),
297 subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); 304 subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
305 usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame);
298 usX2Y_clients_stop(usX2Y); 306 usX2Y_clients_stop(usX2Y);
299} 307}
300 308
301static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs) 309static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs)
302{ 310{
303 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; 311 struct snd_usX2Y_substream *subs = urb->context;
304 usX2Ydev_t *usX2Y = subs->usX2Y; 312 struct usX2Ydev *usX2Y = subs->usX2Y;
305 313
306 if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { 314 if (unlikely(atomic_read(&subs->state) < state_PREPARED)) {
307 snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", usb_get_current_frame_number(usX2Y->chip.dev), subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", urb->status, urb->start_frame); 315 snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
316 usb_get_current_frame_number(usX2Y->chip.dev),
317 subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
318 urb->status, urb->start_frame);
308 return; 319 return;
309 } 320 }
310 if (unlikely(urb->status)) { 321 if (unlikely(urb->status)) {
@@ -318,10 +329,12 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs)
318 return; 329 return;
319 } 330 }
320 { 331 {
321 snd_usX2Y_substream_t *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE], 332 struct snd_usX2Y_substream *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE],
322 *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; 333 *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
323 if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED && 334 if (capsubs->completed_urb &&
324 (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) { 335 atomic_read(&capsubs->state) >= state_PREPARED &&
336 (playbacksubs->completed_urb ||
337 atomic_read(&playbacksubs->state) < state_PREPARED)) {
325 if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) { 338 if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) {
326 if (nr_of_packs() <= urb->start_frame && 339 if (nr_of_packs() <= urb->start_frame &&
327 urb->start_frame <= (2 * nr_of_packs() - 1)) // uhci and ohci 340 urb->start_frame <= (2 * nr_of_packs() - 1)) // uhci and ohci
@@ -336,11 +349,12 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs)
336 } 349 }
337} 350}
338 351
339static void usX2Y_urbs_set_complete(usX2Ydev_t * usX2Y, void (*complete)(struct urb *, struct pt_regs *)) 352static void usX2Y_urbs_set_complete(struct usX2Ydev * usX2Y,
353 void (*complete)(struct urb *, struct pt_regs *))
340{ 354{
341 int s, u; 355 int s, u;
342 for (s = 0; s < 4; s++) { 356 for (s = 0; s < 4; s++) {
343 snd_usX2Y_substream_t *subs = usX2Y->subs[s]; 357 struct snd_usX2Y_substream *subs = usX2Y->subs[s];
344 if (NULL != subs) 358 if (NULL != subs)
345 for (u = 0; u < NRURBS; u++) { 359 for (u = 0; u < NRURBS; u++) {
346 struct urb * urb = subs->urb[u]; 360 struct urb * urb = subs->urb[u];
@@ -350,7 +364,7 @@ static void usX2Y_urbs_set_complete(usX2Ydev_t * usX2Y, void (*complete)(struct
350 } 364 }
351} 365}
352 366
353static void usX2Y_subs_startup_finish(usX2Ydev_t * usX2Y) 367static void usX2Y_subs_startup_finish(struct usX2Ydev * usX2Y)
354{ 368{
355 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_urb_complete); 369 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_urb_complete);
356 usX2Y->prepare_subs = NULL; 370 usX2Y->prepare_subs = NULL;
@@ -358,9 +372,9 @@ static void usX2Y_subs_startup_finish(usX2Ydev_t * usX2Y)
358 372
359static void i_usX2Y_subs_startup(struct urb *urb, struct pt_regs *regs) 373static void i_usX2Y_subs_startup(struct urb *urb, struct pt_regs *regs)
360{ 374{
361 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; 375 struct snd_usX2Y_substream *subs = urb->context;
362 usX2Ydev_t *usX2Y = subs->usX2Y; 376 struct usX2Ydev *usX2Y = subs->usX2Y;
363 snd_usX2Y_substream_t *prepare_subs = usX2Y->prepare_subs; 377 struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs;
364 if (NULL != prepare_subs) 378 if (NULL != prepare_subs)
365 if (urb->start_frame == prepare_subs->urb[0]->start_frame) { 379 if (urb->start_frame == prepare_subs->urb[0]->start_frame) {
366 usX2Y_subs_startup_finish(usX2Y); 380 usX2Y_subs_startup_finish(usX2Y);
@@ -371,9 +385,10 @@ static void i_usX2Y_subs_startup(struct urb *urb, struct pt_regs *regs)
371 i_usX2Y_urb_complete(urb, regs); 385 i_usX2Y_urb_complete(urb, regs);
372} 386}
373 387
374static void usX2Y_subs_prepare(snd_usX2Y_substream_t *subs) 388static void usX2Y_subs_prepare(struct snd_usX2Y_substream *subs)
375{ 389{
376 snd_printdd("usX2Y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", subs, subs->endpoint, subs->urb[0], subs->urb[1]); 390 snd_printdd("usX2Y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n",
391 subs, subs->endpoint, subs->urb[0], subs->urb[1]);
377 /* reset the pointer */ 392 /* reset the pointer */
378 subs->hwptr = 0; 393 subs->hwptr = 0;
379 subs->hwptr_done = 0; 394 subs->hwptr_done = 0;
@@ -381,7 +396,7 @@ static void usX2Y_subs_prepare(snd_usX2Y_substream_t *subs)
381} 396}
382 397
383 398
384static void usX2Y_urb_release(struct urb** urb, int free_tb) 399static void usX2Y_urb_release(struct urb **urb, int free_tb)
385{ 400{
386 if (*urb) { 401 if (*urb) {
387 usb_kill_urb(*urb); 402 usb_kill_urb(*urb);
@@ -394,12 +409,13 @@ static void usX2Y_urb_release(struct urb** urb, int free_tb)
394/* 409/*
395 * release a substreams urbs 410 * release a substreams urbs
396 */ 411 */
397static void usX2Y_urbs_release(snd_usX2Y_substream_t *subs) 412static void usX2Y_urbs_release(struct snd_usX2Y_substream *subs)
398{ 413{
399 int i; 414 int i;
400 snd_printdd("usX2Y_urbs_release() %i\n", subs->endpoint); 415 snd_printdd("usX2Y_urbs_release() %i\n", subs->endpoint);
401 for (i = 0; i < NRURBS; i++) 416 for (i = 0; i < NRURBS; i++)
402 usX2Y_urb_release(subs->urb + i, subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]); 417 usX2Y_urb_release(subs->urb + i,
418 subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]);
403 419
404 kfree(subs->tmpbuf); 420 kfree(subs->tmpbuf);
405 subs->tmpbuf = NULL; 421 subs->tmpbuf = NULL;
@@ -407,7 +423,7 @@ static void usX2Y_urbs_release(snd_usX2Y_substream_t *subs)
407/* 423/*
408 * initialize a substream's urbs 424 * initialize a substream's urbs
409 */ 425 */
410static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs) 426static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs)
411{ 427{
412 int i; 428 int i;
413 unsigned int pipe; 429 unsigned int pipe;
@@ -429,7 +445,7 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs)
429 } 445 }
430 /* allocate and initialize data urbs */ 446 /* allocate and initialize data urbs */
431 for (i = 0; i < NRURBS; i++) { 447 for (i = 0; i < NRURBS; i++) {
432 struct urb** purb = subs->urb + i; 448 struct urb **purb = subs->urb + i;
433 if (*purb) { 449 if (*purb) {
434 usb_kill_urb(*purb); 450 usb_kill_urb(*purb);
435 continue; 451 continue;
@@ -457,70 +473,68 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs)
457 return 0; 473 return 0;
458} 474}
459 475
460static void usX2Y_subs_startup(snd_usX2Y_substream_t *subs) 476static void usX2Y_subs_startup(struct snd_usX2Y_substream *subs)
461{ 477{
462 usX2Ydev_t *usX2Y = subs->usX2Y; 478 struct usX2Ydev *usX2Y = subs->usX2Y;
463 usX2Y->prepare_subs = subs; 479 usX2Y->prepare_subs = subs;
464 subs->urb[0]->start_frame = -1; 480 subs->urb[0]->start_frame = -1;
465 wmb(); 481 wmb();
466 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_subs_startup); 482 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_subs_startup);
467} 483}
468 484
469static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs) 485static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
470{ 486{
471 int i, err; 487 int i, err;
472 usX2Ydev_t *usX2Y = subs->usX2Y; 488 struct usX2Ydev *usX2Y = subs->usX2Y;
473 489
474 if ((err = usX2Y_urbs_allocate(subs)) < 0) 490 if ((err = usX2Y_urbs_allocate(subs)) < 0)
475 return err; 491 return err;
476 subs->completed_urb = NULL; 492 subs->completed_urb = NULL;
477 for (i = 0; i < 4; i++) { 493 for (i = 0; i < 4; i++) {
478 snd_usX2Y_substream_t *subs = usX2Y->subs[i]; 494 struct snd_usX2Y_substream *subs = usX2Y->subs[i];
479 if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) 495 if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
480 goto start; 496 goto start;
481 } 497 }
482 usX2Y->wait_iso_frame = -1; 498 usX2Y->wait_iso_frame = -1;
499
483 start: 500 start:
484 { 501 usX2Y_subs_startup(subs);
485 usX2Y_subs_startup(subs); 502 for (i = 0; i < NRURBS; i++) {
486 for (i = 0; i < NRURBS; i++) { 503 struct urb *urb = subs->urb[i];
487 struct urb *urb = subs->urb[i]; 504 if (usb_pipein(urb->pipe)) {
488 if (usb_pipein(urb->pipe)) { 505 unsigned long pack;
489 unsigned long pack; 506 if (0 == i)
490 if (0 == i) 507 atomic_set(&subs->state, state_STARTING3);
491 atomic_set(&subs->state, state_STARTING3); 508 urb->dev = usX2Y->chip.dev;
492 urb->dev = usX2Y->chip.dev; 509 urb->transfer_flags = URB_ISO_ASAP;
493 urb->transfer_flags = URB_ISO_ASAP; 510 for (pack = 0; pack < nr_of_packs(); pack++) {
494 for (pack = 0; pack < nr_of_packs(); pack++) { 511 urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack;
495 urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; 512 urb->iso_frame_desc[pack].length = subs->maxpacksize;
496 urb->iso_frame_desc[pack].length = subs->maxpacksize; 513 }
497 } 514 urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs();
498 urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); 515 if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
499 if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 516 snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
500 snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); 517 err = -EPIPE;
501 err = -EPIPE; 518 goto cleanup;
502 goto cleanup;
503 } else {
504 if (0 > usX2Y->wait_iso_frame)
505 usX2Y->wait_iso_frame = urb->start_frame;
506 }
507 urb->transfer_flags = 0;
508 } else { 519 } else {
509 atomic_set(&subs->state, state_STARTING1); 520 if (0 > usX2Y->wait_iso_frame)
510 break; 521 usX2Y->wait_iso_frame = urb->start_frame;
511 } 522 }
523 urb->transfer_flags = 0;
524 } else {
525 atomic_set(&subs->state, state_STARTING1);
526 break;
512 } 527 }
513 err = 0; 528 }
514 wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); 529 err = 0;
515 if (atomic_read(&subs->state) != state_PREPARED) { 530 wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs);
516 err = -EPIPE; 531 if (atomic_read(&subs->state) != state_PREPARED)
517 } 532 err = -EPIPE;
518 533
519 cleanup: 534 cleanup:
520 if (err) { 535 if (err) {
521 usX2Y_subs_startup_finish(usX2Y); 536 usX2Y_subs_startup_finish(usX2Y);
522 usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything 537 usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything
523 }
524 } 538 }
525 return err; 539 return err;
526} 540}
@@ -528,17 +542,17 @@ static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs)
528/* 542/*
529 * return the current pcm pointer. just return the hwptr_done value. 543 * return the current pcm pointer. just return the hwptr_done value.
530 */ 544 */
531static snd_pcm_uframes_t snd_usX2Y_pcm_pointer(snd_pcm_substream_t *substream) 545static snd_pcm_uframes_t snd_usX2Y_pcm_pointer(struct snd_pcm_substream *substream)
532{ 546{
533 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)substream->runtime->private_data; 547 struct snd_usX2Y_substream *subs = substream->runtime->private_data;
534 return subs->hwptr_done; 548 return subs->hwptr_done;
535} 549}
536/* 550/*
537 * start/stop substream 551 * start/stop substream
538 */ 552 */
539static int snd_usX2Y_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 553static int snd_usX2Y_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
540{ 554{
541 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)substream->runtime->private_data; 555 struct snd_usX2Y_substream *subs = substream->runtime->private_data;
542 556
543 switch (cmd) { 557 switch (cmd) {
544 case SNDRV_PCM_TRIGGER_START: 558 case SNDRV_PCM_TRIGGER_START:
@@ -649,9 +663,9 @@ static struct s_c2 SetRate48000[] =
649}; 663};
650#define NOOF_SETRATE_URBS ARRAY_SIZE(SetRate48000) 664#define NOOF_SETRATE_URBS ARRAY_SIZE(SetRate48000)
651 665
652static void i_usX2Y_04Int(struct urb* urb, struct pt_regs *regs) 666static void i_usX2Y_04Int(struct urb *urb, struct pt_regs *regs)
653{ 667{
654 usX2Ydev_t* usX2Y = urb->context; 668 struct usX2Ydev *usX2Y = urb->context;
655 669
656 if (urb->status) 670 if (urb->status)
657 snd_printk(KERN_ERR "snd_usX2Y_04Int() urb->status=%i\n", urb->status); 671 snd_printk(KERN_ERR "snd_usX2Y_04Int() urb->status=%i\n", urb->status);
@@ -659,21 +673,20 @@ static void i_usX2Y_04Int(struct urb* urb, struct pt_regs *regs)
659 wake_up(&usX2Y->In04WaitQueue); 673 wake_up(&usX2Y->In04WaitQueue);
660} 674}
661 675
662static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) 676static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
663{ 677{
664 int err = 0, i; 678 int err = 0, i;
665 snd_usX2Y_urbSeq_t *us = NULL; 679 struct snd_usX2Y_urbSeq *us = NULL;
666 int *usbdata = NULL; 680 int *usbdata = NULL;
667 struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; 681 struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100;
668 682
669 if (usX2Y->rate != rate) { 683 if (usX2Y->rate != rate) {
670 us = kmalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); 684 us = kzalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL);
671 if (NULL == us) { 685 if (NULL == us) {
672 err = -ENOMEM; 686 err = -ENOMEM;
673 goto cleanup; 687 goto cleanup;
674 } 688 }
675 memset(us, 0, sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS); 689 usbdata = kmalloc(sizeof(int) * NOOF_SETRATE_URBS, GFP_KERNEL);
676 usbdata = kmalloc(sizeof(int)*NOOF_SETRATE_URBS, GFP_KERNEL);
677 if (NULL == usbdata) { 690 if (NULL == usbdata) {
678 err = -ENOMEM; 691 err = -ENOMEM;
679 goto cleanup; 692 goto cleanup;
@@ -713,9 +726,8 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate)
713 usX2Y->US04 = NULL; 726 usX2Y->US04 = NULL;
714 kfree(usbdata); 727 kfree(usbdata);
715 kfree(us); 728 kfree(us);
716 if (!err) { 729 if (!err)
717 usX2Y->rate = rate; 730 usX2Y->rate = rate;
718 }
719 } 731 }
720 } 732 }
721 733
@@ -723,7 +735,7 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate)
723} 735}
724 736
725 737
726static int usX2Y_format_set(usX2Ydev_t *usX2Y, snd_pcm_format_t format) 738static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format)
727{ 739{
728 int alternate, err; 740 int alternate, err;
729 struct list_head* p; 741 struct list_head* p;
@@ -753,40 +765,40 @@ static int usX2Y_format_set(usX2Ydev_t *usX2Y, snd_pcm_format_t format)
753} 765}
754 766
755 767
756static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream, 768static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream,
757 snd_pcm_hw_params_t *hw_params) 769 struct snd_pcm_hw_params *hw_params)
758{ 770{
759 int err = 0; 771 int err = 0;
760 unsigned int rate = params_rate(hw_params); 772 unsigned int rate = params_rate(hw_params);
761 snd_pcm_format_t format = params_format(hw_params); 773 snd_pcm_format_t format = params_format(hw_params);
762 snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); 774 struct snd_card *card = substream->pstr->pcm->card;
775 struct list_head *list;
763 776
764 { // all pcm substreams off one usX2Y have to operate at the same rate & format 777 snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params);
765 snd_card_t *card = substream->pstr->pcm->card; 778 // all pcm substreams off one usX2Y have to operate at the same rate & format
766 struct list_head *list; 779 list_for_each(list, &card->devices) {
767 list_for_each(list, &card->devices) { 780 struct snd_device *dev;
768 snd_device_t *dev; 781 struct snd_pcm *pcm;
769 snd_pcm_t *pcm; 782 int s;
770 int s; 783 dev = snd_device(list);
771 dev = snd_device(list); 784 if (dev->type != SNDRV_DEV_PCM)
772 if (dev->type != SNDRV_DEV_PCM) 785 continue;
773 continue; 786 pcm = dev->device_data;
774 pcm = dev->device_data; 787 for (s = 0; s < 2; ++s) {
775 for (s = 0; s < 2; ++s) { 788 struct snd_pcm_substream *test_substream;
776 snd_pcm_substream_t *test_substream; 789 test_substream = pcm->streams[s].substream;
777 test_substream = pcm->streams[s].substream; 790 if (test_substream && test_substream != substream &&
778 if (test_substream && test_substream != substream && 791 test_substream->runtime &&
779 test_substream->runtime && 792 ((test_substream->runtime->format &&
780 ((test_substream->runtime->format && 793 test_substream->runtime->format != format) ||
781 test_substream->runtime->format != format) || 794 (test_substream->runtime->rate &&
782 (test_substream->runtime->rate && 795 test_substream->runtime->rate != rate)))
783 test_substream->runtime->rate != rate))) 796 return -EINVAL;
784 return -EINVAL;
785 }
786 } 797 }
787 } 798 }
788 if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) { 799 if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) {
789 snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", substream, params_buffer_bytes(hw_params), err); 800 snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n",
801 substream, params_buffer_bytes(hw_params), err);
790 return err; 802 return err;
791 } 803 }
792 return 0; 804 return 0;
@@ -795,15 +807,15 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream,
795/* 807/*
796 * free the buffer 808 * free the buffer
797 */ 809 */
798static int snd_usX2Y_pcm_hw_free(snd_pcm_substream_t *substream) 810static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream)
799{ 811{
800 snd_pcm_runtime_t *runtime = substream->runtime; 812 struct snd_pcm_runtime *runtime = substream->runtime;
801 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; 813 struct snd_usX2Y_substream *subs = runtime->private_data;
802 down(&subs->usX2Y->prepare_mutex); 814 down(&subs->usX2Y->prepare_mutex);
803 snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); 815 snd_printdd("snd_usX2Y_hw_free(%p)\n", substream);
804 816
805 if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { 817 if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
806 snd_usX2Y_substream_t *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; 818 struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE];
807 atomic_set(&subs->state, state_STOPPED); 819 atomic_set(&subs->state, state_STOPPED);
808 usX2Y_urbs_release(subs); 820 usX2Y_urbs_release(subs);
809 if (!cap_subs->pcm_substream || 821 if (!cap_subs->pcm_substream ||
@@ -814,7 +826,7 @@ static int snd_usX2Y_pcm_hw_free(snd_pcm_substream_t *substream)
814 usX2Y_urbs_release(cap_subs); 826 usX2Y_urbs_release(cap_subs);
815 } 827 }
816 } else { 828 } else {
817 snd_usX2Y_substream_t *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; 829 struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
818 if (atomic_read(&playback_subs->state) < state_PREPARED) { 830 if (atomic_read(&playback_subs->state) < state_PREPARED) {
819 atomic_set(&subs->state, state_STOPPED); 831 atomic_set(&subs->state, state_STOPPED);
820 usX2Y_urbs_release(subs); 832 usX2Y_urbs_release(subs);
@@ -828,12 +840,12 @@ static int snd_usX2Y_pcm_hw_free(snd_pcm_substream_t *substream)
828 * 840 *
829 * set format and initialize urbs 841 * set format and initialize urbs
830 */ 842 */
831static int snd_usX2Y_pcm_prepare(snd_pcm_substream_t *substream) 843static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream)
832{ 844{
833 snd_pcm_runtime_t *runtime = substream->runtime; 845 struct snd_pcm_runtime *runtime = substream->runtime;
834 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; 846 struct snd_usX2Y_substream *subs = runtime->private_data;
835 usX2Ydev_t *usX2Y = subs->usX2Y; 847 struct usX2Ydev *usX2Y = subs->usX2Y;
836 snd_usX2Y_substream_t *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; 848 struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE];
837 int err = 0; 849 int err = 0;
838 snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); 850 snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream);
839 851
@@ -861,7 +873,7 @@ static int snd_usX2Y_pcm_prepare(snd_pcm_substream_t *substream)
861 return err; 873 return err;
862} 874}
863 875
864static snd_pcm_hardware_t snd_usX2Y_2c = 876static struct snd_pcm_hardware snd_usX2Y_2c =
865{ 877{
866 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 878 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
867 SNDRV_PCM_INFO_BLOCK_TRANSFER | 879 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -882,11 +894,11 @@ static snd_pcm_hardware_t snd_usX2Y_2c =
882 894
883 895
884 896
885static int snd_usX2Y_pcm_open(snd_pcm_substream_t *substream) 897static int snd_usX2Y_pcm_open(struct snd_pcm_substream *substream)
886{ 898{
887 snd_usX2Y_substream_t *subs = ((snd_usX2Y_substream_t **) 899 struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **)
888 snd_pcm_substream_chip(substream))[substream->stream]; 900 snd_pcm_substream_chip(substream))[substream->stream];
889 snd_pcm_runtime_t *runtime = substream->runtime; 901 struct snd_pcm_runtime *runtime = substream->runtime;
890 902
891 if (subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) 903 if (subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS)
892 return -EBUSY; 904 return -EBUSY;
@@ -900,19 +912,18 @@ static int snd_usX2Y_pcm_open(snd_pcm_substream_t *substream)
900 912
901 913
902 914
903static int snd_usX2Y_pcm_close(snd_pcm_substream_t *substream) 915static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream)
904{ 916{
905 snd_pcm_runtime_t *runtime = substream->runtime; 917 struct snd_pcm_runtime *runtime = substream->runtime;
906 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; 918 struct snd_usX2Y_substream *subs = runtime->private_data;
907 int err = 0;
908 919
909 subs->pcm_substream = NULL; 920 subs->pcm_substream = NULL;
910 921
911 return err; 922 return 0;
912} 923}
913 924
914 925
915static snd_pcm_ops_t snd_usX2Y_pcm_ops = 926static struct snd_pcm_ops snd_usX2Y_pcm_ops =
916{ 927{
917 .open = snd_usX2Y_pcm_open, 928 .open = snd_usX2Y_pcm_open,
918 .close = snd_usX2Y_pcm_close, 929 .close = snd_usX2Y_pcm_close,
@@ -928,7 +939,7 @@ static snd_pcm_ops_t snd_usX2Y_pcm_ops =
928/* 939/*
929 * free a usb stream instance 940 * free a usb stream instance
930 */ 941 */
931static void usX2Y_audio_stream_free(snd_usX2Y_substream_t **usX2Y_substream) 942static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream)
932{ 943{
933 if (NULL != usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]) { 944 if (NULL != usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]) {
934 kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]); 945 kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]);
@@ -938,25 +949,23 @@ static void usX2Y_audio_stream_free(snd_usX2Y_substream_t **usX2Y_substream)
938 usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL; 949 usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL;
939} 950}
940 951
941static void snd_usX2Y_pcm_private_free(snd_pcm_t *pcm) 952static void snd_usX2Y_pcm_private_free(struct snd_pcm *pcm)
942{ 953{
943 snd_usX2Y_substream_t **usX2Y_stream = pcm->private_data; 954 struct snd_usX2Y_substream **usX2Y_stream = pcm->private_data;
944 if (usX2Y_stream) { 955 if (usX2Y_stream)
945 snd_pcm_lib_preallocate_free_for_all(pcm);
946 usX2Y_audio_stream_free(usX2Y_stream); 956 usX2Y_audio_stream_free(usX2Y_stream);
947 }
948} 957}
949 958
950static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int capture_endpoint) 959static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint)
951{ 960{
952 snd_pcm_t *pcm; 961 struct snd_pcm *pcm;
953 int err, i; 962 int err, i;
954 snd_usX2Y_substream_t **usX2Y_substream = 963 struct snd_usX2Y_substream **usX2Y_substream =
955 usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs; 964 usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs;
956 965
957 for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; 966 for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
958 i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { 967 i <= SNDRV_PCM_STREAM_CAPTURE; ++i) {
959 usX2Y_substream[i] = kzalloc(sizeof(snd_usX2Y_substream_t), GFP_KERNEL); 968 usX2Y_substream[i] = kzalloc(sizeof(struct snd_usX2Y_substream), GFP_KERNEL);
960 if (NULL == usX2Y_substream[i]) { 969 if (NULL == usX2Y_substream[i]) {
961 snd_printk(KERN_ERR "cannot malloc\n"); 970 snd_printk(KERN_ERR "cannot malloc\n");
962 return -ENOMEM; 971 return -ENOMEM;
@@ -1006,7 +1015,7 @@ static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int c
1006/* 1015/*
1007 * create a chip instance and set its names. 1016 * create a chip instance and set its names.
1008 */ 1017 */
1009int usX2Y_audio_create(snd_card_t* card) 1018int usX2Y_audio_create(struct snd_card *card)
1010{ 1019{
1011 int err = 0; 1020 int err = 0;
1012 1021