aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:08:02 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:55 -0500
commit86e07d34658bb85b3424f4db64fa28f884edbe8d (patch)
treeeb6a97b850d12d2f64fa13cd1c436f0735627171 /sound/usb/usbaudio.c
parentdb13154843cb2c99a93e9feed575e906f6e0e455 (diff)
[ALSA] Remove xxx_t typedefs: USB-Audio
Modules: USB generic driver Remove xxx_t typedefs from the USB-Audio driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c374
1 files changed, 186 insertions, 188 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 99dae024b64..e1326704c0c 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -102,10 +102,6 @@ MODULE_PARM_DESC(async_unlink, "Use async unlink mode.");
102#define SYNC_URBS 4 /* always four urbs for sync */ 102#define SYNC_URBS 4 /* always four urbs for sync */
103#define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ 103#define MIN_PACKS_URB 1 /* minimum 1 packet per urb */
104 104
105typedef struct snd_usb_substream snd_usb_substream_t;
106typedef struct snd_usb_stream snd_usb_stream_t;
107typedef struct snd_urb_ctx snd_urb_ctx_t;
108
109struct audioformat { 105struct audioformat {
110 struct list_head list; 106 struct list_head list;
111 snd_pcm_format_t format; /* format type */ 107 snd_pcm_format_t format; /* format type */
@@ -125,25 +121,27 @@ struct audioformat {
125 unsigned int *rate_table; /* rate table */ 121 unsigned int *rate_table; /* rate table */
126}; 122};
127 123
124struct snd_usb_substream;
125
128struct snd_urb_ctx { 126struct snd_urb_ctx {
129 struct urb *urb; 127 struct urb *urb;
130 unsigned int buffer_size; /* size of data buffer, if data URB */ 128 unsigned int buffer_size; /* size of data buffer, if data URB */
131 snd_usb_substream_t *subs; 129 struct snd_usb_substream *subs;
132 int index; /* index for urb array */ 130 int index; /* index for urb array */
133 int packets; /* number of packets per urb */ 131 int packets; /* number of packets per urb */
134}; 132};
135 133
136struct snd_urb_ops { 134struct snd_urb_ops {
137 int (*prepare)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 135 int (*prepare)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
138 int (*retire)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 136 int (*retire)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
139 int (*prepare_sync)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 137 int (*prepare_sync)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
140 int (*retire_sync)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 138 int (*retire_sync)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
141}; 139};
142 140
143struct snd_usb_substream { 141struct snd_usb_substream {
144 snd_usb_stream_t *stream; 142 struct snd_usb_stream *stream;
145 struct usb_device *dev; 143 struct usb_device *dev;
146 snd_pcm_substream_t *pcm_substream; 144 struct snd_pcm_substream *pcm_substream;
147 int direction; /* playback or capture */ 145 int direction; /* playback or capture */
148 int interface; /* current interface */ 146 int interface; /* current interface */
149 int endpoint; /* assigned endpoint */ 147 int endpoint; /* assigned endpoint */
@@ -175,8 +173,8 @@ struct snd_usb_substream {
175 unsigned long unlink_mask; /* bitmask of unlinked urbs */ 173 unsigned long unlink_mask; /* bitmask of unlinked urbs */
176 174
177 unsigned int nurbs; /* # urbs */ 175 unsigned int nurbs; /* # urbs */
178 snd_urb_ctx_t dataurb[MAX_URBS]; /* data urb table */ 176 struct snd_urb_ctx dataurb[MAX_URBS]; /* data urb table */
179 snd_urb_ctx_t syncurb[SYNC_URBS]; /* sync urb table */ 177 struct snd_urb_ctx syncurb[SYNC_URBS]; /* sync urb table */
180 char *syncbuf; /* sync buffer for all sync URBs */ 178 char *syncbuf; /* sync buffer for all sync URBs */
181 dma_addr_t sync_dma; /* DMA address of syncbuf */ 179 dma_addr_t sync_dma; /* DMA address of syncbuf */
182 180
@@ -190,11 +188,11 @@ struct snd_usb_substream {
190 188
191 189
192struct snd_usb_stream { 190struct snd_usb_stream {
193 snd_usb_audio_t *chip; 191 struct snd_usb_audio *chip;
194 snd_pcm_t *pcm; 192 struct snd_pcm *pcm;
195 int pcm_index; 193 int pcm_index;
196 unsigned int fmt_type; /* USB audio format type (1-3) */ 194 unsigned int fmt_type; /* USB audio format type (1-3) */
197 snd_usb_substream_t substream[2]; 195 struct snd_usb_substream substream[2];
198 struct list_head list; 196 struct list_head list;
199}; 197};
200 198
@@ -205,7 +203,7 @@ struct snd_usb_stream {
205 */ 203 */
206 204
207static DECLARE_MUTEX(register_mutex); 205static DECLARE_MUTEX(register_mutex);
208static snd_usb_audio_t *usb_chip[SNDRV_CARDS]; 206static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
209 207
210 208
211/* 209/*
@@ -245,12 +243,12 @@ static inline unsigned get_high_speed_hz(unsigned int usb_rate)
245 * fill the length and offset of each urb descriptor. 243 * fill the length and offset of each urb descriptor.
246 * the fixed 10.14 frequency is passed through the pipe. 244 * the fixed 10.14 frequency is passed through the pipe.
247 */ 245 */
248static int prepare_capture_sync_urb(snd_usb_substream_t *subs, 246static int prepare_capture_sync_urb(struct snd_usb_substream *subs,
249 snd_pcm_runtime_t *runtime, 247 struct snd_pcm_runtime *runtime,
250 struct urb *urb) 248 struct urb *urb)
251{ 249{
252 unsigned char *cp = urb->transfer_buffer; 250 unsigned char *cp = urb->transfer_buffer;
253 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 251 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
254 252
255 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 253 urb->dev = ctx->subs->dev; /* we need to set this at each time */
256 urb->iso_frame_desc[0].length = 3; 254 urb->iso_frame_desc[0].length = 3;
@@ -267,12 +265,12 @@ static int prepare_capture_sync_urb(snd_usb_substream_t *subs,
267 * fill the length and offset of each urb descriptor. 265 * fill the length and offset of each urb descriptor.
268 * the fixed 12.13 frequency is passed as 16.16 through the pipe. 266 * the fixed 12.13 frequency is passed as 16.16 through the pipe.
269 */ 267 */
270static int prepare_capture_sync_urb_hs(snd_usb_substream_t *subs, 268static int prepare_capture_sync_urb_hs(struct snd_usb_substream *subs,
271 snd_pcm_runtime_t *runtime, 269 struct snd_pcm_runtime *runtime,
272 struct urb *urb) 270 struct urb *urb)
273{ 271{
274 unsigned char *cp = urb->transfer_buffer; 272 unsigned char *cp = urb->transfer_buffer;
275 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 273 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
276 274
277 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 275 urb->dev = ctx->subs->dev; /* we need to set this at each time */
278 urb->iso_frame_desc[0].length = 4; 276 urb->iso_frame_desc[0].length = 4;
@@ -288,8 +286,8 @@ static int prepare_capture_sync_urb_hs(snd_usb_substream_t *subs,
288 * process after capture sync complete 286 * process after capture sync complete
289 * - nothing to do 287 * - nothing to do
290 */ 288 */
291static int retire_capture_sync_urb(snd_usb_substream_t *subs, 289static int retire_capture_sync_urb(struct snd_usb_substream *subs,
292 snd_pcm_runtime_t *runtime, 290 struct snd_pcm_runtime *runtime,
293 struct urb *urb) 291 struct urb *urb)
294{ 292{
295 return 0; 293 return 0;
@@ -305,12 +303,12 @@ static int retire_capture_sync_urb(snd_usb_substream_t *subs,
305 * write onto the pcm buffer directly... the data is thus copied 303 * write onto the pcm buffer directly... the data is thus copied
306 * later at complete callback to the global buffer. 304 * later at complete callback to the global buffer.
307 */ 305 */
308static int prepare_capture_urb(snd_usb_substream_t *subs, 306static int prepare_capture_urb(struct snd_usb_substream *subs,
309 snd_pcm_runtime_t *runtime, 307 struct snd_pcm_runtime *runtime,
310 struct urb *urb) 308 struct urb *urb)
311{ 309{
312 int i, offs; 310 int i, offs;
313 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 311 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
314 312
315 offs = 0; 313 offs = 0;
316 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 314 urb->dev = ctx->subs->dev; /* we need to set this at each time */
@@ -340,8 +338,8 @@ static int prepare_capture_urb(snd_usb_substream_t *subs,
340 * copy the data from each desctiptor to the pcm buffer, and 338 * copy the data from each desctiptor to the pcm buffer, and
341 * update the current position. 339 * update the current position.
342 */ 340 */
343static int retire_capture_urb(snd_usb_substream_t *subs, 341static int retire_capture_urb(struct snd_usb_substream *subs,
344 snd_pcm_runtime_t *runtime, 342 struct snd_pcm_runtime *runtime,
345 struct urb *urb) 343 struct urb *urb)
346{ 344{
347 unsigned long flags; 345 unsigned long flags;
@@ -395,11 +393,11 @@ static int retire_capture_urb(snd_usb_substream_t *subs,
395 * set up the offset and length to receive the current frequency. 393 * set up the offset and length to receive the current frequency.
396 */ 394 */
397 395
398static int prepare_playback_sync_urb(snd_usb_substream_t *subs, 396static int prepare_playback_sync_urb(struct snd_usb_substream *subs,
399 snd_pcm_runtime_t *runtime, 397 struct snd_pcm_runtime *runtime,
400 struct urb *urb) 398 struct urb *urb)
401{ 399{
402 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 400 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
403 401
404 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 402 urb->dev = ctx->subs->dev; /* we need to set this at each time */
405 urb->iso_frame_desc[0].length = 3; 403 urb->iso_frame_desc[0].length = 3;
@@ -413,11 +411,11 @@ static int prepare_playback_sync_urb(snd_usb_substream_t *subs,
413 * set up the offset and length to receive the current frequency. 411 * set up the offset and length to receive the current frequency.
414 */ 412 */
415 413
416static int prepare_playback_sync_urb_hs(snd_usb_substream_t *subs, 414static int prepare_playback_sync_urb_hs(struct snd_usb_substream *subs,
417 snd_pcm_runtime_t *runtime, 415 struct snd_pcm_runtime *runtime,
418 struct urb *urb) 416 struct urb *urb)
419{ 417{
420 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 418 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
421 419
422 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 420 urb->dev = ctx->subs->dev; /* we need to set this at each time */
423 urb->iso_frame_desc[0].length = 4; 421 urb->iso_frame_desc[0].length = 4;
@@ -431,8 +429,8 @@ static int prepare_playback_sync_urb_hs(snd_usb_substream_t *subs,
431 * retrieve the current 10.14 frequency from pipe, and set it. 429 * retrieve the current 10.14 frequency from pipe, and set it.
432 * the value is referred in prepare_playback_urb(). 430 * the value is referred in prepare_playback_urb().
433 */ 431 */
434static int retire_playback_sync_urb(snd_usb_substream_t *subs, 432static int retire_playback_sync_urb(struct snd_usb_substream *subs,
435 snd_pcm_runtime_t *runtime, 433 struct snd_pcm_runtime *runtime,
436 struct urb *urb) 434 struct urb *urb)
437{ 435{
438 unsigned int f; 436 unsigned int f;
@@ -457,8 +455,8 @@ static int retire_playback_sync_urb(snd_usb_substream_t *subs,
457 * retrieve the current 12.13 frequency from pipe, and set it. 455 * retrieve the current 12.13 frequency from pipe, and set it.
458 * the value is referred in prepare_playback_urb(). 456 * the value is referred in prepare_playback_urb().
459 */ 457 */
460static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, 458static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs,
461 snd_pcm_runtime_t *runtime, 459 struct snd_pcm_runtime *runtime,
462 struct urb *urb) 460 struct urb *urb)
463{ 461{
464 unsigned int f; 462 unsigned int f;
@@ -482,12 +480,12 @@ static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs,
482 * 480 *
483 * We don't care about (or have) any data, so we just send a transfer delimiter. 481 * We don't care about (or have) any data, so we just send a transfer delimiter.
484 */ 482 */
485static int prepare_startup_playback_urb(snd_usb_substream_t *subs, 483static int prepare_startup_playback_urb(struct snd_usb_substream *subs,
486 snd_pcm_runtime_t *runtime, 484 struct snd_pcm_runtime *runtime,
487 struct urb *urb) 485 struct urb *urb)
488{ 486{
489 unsigned int i; 487 unsigned int i;
490 snd_urb_ctx_t *ctx = urb->context; 488 struct snd_urb_ctx *ctx = urb->context;
491 489
492 urb->dev = ctx->subs->dev; 490 urb->dev = ctx->subs->dev;
493 urb->number_of_packets = subs->packs_per_ms; 491 urb->number_of_packets = subs->packs_per_ms;
@@ -507,15 +505,15 @@ static int prepare_startup_playback_urb(snd_usb_substream_t *subs,
507 * To avoid inconsistencies when updating hwptr_done, we use double buffering 505 * To avoid inconsistencies when updating hwptr_done, we use double buffering
508 * for all URBs. 506 * for all URBs.
509 */ 507 */
510static int prepare_playback_urb(snd_usb_substream_t *subs, 508static int prepare_playback_urb(struct snd_usb_substream *subs,
511 snd_pcm_runtime_t *runtime, 509 struct snd_pcm_runtime *runtime,
512 struct urb *urb) 510 struct urb *urb)
513{ 511{
514 int i, stride, offs; 512 int i, stride, offs;
515 unsigned int counts; 513 unsigned int counts;
516 unsigned long flags; 514 unsigned long flags;
517 int period_elapsed = 0; 515 int period_elapsed = 0;
518 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 516 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
519 517
520 stride = runtime->frame_bits >> 3; 518 stride = runtime->frame_bits >> 3;
521 519
@@ -597,8 +595,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs,
597 * process after playback data complete 595 * process after playback data complete
598 * - nothing to do 596 * - nothing to do
599 */ 597 */
600static int retire_playback_urb(snd_usb_substream_t *subs, 598static int retire_playback_urb(struct snd_usb_substream *subs,
601 snd_pcm_runtime_t *runtime, 599 struct snd_pcm_runtime *runtime,
602 struct urb *urb) 600 struct urb *urb)
603{ 601{
604 return 0; 602 return 0;
@@ -642,9 +640,9 @@ static struct snd_urb_ops audio_urb_ops_high_speed[2] = {
642 */ 640 */
643static void snd_complete_urb(struct urb *urb, struct pt_regs *regs) 641static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
644{ 642{
645 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 643 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
646 snd_usb_substream_t *subs = ctx->subs; 644 struct snd_usb_substream *subs = ctx->subs;
647 snd_pcm_substream_t *substream = ctx->subs->pcm_substream; 645 struct snd_pcm_substream *substream = ctx->subs->pcm_substream;
648 int err = 0; 646 int err = 0;
649 647
650 if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) || 648 if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) ||
@@ -665,9 +663,9 @@ static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
665 */ 663 */
666static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs) 664static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
667{ 665{
668 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 666 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
669 snd_usb_substream_t *subs = ctx->subs; 667 struct snd_usb_substream *subs = ctx->subs;
670 snd_pcm_substream_t *substream = ctx->subs->pcm_substream; 668 struct snd_pcm_substream *substream = ctx->subs->pcm_substream;
671 int err = 0; 669 int err = 0;
672 670
673 if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) || 671 if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) ||
@@ -684,7 +682,7 @@ static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
684 682
685 683
686/* get the physical page pointer at the given offset */ 684/* get the physical page pointer at the given offset */
687static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, 685static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
688 unsigned long offset) 686 unsigned long offset)
689{ 687{
690 void *pageptr = subs->runtime->dma_area + offset; 688 void *pageptr = subs->runtime->dma_area + offset;
@@ -692,9 +690,9 @@ static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs,
692} 690}
693 691
694/* allocate virtual buffer; may be called more than once */ 692/* allocate virtual buffer; may be called more than once */
695static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) 693static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
696{ 694{
697 snd_pcm_runtime_t *runtime = subs->runtime; 695 struct snd_pcm_runtime *runtime = subs->runtime;
698 if (runtime->dma_area) { 696 if (runtime->dma_area) {
699 if (runtime->dma_bytes >= size) 697 if (runtime->dma_bytes >= size)
700 return 0; /* already large enough */ 698 return 0; /* already large enough */
@@ -708,9 +706,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size)
708} 706}
709 707
710/* free virtual buffer; may be called more than once */ 708/* free virtual buffer; may be called more than once */
711static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) 709static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)
712{ 710{
713 snd_pcm_runtime_t *runtime = subs->runtime; 711 struct snd_pcm_runtime *runtime = subs->runtime;
714 if (runtime->dma_area) { 712 if (runtime->dma_area) {
715 vfree(runtime->dma_area); 713 vfree(runtime->dma_area);
716 runtime->dma_area = NULL; 714 runtime->dma_area = NULL;
@@ -722,7 +720,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs)
722/* 720/*
723 * unlink active urbs. 721 * unlink active urbs.
724 */ 722 */
725static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) 723static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sleep)
726{ 724{
727 unsigned int i; 725 unsigned int i;
728 int async; 726 int async;
@@ -768,7 +766,7 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep)
768/* 766/*
769 * set up and start data/sync urbs 767 * set up and start data/sync urbs
770 */ 768 */
771static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime) 769static int start_urbs(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime)
772{ 770{
773 unsigned int i; 771 unsigned int i;
774 int err; 772 int err;
@@ -824,7 +822,7 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
824/* 822/*
825 * wait until all urbs are processed. 823 * wait until all urbs are processed.
826 */ 824 */
827static int wait_clear_urbs(snd_usb_substream_t *subs) 825static int wait_clear_urbs(struct snd_usb_substream *subs)
828{ 826{
829 unsigned long end_time = jiffies + msecs_to_jiffies(1000); 827 unsigned long end_time = jiffies + msecs_to_jiffies(1000);
830 unsigned int i; 828 unsigned int i;
@@ -855,12 +853,12 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
855/* 853/*
856 * return the current pcm pointer. just return the hwptr_done value. 854 * return the current pcm pointer. just return the hwptr_done value.
857 */ 855 */
858static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) 856static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream)
859{ 857{
860 snd_usb_substream_t *subs; 858 struct snd_usb_substream *subs;
861 snd_pcm_uframes_t hwptr_done; 859 snd_pcm_uframes_t hwptr_done;
862 860
863 subs = (snd_usb_substream_t *)substream->runtime->private_data; 861 subs = (struct snd_usb_substream *)substream->runtime->private_data;
864 spin_lock(&subs->lock); 862 spin_lock(&subs->lock);
865 hwptr_done = subs->hwptr_done; 863 hwptr_done = subs->hwptr_done;
866 spin_unlock(&subs->lock); 864 spin_unlock(&subs->lock);
@@ -871,10 +869,10 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream)
871/* 869/*
872 * start/stop playback substream 870 * start/stop playback substream
873 */ 871 */
874static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream, 872static int snd_usb_pcm_playback_trigger(struct snd_pcm_substream *substream,
875 int cmd) 873 int cmd)
876{ 874{
877 snd_usb_substream_t *subs = substream->runtime->private_data; 875 struct snd_usb_substream *subs = substream->runtime->private_data;
878 876
879 switch (cmd) { 877 switch (cmd) {
880 case SNDRV_PCM_TRIGGER_START: 878 case SNDRV_PCM_TRIGGER_START:
@@ -890,10 +888,10 @@ static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream,
890/* 888/*
891 * start/stop capture substream 889 * start/stop capture substream
892 */ 890 */
893static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream, 891static int snd_usb_pcm_capture_trigger(struct snd_pcm_substream *substream,
894 int cmd) 892 int cmd)
895{ 893{
896 snd_usb_substream_t *subs = substream->runtime->private_data; 894 struct snd_usb_substream *subs = substream->runtime->private_data;
897 895
898 switch (cmd) { 896 switch (cmd) {
899 case SNDRV_PCM_TRIGGER_START: 897 case SNDRV_PCM_TRIGGER_START:
@@ -909,7 +907,7 @@ static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream,
909/* 907/*
910 * release a urb data 908 * release a urb data
911 */ 909 */
912static void release_urb_ctx(snd_urb_ctx_t *u) 910static void release_urb_ctx(struct snd_urb_ctx *u)
913{ 911{
914 if (u->urb) { 912 if (u->urb) {
915 if (u->buffer_size) 913 if (u->buffer_size)
@@ -924,7 +922,7 @@ static void release_urb_ctx(snd_urb_ctx_t *u)
924/* 922/*
925 * release a substream 923 * release a substream
926 */ 924 */
927static void release_substream_urbs(snd_usb_substream_t *subs, int force) 925static void release_substream_urbs(struct snd_usb_substream *subs, int force)
928{ 926{
929 int i; 927 int i;
930 928
@@ -945,7 +943,7 @@ static void release_substream_urbs(snd_usb_substream_t *subs, int force)
945/* 943/*
946 * initialize a substream for plaback/capture 944 * initialize a substream for plaback/capture
947 */ 945 */
948static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_bytes, 946static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int period_bytes,
949 unsigned int rate, unsigned int frame_bits) 947 unsigned int rate, unsigned int frame_bits)
950{ 948{
951 unsigned int maxsize, n, i; 949 unsigned int maxsize, n, i;
@@ -1045,7 +1043,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
1045 1043
1046 /* allocate and initialize data urbs */ 1044 /* allocate and initialize data urbs */
1047 for (i = 0; i < subs->nurbs; i++) { 1045 for (i = 0; i < subs->nurbs; i++) {
1048 snd_urb_ctx_t *u = &subs->dataurb[i]; 1046 struct snd_urb_ctx *u = &subs->dataurb[i];
1049 u->index = i; 1047 u->index = i;
1050 u->subs = subs; 1048 u->subs = subs;
1051 u->packets = npacks[i]; 1049 u->packets = npacks[i];
@@ -1074,7 +1072,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
1074 if (! subs->syncbuf) 1072 if (! subs->syncbuf)
1075 goto out_of_memory; 1073 goto out_of_memory;
1076 for (i = 0; i < SYNC_URBS; i++) { 1074 for (i = 0; i < SYNC_URBS; i++) {
1077 snd_urb_ctx_t *u = &subs->syncurb[i]; 1075 struct snd_urb_ctx *u = &subs->syncurb[i];
1078 u->index = i; 1076 u->index = i;
1079 u->subs = subs; 1077 u->subs = subs;
1080 u->packets = 1; 1078 u->packets = 1;
@@ -1104,7 +1102,7 @@ out_of_memory:
1104/* 1102/*
1105 * find a matching audio format 1103 * find a matching audio format
1106 */ 1104 */
1107static struct audioformat *find_format(snd_usb_substream_t *subs, unsigned int format, 1105static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned int format,
1108 unsigned int rate, unsigned int channels) 1106 unsigned int rate, unsigned int channels)
1109{ 1107{
1110 struct list_head *p; 1108 struct list_head *p;
@@ -1229,7 +1227,7 @@ static int init_usb_sample_rate(struct usb_device *dev, int iface,
1229/* 1227/*
1230 * find a matching format and set up the interface 1228 * find a matching format and set up the interface
1231 */ 1229 */
1232static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) 1230static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
1233{ 1231{
1234 struct usb_device *dev = subs->dev; 1232 struct usb_device *dev = subs->dev;
1235 struct usb_host_interface *alts; 1233 struct usb_host_interface *alts;
@@ -1358,10 +1356,10 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt)
1358 * if sg buffer is supported on the later version of alsa, we'll follow 1356 * if sg buffer is supported on the later version of alsa, we'll follow
1359 * that. 1357 * that.
1360 */ 1358 */
1361static int snd_usb_hw_params(snd_pcm_substream_t *substream, 1359static int snd_usb_hw_params(struct snd_pcm_substream *substream,
1362 snd_pcm_hw_params_t *hw_params) 1360 struct snd_pcm_hw_params *hw_params)
1363{ 1361{
1364 snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; 1362 struct snd_usb_substream *subs = (struct snd_usb_substream *)substream->runtime->private_data;
1365 struct audioformat *fmt; 1363 struct audioformat *fmt;
1366 unsigned int channels, rate, format; 1364 unsigned int channels, rate, format;
1367 int ret, changed; 1365 int ret, changed;
@@ -1415,9 +1413,9 @@ static int snd_usb_hw_params(snd_pcm_substream_t *substream,
1415 * 1413 *
1416 * reset the audio format and release the buffer 1414 * reset the audio format and release the buffer
1417 */ 1415 */
1418static int snd_usb_hw_free(snd_pcm_substream_t *substream) 1416static int snd_usb_hw_free(struct snd_pcm_substream *substream)
1419{ 1417{
1420 snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; 1418 struct snd_usb_substream *subs = (struct snd_usb_substream *)substream->runtime->private_data;
1421 1419
1422 subs->cur_audiofmt = NULL; 1420 subs->cur_audiofmt = NULL;
1423 subs->cur_rate = 0; 1421 subs->cur_rate = 0;
@@ -1431,10 +1429,10 @@ static int snd_usb_hw_free(snd_pcm_substream_t *substream)
1431 * 1429 *
1432 * only a few subtle things... 1430 * only a few subtle things...
1433 */ 1431 */
1434static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) 1432static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
1435{ 1433{
1436 snd_pcm_runtime_t *runtime = substream->runtime; 1434 struct snd_pcm_runtime *runtime = substream->runtime;
1437 snd_usb_substream_t *subs = runtime->private_data; 1435 struct snd_usb_substream *subs = runtime->private_data;
1438 1436
1439 if (! subs->cur_audiofmt) { 1437 if (! subs->cur_audiofmt) {
1440 snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); 1438 snd_printk(KERN_ERR "usbaudio: no format is specified!\n");
@@ -1463,7 +1461,7 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream)
1463 return 0; 1461 return 0;
1464} 1462}
1465 1463
1466static snd_pcm_hardware_t snd_usb_playback = 1464static struct snd_pcm_hardware snd_usb_playback =
1467{ 1465{
1468 .info = SNDRV_PCM_INFO_MMAP | 1466 .info = SNDRV_PCM_INFO_MMAP |
1469 SNDRV_PCM_INFO_MMAP_VALID | 1467 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1477,7 +1475,7 @@ static snd_pcm_hardware_t snd_usb_playback =
1477 .periods_max = 1024, 1475 .periods_max = 1024,
1478}; 1476};
1479 1477
1480static snd_pcm_hardware_t snd_usb_capture = 1478static struct snd_pcm_hardware snd_usb_capture =
1481{ 1479{
1482 .info = SNDRV_PCM_INFO_MMAP | 1480 .info = SNDRV_PCM_INFO_MMAP |
1483 SNDRV_PCM_INFO_MMAP_VALID | 1481 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1501,11 +1499,11 @@ static snd_pcm_hardware_t snd_usb_capture =
1501#define hwc_debug(fmt, args...) /**/ 1499#define hwc_debug(fmt, args...) /**/
1502#endif 1500#endif
1503 1501
1504static int hw_check_valid_format(snd_pcm_hw_params_t *params, struct audioformat *fp) 1502static int hw_check_valid_format(struct snd_pcm_hw_params *params, struct audioformat *fp)
1505{ 1503{
1506 snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 1504 struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
1507 snd_interval_t *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 1505 struct snd_interval *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
1508 snd_mask_t *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1506 struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
1509 1507
1510 /* check the format */ 1508 /* check the format */
1511 if (! snd_mask_test(fmts, fp->format)) { 1509 if (! snd_mask_test(fmts, fp->format)) {
@@ -1529,12 +1527,12 @@ static int hw_check_valid_format(snd_pcm_hw_params_t *params, struct audioformat
1529 return 1; 1527 return 1;
1530} 1528}
1531 1529
1532static int hw_rule_rate(snd_pcm_hw_params_t *params, 1530static int hw_rule_rate(struct snd_pcm_hw_params *params,
1533 snd_pcm_hw_rule_t *rule) 1531 struct snd_pcm_hw_rule *rule)
1534{ 1532{
1535 snd_usb_substream_t *subs = rule->private; 1533 struct snd_usb_substream *subs = rule->private;
1536 struct list_head *p; 1534 struct list_head *p;
1537 snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 1535 struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
1538 unsigned int rmin, rmax; 1536 unsigned int rmin, rmax;
1539 int changed; 1537 int changed;
1540 1538
@@ -1583,12 +1581,12 @@ static int hw_rule_rate(snd_pcm_hw_params_t *params,
1583} 1581}
1584 1582
1585 1583
1586static int hw_rule_channels(snd_pcm_hw_params_t *params, 1584static int hw_rule_channels(struct snd_pcm_hw_params *params,
1587 snd_pcm_hw_rule_t *rule) 1585 struct snd_pcm_hw_rule *rule)
1588{ 1586{
1589 snd_usb_substream_t *subs = rule->private; 1587 struct snd_usb_substream *subs = rule->private;
1590 struct list_head *p; 1588 struct list_head *p;
1591 snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 1589 struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
1592 unsigned int rmin, rmax; 1590 unsigned int rmin, rmax;
1593 int changed; 1591 int changed;
1594 1592
@@ -1636,12 +1634,12 @@ static int hw_rule_channels(snd_pcm_hw_params_t *params,
1636 return changed; 1634 return changed;
1637} 1635}
1638 1636
1639static int hw_rule_format(snd_pcm_hw_params_t *params, 1637static int hw_rule_format(struct snd_pcm_hw_params *params,
1640 snd_pcm_hw_rule_t *rule) 1638 struct snd_pcm_hw_rule *rule)
1641{ 1639{
1642 snd_usb_substream_t *subs = rule->private; 1640 struct snd_usb_substream *subs = rule->private;
1643 struct list_head *p; 1641 struct list_head *p;
1644 snd_mask_t *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1642 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
1645 u64 fbits; 1643 u64 fbits;
1646 u32 oldbits[2]; 1644 u32 oldbits[2];
1647 int changed; 1645 int changed;
@@ -1674,7 +1672,7 @@ static int hw_rule_format(snd_pcm_hw_params_t *params,
1674/* 1672/*
1675 * check whether the registered audio formats need special hw-constraints 1673 * check whether the registered audio formats need special hw-constraints
1676 */ 1674 */
1677static int check_hw_params_convention(snd_usb_substream_t *subs) 1675static int check_hw_params_convention(struct snd_usb_substream *subs)
1678{ 1676{
1679 int i; 1677 int i;
1680 u32 *channels; 1678 u32 *channels;
@@ -1758,7 +1756,7 @@ static int check_hw_params_convention(snd_usb_substream_t *subs)
1758 * set up the runtime hardware information. 1756 * set up the runtime hardware information.
1759 */ 1757 */
1760 1758
1761static int setup_hw_info(snd_pcm_runtime_t *runtime, snd_usb_substream_t *subs) 1759static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs)
1762{ 1760{
1763 struct list_head *p; 1761 struct list_head *p;
1764 int err; 1762 int err;
@@ -1819,12 +1817,12 @@ static int setup_hw_info(snd_pcm_runtime_t *runtime, snd_usb_substream_t *subs)
1819 return 0; 1817 return 0;
1820} 1818}
1821 1819
1822static int snd_usb_pcm_open(snd_pcm_substream_t *substream, int direction, 1820static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction,
1823 snd_pcm_hardware_t *hw) 1821 struct snd_pcm_hardware *hw)
1824{ 1822{
1825 snd_usb_stream_t *as = snd_pcm_substream_chip(substream); 1823 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1826 snd_pcm_runtime_t *runtime = substream->runtime; 1824 struct snd_pcm_runtime *runtime = substream->runtime;
1827 snd_usb_substream_t *subs = &as->substream[direction]; 1825 struct snd_usb_substream *subs = &as->substream[direction];
1828 1826
1829 subs->interface = -1; 1827 subs->interface = -1;
1830 subs->format = 0; 1828 subs->format = 0;
@@ -1834,10 +1832,10 @@ static int snd_usb_pcm_open(snd_pcm_substream_t *substream, int direction,
1834 return setup_hw_info(runtime, subs); 1832 return setup_hw_info(runtime, subs);
1835} 1833}
1836 1834
1837static int snd_usb_pcm_close(snd_pcm_substream_t *substream, int direction) 1835static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
1838{ 1836{
1839 snd_usb_stream_t *as = snd_pcm_substream_chip(substream); 1837 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1840 snd_usb_substream_t *subs = &as->substream[direction]; 1838 struct snd_usb_substream *subs = &as->substream[direction];
1841 1839
1842 if (subs->interface >= 0) { 1840 if (subs->interface >= 0) {
1843 usb_set_interface(subs->dev, subs->interface, 0); 1841 usb_set_interface(subs->dev, subs->interface, 0);
@@ -1847,27 +1845,27 @@ static int snd_usb_pcm_close(snd_pcm_substream_t *substream, int direction)
1847 return 0; 1845 return 0;
1848} 1846}
1849 1847
1850static int snd_usb_playback_open(snd_pcm_substream_t *substream) 1848static int snd_usb_playback_open(struct snd_pcm_substream *substream)
1851{ 1849{
1852 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_PLAYBACK, &snd_usb_playback); 1850 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_PLAYBACK, &snd_usb_playback);
1853} 1851}
1854 1852
1855static int snd_usb_playback_close(snd_pcm_substream_t *substream) 1853static int snd_usb_playback_close(struct snd_pcm_substream *substream)
1856{ 1854{
1857 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_PLAYBACK); 1855 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_PLAYBACK);
1858} 1856}
1859 1857
1860static int snd_usb_capture_open(snd_pcm_substream_t *substream) 1858static int snd_usb_capture_open(struct snd_pcm_substream *substream)
1861{ 1859{
1862 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_CAPTURE, &snd_usb_capture); 1860 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_CAPTURE, &snd_usb_capture);
1863} 1861}
1864 1862
1865static int snd_usb_capture_close(snd_pcm_substream_t *substream) 1863static int snd_usb_capture_close(struct snd_pcm_substream *substream)
1866{ 1864{
1867 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_CAPTURE); 1865 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_CAPTURE);
1868} 1866}
1869 1867
1870static snd_pcm_ops_t snd_usb_playback_ops = { 1868static struct snd_pcm_ops snd_usb_playback_ops = {
1871 .open = snd_usb_playback_open, 1869 .open = snd_usb_playback_open,
1872 .close = snd_usb_playback_close, 1870 .close = snd_usb_playback_close,
1873 .ioctl = snd_pcm_lib_ioctl, 1871 .ioctl = snd_pcm_lib_ioctl,
@@ -1879,7 +1877,7 @@ static snd_pcm_ops_t snd_usb_playback_ops = {
1879 .page = snd_pcm_get_vmalloc_page, 1877 .page = snd_pcm_get_vmalloc_page,
1880}; 1878};
1881 1879
1882static snd_pcm_ops_t snd_usb_capture_ops = { 1880static struct snd_pcm_ops snd_usb_capture_ops = {
1883 .open = snd_usb_capture_open, 1881 .open = snd_usb_capture_open,
1884 .close = snd_usb_capture_close, 1882 .close = snd_usb_capture_close,
1885 .ioctl = snd_pcm_lib_ioctl, 1883 .ioctl = snd_pcm_lib_ioctl,
@@ -2007,7 +2005,7 @@ static struct usb_driver usb_audio_driver = {
2007/* 2005/*
2008 * proc interface for list the supported pcm formats 2006 * proc interface for list the supported pcm formats
2009 */ 2007 */
2010static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buffer_t *buffer) 2008static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
2011{ 2009{
2012 struct list_head *p; 2010 struct list_head *p;
2013 static char *sync_types[4] = { 2011 static char *sync_types[4] = {
@@ -2043,7 +2041,7 @@ static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buff
2043 } 2041 }
2044} 2042}
2045 2043
2046static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffer_t *buffer) 2044static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
2047{ 2045{
2048 if (subs->running) { 2046 if (subs->running) {
2049 unsigned int i; 2047 unsigned int i;
@@ -2065,9 +2063,9 @@ static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffe
2065 } 2063 }
2066} 2064}
2067 2065
2068static void proc_pcm_format_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 2066static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
2069{ 2067{
2070 snd_usb_stream_t *stream = entry->private_data; 2068 struct snd_usb_stream *stream = entry->private_data;
2071 2069
2072 snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name); 2070 snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name);
2073 2071
@@ -2083,11 +2081,11 @@ static void proc_pcm_format_read(snd_info_entry_t *entry, snd_info_buffer_t *buf
2083 } 2081 }
2084} 2082}
2085 2083
2086static void proc_pcm_format_add(snd_usb_stream_t *stream) 2084static void proc_pcm_format_add(struct snd_usb_stream *stream)
2087{ 2085{
2088 snd_info_entry_t *entry; 2086 struct snd_info_entry *entry;
2089 char name[32]; 2087 char name[32];
2090 snd_card_t *card = stream->chip->card; 2088 struct snd_card *card = stream->chip->card;
2091 2089
2092 sprintf(name, "stream%d", stream->pcm_index); 2090 sprintf(name, "stream%d", stream->pcm_index);
2093 if (! snd_card_proc_new(card, name, &entry)) 2091 if (! snd_card_proc_new(card, name, &entry))
@@ -2099,9 +2097,9 @@ static void proc_pcm_format_add(snd_usb_stream_t *stream)
2099 * initialize the substream instance. 2097 * initialize the substream instance.
2100 */ 2098 */
2101 2099
2102static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat *fp) 2100static void init_substream(struct snd_usb_stream *as, int stream, struct audioformat *fp)
2103{ 2101{
2104 snd_usb_substream_t *subs = &as->substream[stream]; 2102 struct snd_usb_substream *subs = &as->substream[stream];
2105 2103
2106 INIT_LIST_HEAD(&subs->fmt_list); 2104 INIT_LIST_HEAD(&subs->fmt_list);
2107 spin_lock_init(&subs->lock); 2105 spin_lock_init(&subs->lock);
@@ -2128,7 +2126,7 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat
2128/* 2126/*
2129 * free a substream 2127 * free a substream
2130 */ 2128 */
2131static void free_substream(snd_usb_substream_t *subs) 2129static void free_substream(struct snd_usb_substream *subs)
2132{ 2130{
2133 struct list_head *p, *n; 2131 struct list_head *p, *n;
2134 2132
@@ -2145,7 +2143,7 @@ static void free_substream(snd_usb_substream_t *subs)
2145/* 2143/*
2146 * free a usb stream instance 2144 * free a usb stream instance
2147 */ 2145 */
2148static void snd_usb_audio_stream_free(snd_usb_stream_t *stream) 2146static void snd_usb_audio_stream_free(struct snd_usb_stream *stream)
2149{ 2147{
2150 free_substream(&stream->substream[0]); 2148 free_substream(&stream->substream[0]);
2151 free_substream(&stream->substream[1]); 2149 free_substream(&stream->substream[1]);
@@ -2153,9 +2151,9 @@ static void snd_usb_audio_stream_free(snd_usb_stream_t *stream)
2153 kfree(stream); 2151 kfree(stream);
2154} 2152}
2155 2153
2156static void snd_usb_audio_pcm_free(snd_pcm_t *pcm) 2154static void snd_usb_audio_pcm_free(struct snd_pcm *pcm)
2157{ 2155{
2158 snd_usb_stream_t *stream = pcm->private_data; 2156 struct snd_usb_stream *stream = pcm->private_data;
2159 if (stream) { 2157 if (stream) {
2160 stream->pcm = NULL; 2158 stream->pcm = NULL;
2161 snd_usb_audio_stream_free(stream); 2159 snd_usb_audio_stream_free(stream);
@@ -2168,16 +2166,16 @@ static void snd_usb_audio_pcm_free(snd_pcm_t *pcm)
2168 * if a stream with the same endpoint already exists, append to it. 2166 * if a stream with the same endpoint already exists, append to it.
2169 * if not, create a new pcm stream. 2167 * if not, create a new pcm stream.
2170 */ 2168 */
2171static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audioformat *fp) 2169static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct audioformat *fp)
2172{ 2170{
2173 struct list_head *p; 2171 struct list_head *p;
2174 snd_usb_stream_t *as; 2172 struct snd_usb_stream *as;
2175 snd_usb_substream_t *subs; 2173 struct snd_usb_substream *subs;
2176 snd_pcm_t *pcm; 2174 struct snd_pcm *pcm;
2177 int err; 2175 int err;
2178 2176
2179 list_for_each(p, &chip->pcm_list) { 2177 list_for_each(p, &chip->pcm_list) {
2180 as = list_entry(p, snd_usb_stream_t, list); 2178 as = list_entry(p, struct snd_usb_stream, list);
2181 if (as->fmt_type != fp->fmt_type) 2179 if (as->fmt_type != fp->fmt_type)
2182 continue; 2180 continue;
2183 subs = &as->substream[stream]; 2181 subs = &as->substream[stream];
@@ -2192,7 +2190,7 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor
2192 } 2190 }
2193 /* look for an empty stream */ 2191 /* look for an empty stream */
2194 list_for_each(p, &chip->pcm_list) { 2192 list_for_each(p, &chip->pcm_list) {
2195 as = list_entry(p, snd_usb_stream_t, list); 2193 as = list_entry(p, struct snd_usb_stream, list);
2196 if (as->fmt_type != fp->fmt_type) 2194 if (as->fmt_type != fp->fmt_type)
2197 continue; 2195 continue;
2198 subs = &as->substream[stream]; 2196 subs = &as->substream[stream];
@@ -2244,7 +2242,7 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor
2244/* 2242/*
2245 * check if the device uses big-endian samples 2243 * check if the device uses big-endian samples
2246 */ 2244 */
2247static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp) 2245static int is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp)
2248{ 2246{
2249 switch (chip->usb_id) { 2247 switch (chip->usb_id) {
2250 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */ 2248 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */
@@ -2266,7 +2264,7 @@ static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp)
2266 * @format: the format tag (wFormatTag) 2264 * @format: the format tag (wFormatTag)
2267 * @fmt: the format type descriptor 2265 * @fmt: the format type descriptor
2268 */ 2266 */
2269static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat *fp, 2267static int parse_audio_format_i_type(struct snd_usb_audio *chip, struct audioformat *fp,
2270 int format, unsigned char *fmt) 2268 int format, unsigned char *fmt)
2271{ 2269{
2272 int pcm_format; 2270 int pcm_format;
@@ -2349,7 +2347,7 @@ static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat *
2349 * @offset: the start offset of descriptor pointing the rate type 2347 * @offset: the start offset of descriptor pointing the rate type
2350 * (7 for type I and II, 8 for type II) 2348 * (7 for type I and II, 8 for type II)
2351 */ 2349 */
2352static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *fp, 2350static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioformat *fp,
2353 unsigned char *fmt, int offset) 2351 unsigned char *fmt, int offset)
2354{ 2352{
2355 int nr_rates = fmt[offset]; 2353 int nr_rates = fmt[offset];
@@ -2402,7 +2400,7 @@ static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *f
2402/* 2400/*
2403 * parse the format type I and III descriptors 2401 * parse the format type I and III descriptors
2404 */ 2402 */
2405static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp, 2403static int parse_audio_format_i(struct snd_usb_audio *chip, struct audioformat *fp,
2406 int format, unsigned char *fmt) 2404 int format, unsigned char *fmt)
2407{ 2405{
2408 int pcm_format; 2406 int pcm_format;
@@ -2431,7 +2429,7 @@ static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp,
2431/* 2429/*
2432 * prase the format type II descriptor 2430 * prase the format type II descriptor
2433 */ 2431 */
2434static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp, 2432static int parse_audio_format_ii(struct snd_usb_audio *chip, struct audioformat *fp,
2435 int format, unsigned char *fmt) 2433 int format, unsigned char *fmt)
2436{ 2434{
2437 int brate, framesize; 2435 int brate, framesize;
@@ -2458,7 +2456,7 @@ static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp,
2458 return parse_audio_format_rates(chip, fp, fmt, 8); /* fmt[8..] sample rates */ 2456 return parse_audio_format_rates(chip, fp, fmt, 8); /* fmt[8..] sample rates */
2459} 2457}
2460 2458
2461static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp, 2459static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp,
2462 int format, unsigned char *fmt, int stream) 2460 int format, unsigned char *fmt, int stream)
2463{ 2461{
2464 int err; 2462 int err;
@@ -2495,7 +2493,7 @@ static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp,
2495 return 0; 2493 return 0;
2496} 2494}
2497 2495
2498static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no) 2496static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
2499{ 2497{
2500 struct usb_device *dev; 2498 struct usb_device *dev;
2501 struct usb_interface *iface; 2499 struct usb_interface *iface;
@@ -2646,10 +2644,10 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2646static void snd_usb_stream_disconnect(struct list_head *head) 2644static void snd_usb_stream_disconnect(struct list_head *head)
2647{ 2645{
2648 int idx; 2646 int idx;
2649 snd_usb_stream_t *as; 2647 struct snd_usb_stream *as;
2650 snd_usb_substream_t *subs; 2648 struct snd_usb_substream *subs;
2651 2649
2652 as = list_entry(head, snd_usb_stream_t, list); 2650 as = list_entry(head, struct snd_usb_stream, list);
2653 for (idx = 0; idx < 2; idx++) { 2651 for (idx = 0; idx < 2; idx++) {
2654 subs = &as->substream[idx]; 2652 subs = &as->substream[idx];
2655 if (!subs->num_formats) 2653 if (!subs->num_formats)
@@ -2662,7 +2660,7 @@ static void snd_usb_stream_disconnect(struct list_head *head)
2662/* 2660/*
2663 * parse audio control descriptor and create pcm/midi streams 2661 * parse audio control descriptor and create pcm/midi streams
2664 */ 2662 */
2665static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif) 2663static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
2666{ 2664{
2667 struct usb_device *dev = chip->dev; 2665 struct usb_device *dev = chip->dev;
2668 struct usb_host_interface *host_iface; 2666 struct usb_host_interface *host_iface;
@@ -2729,9 +2727,9 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif)
2729/* 2727/*
2730 * create a stream for an endpoint/altsetting without proper descriptors 2728 * create a stream for an endpoint/altsetting without proper descriptors
2731 */ 2729 */
2732static int create_fixed_stream_quirk(snd_usb_audio_t *chip, 2730static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
2733 struct usb_interface *iface, 2731 struct usb_interface *iface,
2734 const snd_usb_audio_quirk_t *quirk) 2732 const struct snd_usb_audio_quirk *quirk)
2735{ 2733{
2736 struct audioformat *fp; 2734 struct audioformat *fp;
2737 struct usb_host_interface *alts; 2735 struct usb_host_interface *alts;
@@ -2778,9 +2776,9 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip,
2778/* 2776/*
2779 * create a stream for an interface with proper descriptors 2777 * create a stream for an interface with proper descriptors
2780 */ 2778 */
2781static int create_standard_audio_quirk(snd_usb_audio_t *chip, 2779static int create_standard_audio_quirk(struct snd_usb_audio *chip,
2782 struct usb_interface *iface, 2780 struct usb_interface *iface,
2783 const snd_usb_audio_quirk_t *quirk) 2781 const struct snd_usb_audio_quirk *quirk)
2784{ 2782{
2785 struct usb_host_interface *alts; 2783 struct usb_host_interface *alts;
2786 struct usb_interface_descriptor *altsd; 2784 struct usb_interface_descriptor *altsd;
@@ -2803,9 +2801,9 @@ static int create_standard_audio_quirk(snd_usb_audio_t *chip,
2803 * Create a stream for an Edirol UA-700/UA-25 interface. The only way 2801 * Create a stream for an Edirol UA-700/UA-25 interface. The only way
2804 * to detect the sample rate is by looking at wMaxPacketSize. 2802 * to detect the sample rate is by looking at wMaxPacketSize.
2805 */ 2803 */
2806static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, 2804static int create_ua700_ua25_quirk(struct snd_usb_audio *chip,
2807 struct usb_interface *iface, 2805 struct usb_interface *iface,
2808 const snd_usb_audio_quirk_t *quirk) 2806 const struct snd_usb_audio_quirk *quirk)
2809{ 2807{
2810 static const struct audioformat ua_format = { 2808 static const struct audioformat ua_format = {
2811 .format = SNDRV_PCM_FORMAT_S24_3LE, 2809 .format = SNDRV_PCM_FORMAT_S24_3LE,
@@ -2827,19 +2825,19 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2827 altsd = get_iface_desc(alts); 2825 altsd = get_iface_desc(alts);
2828 2826
2829 if (altsd->bNumEndpoints == 2) { 2827 if (altsd->bNumEndpoints == 2) {
2830 static const snd_usb_midi_endpoint_info_t ua700_ep = { 2828 static const struct snd_usb_midi_endpoint_info ua700_ep = {
2831 .out_cables = 0x0003, 2829 .out_cables = 0x0003,
2832 .in_cables = 0x0003 2830 .in_cables = 0x0003
2833 }; 2831 };
2834 static const snd_usb_audio_quirk_t ua700_quirk = { 2832 static const struct snd_usb_audio_quirk ua700_quirk = {
2835 .type = QUIRK_MIDI_FIXED_ENDPOINT, 2833 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2836 .data = &ua700_ep 2834 .data = &ua700_ep
2837 }; 2835 };
2838 static const snd_usb_midi_endpoint_info_t ua25_ep = { 2836 static const struct snd_usb_midi_endpoint_info ua25_ep = {
2839 .out_cables = 0x0001, 2837 .out_cables = 0x0001,
2840 .in_cables = 0x0001 2838 .in_cables = 0x0001
2841 }; 2839 };
2842 static const snd_usb_audio_quirk_t ua25_quirk = { 2840 static const struct snd_usb_audio_quirk ua25_quirk = {
2843 .type = QUIRK_MIDI_FIXED_ENDPOINT, 2841 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2844 .data = &ua25_ep 2842 .data = &ua25_ep
2845 }; 2843 };
@@ -2896,9 +2894,9 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2896/* 2894/*
2897 * Create a stream for an Edirol UA-1000 interface. 2895 * Create a stream for an Edirol UA-1000 interface.
2898 */ 2896 */
2899static int create_ua1000_quirk(snd_usb_audio_t *chip, 2897static int create_ua1000_quirk(struct snd_usb_audio *chip,
2900 struct usb_interface *iface, 2898 struct usb_interface *iface,
2901 const snd_usb_audio_quirk_t *quirk) 2899 const struct snd_usb_audio_quirk *quirk)
2902{ 2900{
2903 static const struct audioformat ua1000_format = { 2901 static const struct audioformat ua1000_format = {
2904 .format = SNDRV_PCM_FORMAT_S32_LE, 2902 .format = SNDRV_PCM_FORMAT_S32_LE,
@@ -2945,16 +2943,16 @@ static int create_ua1000_quirk(snd_usb_audio_t *chip,
2945 return 0; 2943 return 0;
2946} 2944}
2947 2945
2948static int snd_usb_create_quirk(snd_usb_audio_t *chip, 2946static int snd_usb_create_quirk(struct snd_usb_audio *chip,
2949 struct usb_interface *iface, 2947 struct usb_interface *iface,
2950 const snd_usb_audio_quirk_t *quirk); 2948 const struct snd_usb_audio_quirk *quirk);
2951 2949
2952/* 2950/*
2953 * handle the quirks for the contained interfaces 2951 * handle the quirks for the contained interfaces
2954 */ 2952 */
2955static int create_composite_quirk(snd_usb_audio_t *chip, 2953static int create_composite_quirk(struct snd_usb_audio *chip,
2956 struct usb_interface *iface, 2954 struct usb_interface *iface,
2957 const snd_usb_audio_quirk_t *quirk) 2955 const struct snd_usb_audio_quirk *quirk)
2958{ 2956{
2959 int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber; 2957 int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber;
2960 int err; 2958 int err;
@@ -2975,9 +2973,9 @@ static int create_composite_quirk(snd_usb_audio_t *chip,
2975 return 0; 2973 return 0;
2976} 2974}
2977 2975
2978static int ignore_interface_quirk(snd_usb_audio_t *chip, 2976static int ignore_interface_quirk(struct snd_usb_audio *chip,
2979 struct usb_interface *iface, 2977 struct usb_interface *iface,
2980 const snd_usb_audio_quirk_t *quirk) 2978 const struct snd_usb_audio_quirk *quirk)
2981{ 2979{
2982 return 0; 2980 return 0;
2983} 2981}
@@ -3040,12 +3038,12 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev)
3040 * after this. 3038 * after this.
3041 * returns a negative value at error. 3039 * returns a negative value at error.
3042 */ 3040 */
3043static int snd_usb_create_quirk(snd_usb_audio_t *chip, 3041static int snd_usb_create_quirk(struct snd_usb_audio *chip,
3044 struct usb_interface *iface, 3042 struct usb_interface *iface,
3045 const snd_usb_audio_quirk_t *quirk) 3043 const struct snd_usb_audio_quirk *quirk)
3046{ 3044{
3047 typedef int (*quirk_func_t)(snd_usb_audio_t *, struct usb_interface *, 3045 typedef int (*quirk_func_t)(struct snd_usb_audio *, struct usb_interface *,
3048 const snd_usb_audio_quirk_t *); 3046 const struct snd_usb_audio_quirk *);
3049 static const quirk_func_t quirk_funcs[] = { 3047 static const quirk_func_t quirk_funcs[] = {
3050 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, 3048 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
3051 [QUIRK_COMPOSITE] = create_composite_quirk, 3049 [QUIRK_COMPOSITE] = create_composite_quirk,
@@ -3075,25 +3073,25 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip,
3075/* 3073/*
3076 * common proc files to show the usb device info 3074 * common proc files to show the usb device info
3077 */ 3075 */
3078static void proc_audio_usbbus_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 3076static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3079{ 3077{
3080 snd_usb_audio_t *chip = entry->private_data; 3078 struct snd_usb_audio *chip = entry->private_data;
3081 if (! chip->shutdown) 3079 if (! chip->shutdown)
3082 snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum); 3080 snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum);
3083} 3081}
3084 3082
3085static void proc_audio_usbid_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 3083static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3086{ 3084{
3087 snd_usb_audio_t *chip = entry->private_data; 3085 struct snd_usb_audio *chip = entry->private_data;
3088 if (! chip->shutdown) 3086 if (! chip->shutdown)
3089 snd_iprintf(buffer, "%04x:%04x\n", 3087 snd_iprintf(buffer, "%04x:%04x\n",
3090 USB_ID_VENDOR(chip->usb_id), 3088 USB_ID_VENDOR(chip->usb_id),
3091 USB_ID_PRODUCT(chip->usb_id)); 3089 USB_ID_PRODUCT(chip->usb_id));
3092} 3090}
3093 3091
3094static void snd_usb_audio_create_proc(snd_usb_audio_t *chip) 3092static void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
3095{ 3093{
3096 snd_info_entry_t *entry; 3094 struct snd_info_entry *entry;
3097 if (! snd_card_proc_new(chip->card, "usbbus", &entry)) 3095 if (! snd_card_proc_new(chip->card, "usbbus", &entry))
3098 snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbbus_read); 3096 snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbbus_read);
3099 if (! snd_card_proc_new(chip->card, "usbid", &entry)) 3097 if (! snd_card_proc_new(chip->card, "usbid", &entry))
@@ -3107,15 +3105,15 @@ static void snd_usb_audio_create_proc(snd_usb_audio_t *chip)
3107 * 3105 *
3108 */ 3106 */
3109 3107
3110static int snd_usb_audio_free(snd_usb_audio_t *chip) 3108static int snd_usb_audio_free(struct snd_usb_audio *chip)
3111{ 3109{
3112 kfree(chip); 3110 kfree(chip);
3113 return 0; 3111 return 0;
3114} 3112}
3115 3113
3116static int snd_usb_audio_dev_free(snd_device_t *device) 3114static int snd_usb_audio_dev_free(struct snd_device *device)
3117{ 3115{
3118 snd_usb_audio_t *chip = device->device_data; 3116 struct snd_usb_audio *chip = device->device_data;
3119 return snd_usb_audio_free(chip); 3117 return snd_usb_audio_free(chip);
3120} 3118}
3121 3119
@@ -3124,14 +3122,14 @@ static int snd_usb_audio_dev_free(snd_device_t *device)
3124 * create a chip instance and set its names. 3122 * create a chip instance and set its names.
3125 */ 3123 */
3126static int snd_usb_audio_create(struct usb_device *dev, int idx, 3124static int snd_usb_audio_create(struct usb_device *dev, int idx,
3127 const snd_usb_audio_quirk_t *quirk, 3125 const struct snd_usb_audio_quirk *quirk,
3128 snd_usb_audio_t **rchip) 3126 struct snd_usb_audio **rchip)
3129{ 3127{
3130 snd_card_t *card; 3128 struct snd_card *card;
3131 snd_usb_audio_t *chip; 3129 struct snd_usb_audio *chip;
3132 int err, len; 3130 int err, len;
3133 char component[14]; 3131 char component[14];
3134 static snd_device_ops_t ops = { 3132 static struct snd_device_ops ops = {
3135 .dev_free = snd_usb_audio_dev_free, 3133 .dev_free = snd_usb_audio_dev_free,
3136 }; 3134 };
3137 3135
@@ -3235,9 +3233,9 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3235 struct usb_interface *intf, 3233 struct usb_interface *intf,
3236 const struct usb_device_id *usb_id) 3234 const struct usb_device_id *usb_id)
3237{ 3235{
3238 const snd_usb_audio_quirk_t *quirk = (const snd_usb_audio_quirk_t *)usb_id->driver_info; 3236 const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info;
3239 int i, err; 3237 int i, err;
3240 snd_usb_audio_t *chip; 3238 struct snd_usb_audio *chip;
3241 struct usb_host_interface *alts; 3239 struct usb_host_interface *alts;
3242 int ifnum; 3240 int ifnum;
3243 u32 id; 3241 u32 id;
@@ -3338,8 +3336,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3338 */ 3336 */
3339static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) 3337static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
3340{ 3338{
3341 snd_usb_audio_t *chip; 3339 struct snd_usb_audio *chip;
3342 snd_card_t *card; 3340 struct snd_card *card;
3343 struct list_head *p; 3341 struct list_head *p;
3344 3342
3345 if (ptr == (void *)-1L) 3343 if (ptr == (void *)-1L)