diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 16:38:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 16:38:36 -0800 |
commit | 4da5cc2cec8caec1d357053e85a7a32f243f93a1 (patch) | |
tree | 3f8b603af4af88f86be7ec1d4e3639a7fc9dd1a6 /sound/usb | |
parent | 25c862cc9ea9b312c25a9f577f91b973131f1261 (diff) | |
parent | c6f43290ae687c11cdcd150d8bfeb57ec29cfa5b (diff) | |
download | op-kernel-dev-4da5cc2cec8caec1d357053e85a7a32f243f93a1.zip op-kernel-dev-4da5cc2cec8caec1d357053e85a7a32f243f93a1.tar.gz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usbaudio.c | 374 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 16 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 211 | ||||
-rw-r--r-- | sound/usb/usbmixer.c | 183 | ||||
-rw-r--r-- | sound/usb/usbquirks.h | 310 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 65 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.h | 2 | ||||
-rw-r--r-- | sound/usb/usx2y/usbus428ctldefs.h | 36 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 49 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.h | 45 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 383 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 206 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.h | 1 |
13 files changed, 954 insertions, 927 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 22f8bb6..a1bd804 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -102,10 +102,6 @@ MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); #define SYNC_URBS 4 /* always four urbs for sync */ #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ -typedef struct snd_usb_substream snd_usb_substream_t; -typedef struct snd_usb_stream snd_usb_stream_t; -typedef struct snd_urb_ctx snd_urb_ctx_t; - struct audioformat { struct list_head list; snd_pcm_format_t format; /* format type */ @@ -125,25 +121,27 @@ struct audioformat { unsigned int *rate_table; /* rate table */ }; +struct snd_usb_substream; + struct snd_urb_ctx { struct urb *urb; unsigned int buffer_size; /* size of data buffer, if data URB */ - snd_usb_substream_t *subs; + struct snd_usb_substream *subs; int index; /* index for urb array */ int packets; /* number of packets per urb */ }; struct snd_urb_ops { - int (*prepare)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); - int (*retire)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); - int (*prepare_sync)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); - int (*retire_sync)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); + int (*prepare)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u); + int (*retire)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u); + int (*prepare_sync)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u); + int (*retire_sync)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u); }; struct snd_usb_substream { - snd_usb_stream_t *stream; + struct snd_usb_stream *stream; struct usb_device *dev; - snd_pcm_substream_t *pcm_substream; + struct snd_pcm_substream *pcm_substream; int direction; /* playback or capture */ int interface; /* current interface */ int endpoint; /* assigned endpoint */ @@ -175,8 +173,8 @@ struct snd_usb_substream { unsigned long unlink_mask; /* bitmask of unlinked urbs */ unsigned int nurbs; /* # urbs */ - snd_urb_ctx_t dataurb[MAX_URBS]; /* data urb table */ - snd_urb_ctx_t syncurb[SYNC_URBS]; /* sync urb table */ + struct snd_urb_ctx dataurb[MAX_URBS]; /* data urb table */ + struct snd_urb_ctx syncurb[SYNC_URBS]; /* sync urb table */ char *syncbuf; /* sync buffer for all sync URBs */ dma_addr_t sync_dma; /* DMA address of syncbuf */ @@ -190,11 +188,11 @@ struct snd_usb_substream { struct snd_usb_stream { - snd_usb_audio_t *chip; - snd_pcm_t *pcm; + struct snd_usb_audio *chip; + struct snd_pcm *pcm; int pcm_index; unsigned int fmt_type; /* USB audio format type (1-3) */ - snd_usb_substream_t substream[2]; + struct snd_usb_substream substream[2]; struct list_head list; }; @@ -205,7 +203,7 @@ struct snd_usb_stream { */ static DECLARE_MUTEX(register_mutex); -static snd_usb_audio_t *usb_chip[SNDRV_CARDS]; +static struct snd_usb_audio *usb_chip[SNDRV_CARDS]; /* @@ -245,12 +243,12 @@ static inline unsigned get_high_speed_hz(unsigned int usb_rate) * fill the length and offset of each urb descriptor. * the fixed 10.14 frequency is passed through the pipe. */ -static int prepare_capture_sync_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_capture_sync_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { unsigned char *cp = urb->transfer_buffer; - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; urb->dev = ctx->subs->dev; /* we need to set this at each time */ urb->iso_frame_desc[0].length = 3; @@ -267,12 +265,12 @@ static int prepare_capture_sync_urb(snd_usb_substream_t *subs, * fill the length and offset of each urb descriptor. * the fixed 12.13 frequency is passed as 16.16 through the pipe. */ -static int prepare_capture_sync_urb_hs(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_capture_sync_urb_hs(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { unsigned char *cp = urb->transfer_buffer; - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; urb->dev = ctx->subs->dev; /* we need to set this at each time */ urb->iso_frame_desc[0].length = 4; @@ -288,8 +286,8 @@ static int prepare_capture_sync_urb_hs(snd_usb_substream_t *subs, * process after capture sync complete * - nothing to do */ -static int retire_capture_sync_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int retire_capture_sync_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { return 0; @@ -305,12 +303,12 @@ static int retire_capture_sync_urb(snd_usb_substream_t *subs, * write onto the pcm buffer directly... the data is thus copied * later at complete callback to the global buffer. */ -static int prepare_capture_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_capture_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { int i, offs; - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; offs = 0; 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, * copy the data from each desctiptor to the pcm buffer, and * update the current position. */ -static int retire_capture_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int retire_capture_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { unsigned long flags; @@ -395,11 +393,11 @@ static int retire_capture_urb(snd_usb_substream_t *subs, * set up the offset and length to receive the current frequency. */ -static int prepare_playback_sync_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_playback_sync_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; urb->dev = ctx->subs->dev; /* we need to set this at each time */ urb->iso_frame_desc[0].length = 3; @@ -413,11 +411,11 @@ static int prepare_playback_sync_urb(snd_usb_substream_t *subs, * set up the offset and length to receive the current frequency. */ -static int prepare_playback_sync_urb_hs(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_playback_sync_urb_hs(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; urb->dev = ctx->subs->dev; /* we need to set this at each time */ urb->iso_frame_desc[0].length = 4; @@ -431,8 +429,8 @@ static int prepare_playback_sync_urb_hs(snd_usb_substream_t *subs, * retrieve the current 10.14 frequency from pipe, and set it. * the value is referred in prepare_playback_urb(). */ -static int retire_playback_sync_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int retire_playback_sync_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { unsigned int f; @@ -457,8 +455,8 @@ static int retire_playback_sync_urb(snd_usb_substream_t *subs, * retrieve the current 12.13 frequency from pipe, and set it. * the value is referred in prepare_playback_urb(). */ -static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { unsigned int f; @@ -482,12 +480,12 @@ static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, * * We don't care about (or have) any data, so we just send a transfer delimiter. */ -static int prepare_startup_playback_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_startup_playback_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { unsigned int i; - snd_urb_ctx_t *ctx = urb->context; + struct snd_urb_ctx *ctx = urb->context; urb->dev = ctx->subs->dev; urb->number_of_packets = subs->packs_per_ms; @@ -507,15 +505,15 @@ static int prepare_startup_playback_urb(snd_usb_substream_t *subs, * To avoid inconsistencies when updating hwptr_done, we use double buffering * for all URBs. */ -static int prepare_playback_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int prepare_playback_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { int i, stride, offs; unsigned int counts; unsigned long flags; int period_elapsed = 0; - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; stride = runtime->frame_bits >> 3; @@ -597,8 +595,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, * process after playback data complete * - nothing to do */ -static int retire_playback_urb(snd_usb_substream_t *subs, - snd_pcm_runtime_t *runtime, +static int retire_playback_urb(struct snd_usb_substream *subs, + struct snd_pcm_runtime *runtime, struct urb *urb) { return 0; @@ -642,9 +640,9 @@ static struct snd_urb_ops audio_urb_ops_high_speed[2] = { */ static void snd_complete_urb(struct urb *urb, struct pt_regs *regs) { - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; - snd_usb_substream_t *subs = ctx->subs; - snd_pcm_substream_t *substream = ctx->subs->pcm_substream; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; + struct snd_usb_substream *subs = ctx->subs; + struct snd_pcm_substream *substream = ctx->subs->pcm_substream; int err = 0; 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) */ static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs) { - snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; - snd_usb_substream_t *subs = ctx->subs; - snd_pcm_substream_t *substream = ctx->subs->pcm_substream; + struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context; + struct snd_usb_substream *subs = ctx->subs; + struct snd_pcm_substream *substream = ctx->subs->pcm_substream; int err = 0; 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) /* get the physical page pointer at the given offset */ -static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, +static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, unsigned long offset) { void *pageptr = subs->runtime->dma_area + offset; @@ -692,9 +690,9 @@ static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, } /* allocate virtual buffer; may be called more than once */ -static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) +static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size) { - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (runtime->dma_area) { if (runtime->dma_bytes >= size) return 0; /* already large enough */ @@ -708,9 +706,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) } /* free virtual buffer; may be called more than once */ -static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) +static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (runtime->dma_area) { vfree(runtime->dma_area); runtime->dma_area = NULL; @@ -722,7 +720,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) /* * unlink active urbs. */ -static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) +static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sleep) { unsigned int i; int async; @@ -768,7 +766,7 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) /* * set up and start data/sync urbs */ -static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime) +static int start_urbs(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime) { unsigned int i; int err; @@ -824,7 +822,7 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime) /* * wait until all urbs are processed. */ -static int wait_clear_urbs(snd_usb_substream_t *subs) +static int wait_clear_urbs(struct snd_usb_substream *subs) { unsigned long end_time = jiffies + msecs_to_jiffies(1000); unsigned int i; @@ -855,12 +853,12 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) /* * return the current pcm pointer. just return the hwptr_done value. */ -static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) +static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream) { - snd_usb_substream_t *subs; + struct snd_usb_substream *subs; snd_pcm_uframes_t hwptr_done; - subs = (snd_usb_substream_t *)substream->runtime->private_data; + subs = (struct snd_usb_substream *)substream->runtime->private_data; spin_lock(&subs->lock); hwptr_done = subs->hwptr_done; spin_unlock(&subs->lock); @@ -871,10 +869,10 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) /* * start/stop playback substream */ -static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream, +static int snd_usb_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_usb_substream_t *subs = substream->runtime->private_data; + struct snd_usb_substream *subs = substream->runtime->private_data; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -890,10 +888,10 @@ static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream, /* * start/stop capture substream */ -static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream, +static int snd_usb_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_usb_substream_t *subs = substream->runtime->private_data; + struct snd_usb_substream *subs = substream->runtime->private_data; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -909,7 +907,7 @@ static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream, /* * release a urb data */ -static void release_urb_ctx(snd_urb_ctx_t *u) +static void release_urb_ctx(struct snd_urb_ctx *u) { if (u->urb) { if (u->buffer_size) @@ -924,7 +922,7 @@ static void release_urb_ctx(snd_urb_ctx_t *u) /* * release a substream */ -static void release_substream_urbs(snd_usb_substream_t *subs, int force) +static void release_substream_urbs(struct snd_usb_substream *subs, int force) { int i; @@ -945,7 +943,7 @@ static void release_substream_urbs(snd_usb_substream_t *subs, int force) /* * initialize a substream for plaback/capture */ -static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_bytes, +static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int period_bytes, unsigned int rate, unsigned int frame_bits) { unsigned int maxsize, n, i; @@ -1045,7 +1043,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by /* allocate and initialize data urbs */ for (i = 0; i < subs->nurbs; i++) { - snd_urb_ctx_t *u = &subs->dataurb[i]; + struct snd_urb_ctx *u = &subs->dataurb[i]; u->index = i; u->subs = subs; u->packets = npacks[i]; @@ -1074,7 +1072,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by if (! subs->syncbuf) goto out_of_memory; for (i = 0; i < SYNC_URBS; i++) { - snd_urb_ctx_t *u = &subs->syncurb[i]; + struct snd_urb_ctx *u = &subs->syncurb[i]; u->index = i; u->subs = subs; u->packets = 1; @@ -1104,7 +1102,7 @@ out_of_memory: /* * find a matching audio format */ -static struct audioformat *find_format(snd_usb_substream_t *subs, unsigned int format, +static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned int format, unsigned int rate, unsigned int channels) { struct list_head *p; @@ -1229,7 +1227,7 @@ static int init_usb_sample_rate(struct usb_device *dev, int iface, /* * find a matching format and set up the interface */ -static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) +static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) { struct usb_device *dev = subs->dev; struct usb_host_interface *alts; @@ -1358,10 +1356,10 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) * if sg buffer is supported on the later version of alsa, we'll follow * that. */ -static int snd_usb_hw_params(snd_pcm_substream_t *substream, - snd_pcm_hw_params_t *hw_params) +static int snd_usb_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; + struct snd_usb_substream *subs = (struct snd_usb_substream *)substream->runtime->private_data; struct audioformat *fmt; unsigned int channels, rate, format; int ret, changed; @@ -1415,9 +1413,9 @@ static int snd_usb_hw_params(snd_pcm_substream_t *substream, * * reset the audio format and release the buffer */ -static int snd_usb_hw_free(snd_pcm_substream_t *substream) +static int snd_usb_hw_free(struct snd_pcm_substream *substream) { - snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; + struct snd_usb_substream *subs = (struct snd_usb_substream *)substream->runtime->private_data; subs->cur_audiofmt = NULL; subs->cur_rate = 0; @@ -1431,10 +1429,10 @@ static int snd_usb_hw_free(snd_pcm_substream_t *substream) * * only a few subtle things... */ -static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) +static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usb_substream_t *subs = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usb_substream *subs = runtime->private_data; if (! subs->cur_audiofmt) { 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) return 0; } -static snd_pcm_hardware_t snd_usb_playback = +static struct snd_pcm_hardware snd_usb_playback = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -1477,7 +1475,7 @@ static snd_pcm_hardware_t snd_usb_playback = .periods_max = 1024, }; -static snd_pcm_hardware_t snd_usb_capture = +static struct snd_pcm_hardware snd_usb_capture = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -1501,11 +1499,11 @@ static snd_pcm_hardware_t snd_usb_capture = #define hwc_debug(fmt, args...) /**/ #endif -static int hw_check_valid_format(snd_pcm_hw_params_t *params, struct audioformat *fp) +static int hw_check_valid_format(struct snd_pcm_hw_params *params, struct audioformat *fp) { - snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); - snd_interval_t *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); - snd_mask_t *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); + struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); /* check the format */ 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 return 1; } -static int hw_rule_rate(snd_pcm_hw_params_t *params, - snd_pcm_hw_rule_t *rule) +static int hw_rule_rate(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) { - snd_usb_substream_t *subs = rule->private; + struct snd_usb_substream *subs = rule->private; struct list_head *p; - snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); unsigned int rmin, rmax; int changed; @@ -1583,12 +1581,12 @@ static int hw_rule_rate(snd_pcm_hw_params_t *params, } -static int hw_rule_channels(snd_pcm_hw_params_t *params, - snd_pcm_hw_rule_t *rule) +static int hw_rule_channels(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) { - snd_usb_substream_t *subs = rule->private; + struct snd_usb_substream *subs = rule->private; struct list_head *p; - snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); + struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); unsigned int rmin, rmax; int changed; @@ -1636,12 +1634,12 @@ static int hw_rule_channels(snd_pcm_hw_params_t *params, return changed; } -static int hw_rule_format(snd_pcm_hw_params_t *params, - snd_pcm_hw_rule_t *rule) +static int hw_rule_format(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) { - snd_usb_substream_t *subs = rule->private; + struct snd_usb_substream *subs = rule->private; struct list_head *p; - snd_mask_t *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); u64 fbits; u32 oldbits[2]; int changed; @@ -1674,7 +1672,7 @@ static int hw_rule_format(snd_pcm_hw_params_t *params, /* * check whether the registered audio formats need special hw-constraints */ -static int check_hw_params_convention(snd_usb_substream_t *subs) +static int check_hw_params_convention(struct snd_usb_substream *subs) { int i; u32 *channels; @@ -1758,7 +1756,7 @@ static int check_hw_params_convention(snd_usb_substream_t *subs) * set up the runtime hardware information. */ -static int setup_hw_info(snd_pcm_runtime_t *runtime, snd_usb_substream_t *subs) +static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs) { struct list_head *p; int err; @@ -1819,12 +1817,12 @@ static int setup_hw_info(snd_pcm_runtime_t *runtime, snd_usb_substream_t *subs) return 0; } -static int snd_usb_pcm_open(snd_pcm_substream_t *substream, int direction, - snd_pcm_hardware_t *hw) +static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction, + struct snd_pcm_hardware *hw) { - snd_usb_stream_t *as = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usb_substream_t *subs = &as->substream[direction]; + struct snd_usb_stream *as = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usb_substream *subs = &as->substream[direction]; subs->interface = -1; subs->format = 0; @@ -1834,10 +1832,10 @@ static int snd_usb_pcm_open(snd_pcm_substream_t *substream, int direction, return setup_hw_info(runtime, subs); } -static int snd_usb_pcm_close(snd_pcm_substream_t *substream, int direction) +static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction) { - snd_usb_stream_t *as = snd_pcm_substream_chip(substream); - snd_usb_substream_t *subs = &as->substream[direction]; + struct snd_usb_stream *as = snd_pcm_substream_chip(substream); + struct snd_usb_substream *subs = &as->substream[direction]; if (subs->interface >= 0) { 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) return 0; } -static int snd_usb_playback_open(snd_pcm_substream_t *substream) +static int snd_usb_playback_open(struct snd_pcm_substream *substream) { return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_PLAYBACK, &snd_usb_playback); } -static int snd_usb_playback_close(snd_pcm_substream_t *substream) +static int snd_usb_playback_close(struct snd_pcm_substream *substream) { return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_PLAYBACK); } -static int snd_usb_capture_open(snd_pcm_substream_t *substream) +static int snd_usb_capture_open(struct snd_pcm_substream *substream) { return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_CAPTURE, &snd_usb_capture); } -static int snd_usb_capture_close(snd_pcm_substream_t *substream) +static int snd_usb_capture_close(struct snd_pcm_substream *substream) { return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_CAPTURE); } -static snd_pcm_ops_t snd_usb_playback_ops = { +static struct snd_pcm_ops snd_usb_playback_ops = { .open = snd_usb_playback_open, .close = snd_usb_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -1879,7 +1877,7 @@ static snd_pcm_ops_t snd_usb_playback_ops = { .page = snd_pcm_get_vmalloc_page, }; -static snd_pcm_ops_t snd_usb_capture_ops = { +static struct snd_pcm_ops snd_usb_capture_ops = { .open = snd_usb_capture_open, .close = snd_usb_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -2006,7 +2004,7 @@ static struct usb_driver usb_audio_driver = { /* * proc interface for list the supported pcm formats */ -static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buffer_t *buffer) +static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer) { struct list_head *p; static char *sync_types[4] = { @@ -2042,7 +2040,7 @@ static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buff } } -static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffer_t *buffer) +static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer) { if (subs->running) { unsigned int i; @@ -2064,9 +2062,9 @@ static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffe } } -static void proc_pcm_format_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) +static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - snd_usb_stream_t *stream = entry->private_data; + struct snd_usb_stream *stream = entry->private_data; snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name); @@ -2082,11 +2080,11 @@ static void proc_pcm_format_read(snd_info_entry_t *entry, snd_info_buffer_t *buf } } -static void proc_pcm_format_add(snd_usb_stream_t *stream) +static void proc_pcm_format_add(struct snd_usb_stream *stream) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; char name[32]; - snd_card_t *card = stream->chip->card; + struct snd_card *card = stream->chip->card; sprintf(name, "stream%d", stream->pcm_index); if (! snd_card_proc_new(card, name, &entry)) @@ -2098,9 +2096,9 @@ static void proc_pcm_format_add(snd_usb_stream_t *stream) * initialize the substream instance. */ -static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat *fp) +static void init_substream(struct snd_usb_stream *as, int stream, struct audioformat *fp) { - snd_usb_substream_t *subs = &as->substream[stream]; + struct snd_usb_substream *subs = &as->substream[stream]; INIT_LIST_HEAD(&subs->fmt_list); spin_lock_init(&subs->lock); @@ -2127,7 +2125,7 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat /* * free a substream */ -static void free_substream(snd_usb_substream_t *subs) +static void free_substream(struct snd_usb_substream *subs) { struct list_head *p, *n; @@ -2144,7 +2142,7 @@ static void free_substream(snd_usb_substream_t *subs) /* * free a usb stream instance */ -static void snd_usb_audio_stream_free(snd_usb_stream_t *stream) +static void snd_usb_audio_stream_free(struct snd_usb_stream *stream) { free_substream(&stream->substream[0]); free_substream(&stream->substream[1]); @@ -2152,9 +2150,9 @@ static void snd_usb_audio_stream_free(snd_usb_stream_t *stream) kfree(stream); } -static void snd_usb_audio_pcm_free(snd_pcm_t *pcm) +static void snd_usb_audio_pcm_free(struct snd_pcm *pcm) { - snd_usb_stream_t *stream = pcm->private_data; + struct snd_usb_stream *stream = pcm->private_data; if (stream) { stream->pcm = NULL; snd_usb_audio_stream_free(stream); @@ -2167,16 +2165,16 @@ static void snd_usb_audio_pcm_free(snd_pcm_t *pcm) * if a stream with the same endpoint already exists, append to it. * if not, create a new pcm stream. */ -static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audioformat *fp) +static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct audioformat *fp) { struct list_head *p; - snd_usb_stream_t *as; - snd_usb_substream_t *subs; - snd_pcm_t *pcm; + struct snd_usb_stream *as; + struct snd_usb_substream *subs; + struct snd_pcm *pcm; int err; list_for_each(p, &chip->pcm_list) { - as = list_entry(p, snd_usb_stream_t, list); + as = list_entry(p, struct snd_usb_stream, list); if (as->fmt_type != fp->fmt_type) continue; subs = &as->substream[stream]; @@ -2191,7 +2189,7 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor } /* look for an empty stream */ list_for_each(p, &chip->pcm_list) { - as = list_entry(p, snd_usb_stream_t, list); + as = list_entry(p, struct snd_usb_stream, list); if (as->fmt_type != fp->fmt_type) continue; subs = &as->substream[stream]; @@ -2243,7 +2241,7 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor /* * check if the device uses big-endian samples */ -static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp) +static int is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp) { switch (chip->usb_id) { case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */ @@ -2265,7 +2263,7 @@ static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp) * @format: the format tag (wFormatTag) * @fmt: the format type descriptor */ -static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat *fp, +static int parse_audio_format_i_type(struct snd_usb_audio *chip, struct audioformat *fp, int format, unsigned char *fmt) { int pcm_format; @@ -2348,7 +2346,7 @@ static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat * * @offset: the start offset of descriptor pointing the rate type * (7 for type I and II, 8 for type II) */ -static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *fp, +static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioformat *fp, unsigned char *fmt, int offset) { int nr_rates = fmt[offset]; @@ -2401,7 +2399,7 @@ static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *f /* * parse the format type I and III descriptors */ -static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp, +static int parse_audio_format_i(struct snd_usb_audio *chip, struct audioformat *fp, int format, unsigned char *fmt) { int pcm_format; @@ -2430,7 +2428,7 @@ static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp, /* * prase the format type II descriptor */ -static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp, +static int parse_audio_format_ii(struct snd_usb_audio *chip, struct audioformat *fp, int format, unsigned char *fmt) { int brate, framesize; @@ -2457,7 +2455,7 @@ static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp, return parse_audio_format_rates(chip, fp, fmt, 8); /* fmt[8..] sample rates */ } -static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp, +static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, int format, unsigned char *fmt, int stream) { int err; @@ -2494,7 +2492,7 @@ static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp, return 0; } -static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no) +static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) { struct usb_device *dev; struct usb_interface *iface; @@ -2645,10 +2643,10 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no) static void snd_usb_stream_disconnect(struct list_head *head) { int idx; - snd_usb_stream_t *as; - snd_usb_substream_t *subs; + struct snd_usb_stream *as; + struct snd_usb_substream *subs; - as = list_entry(head, snd_usb_stream_t, list); + as = list_entry(head, struct snd_usb_stream, list); for (idx = 0; idx < 2; idx++) { subs = &as->substream[idx]; if (!subs->num_formats) @@ -2661,7 +2659,7 @@ static void snd_usb_stream_disconnect(struct list_head *head) /* * parse audio control descriptor and create pcm/midi streams */ -static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif) +static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) { struct usb_device *dev = chip->dev; struct usb_host_interface *host_iface; @@ -2728,9 +2726,9 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif) /* * create a stream for an endpoint/altsetting without proper descriptors */ -static int create_fixed_stream_quirk(snd_usb_audio_t *chip, +static int create_fixed_stream_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { struct audioformat *fp; struct usb_host_interface *alts; @@ -2777,9 +2775,9 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip, /* * create a stream for an interface with proper descriptors */ -static int create_standard_audio_quirk(snd_usb_audio_t *chip, +static int create_standard_audio_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { struct usb_host_interface *alts; struct usb_interface_descriptor *altsd; @@ -2802,9 +2800,9 @@ static int create_standard_audio_quirk(snd_usb_audio_t *chip, * Create a stream for an Edirol UA-700/UA-25 interface. The only way * to detect the sample rate is by looking at wMaxPacketSize. */ -static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, +static int create_ua700_ua25_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { static const struct audioformat ua_format = { .format = SNDRV_PCM_FORMAT_S24_3LE, @@ -2826,19 +2824,19 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, altsd = get_iface_desc(alts); if (altsd->bNumEndpoints == 2) { - static const snd_usb_midi_endpoint_info_t ua700_ep = { + static const struct snd_usb_midi_endpoint_info ua700_ep = { .out_cables = 0x0003, .in_cables = 0x0003 }; - static const snd_usb_audio_quirk_t ua700_quirk = { + static const struct snd_usb_audio_quirk ua700_quirk = { .type = QUIRK_MIDI_FIXED_ENDPOINT, .data = &ua700_ep }; - static const snd_usb_midi_endpoint_info_t ua25_ep = { + static const struct snd_usb_midi_endpoint_info ua25_ep = { .out_cables = 0x0001, .in_cables = 0x0001 }; - static const snd_usb_audio_quirk_t ua25_quirk = { + static const struct snd_usb_audio_quirk ua25_quirk = { .type = QUIRK_MIDI_FIXED_ENDPOINT, .data = &ua25_ep }; @@ -2895,9 +2893,9 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, /* * Create a stream for an Edirol UA-1000 interface. */ -static int create_ua1000_quirk(snd_usb_audio_t *chip, +static int create_ua1000_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { static const struct audioformat ua1000_format = { .format = SNDRV_PCM_FORMAT_S32_LE, @@ -2944,16 +2942,16 @@ static int create_ua1000_quirk(snd_usb_audio_t *chip, return 0; } -static int snd_usb_create_quirk(snd_usb_audio_t *chip, +static int snd_usb_create_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk); + const struct snd_usb_audio_quirk *quirk); /* * handle the quirks for the contained interfaces */ -static int create_composite_quirk(snd_usb_audio_t *chip, +static int create_composite_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber; int err; @@ -2974,9 +2972,9 @@ static int create_composite_quirk(snd_usb_audio_t *chip, return 0; } -static int ignore_interface_quirk(snd_usb_audio_t *chip, +static int ignore_interface_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { return 0; } @@ -3039,12 +3037,12 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) * after this. * returns a negative value at error. */ -static int snd_usb_create_quirk(snd_usb_audio_t *chip, +static int snd_usb_create_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, - const snd_usb_audio_quirk_t *quirk) + const struct snd_usb_audio_quirk *quirk) { - typedef int (*quirk_func_t)(snd_usb_audio_t *, struct usb_interface *, - const snd_usb_audio_quirk_t *); + typedef int (*quirk_func_t)(struct snd_usb_audio *, struct usb_interface *, + const struct snd_usb_audio_quirk *); static const quirk_func_t quirk_funcs[] = { [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, [QUIRK_COMPOSITE] = create_composite_quirk, @@ -3074,25 +3072,25 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip, /* * common proc files to show the usb device info */ -static void proc_audio_usbbus_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) +static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - snd_usb_audio_t *chip = entry->private_data; + struct snd_usb_audio *chip = entry->private_data; if (! chip->shutdown) snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum); } -static void proc_audio_usbid_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) +static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - snd_usb_audio_t *chip = entry->private_data; + struct snd_usb_audio *chip = entry->private_data; if (! chip->shutdown) snd_iprintf(buffer, "%04x:%04x\n", USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id)); } -static void snd_usb_audio_create_proc(snd_usb_audio_t *chip) +static void snd_usb_audio_create_proc(struct snd_usb_audio *chip) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if (! snd_card_proc_new(chip->card, "usbbus", &entry)) snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbbus_read); if (! snd_card_proc_new(chip->card, "usbid", &entry)) @@ -3106,15 +3104,15 @@ static void snd_usb_audio_create_proc(snd_usb_audio_t *chip) * */ -static int snd_usb_audio_free(snd_usb_audio_t *chip) +static int snd_usb_audio_free(struct snd_usb_audio *chip) { kfree(chip); return 0; } -static int snd_usb_audio_dev_free(snd_device_t *device) +static int snd_usb_audio_dev_free(struct snd_device *device) { - snd_usb_audio_t *chip = device->device_data; + struct snd_usb_audio *chip = device->device_data; return snd_usb_audio_free(chip); } @@ -3123,14 +3121,14 @@ static int snd_usb_audio_dev_free(snd_device_t *device) * create a chip instance and set its names. */ static int snd_usb_audio_create(struct usb_device *dev, int idx, - const snd_usb_audio_quirk_t *quirk, - snd_usb_audio_t **rchip) + const struct snd_usb_audio_quirk *quirk, + struct snd_usb_audio **rchip) { - snd_card_t *card; - snd_usb_audio_t *chip; + struct snd_card *card; + struct snd_usb_audio *chip; int err, len; char component[14]; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_usb_audio_dev_free, }; @@ -3234,9 +3232,9 @@ static void *snd_usb_audio_probe(struct usb_device *dev, struct usb_interface *intf, const struct usb_device_id *usb_id) { - const snd_usb_audio_quirk_t *quirk = (const snd_usb_audio_quirk_t *)usb_id->driver_info; + const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info; int i, err; - snd_usb_audio_t *chip; + struct snd_usb_audio *chip; struct usb_host_interface *alts; int ifnum; u32 id; @@ -3337,8 +3335,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev, */ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) { - snd_usb_audio_t *chip; - snd_card_t *card; + struct snd_usb_audio *chip; + struct snd_card *card; struct list_head *p; if (ptr == (void *)-1L) diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index b580202..ecd724b 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -126,12 +126,10 @@ /* */ -typedef struct snd_usb_audio snd_usb_audio_t; - struct snd_usb_audio { int index; struct usb_device *dev; - snd_card_t *card; + struct snd_card *card; u32 usb_id; int shutdown; int num_interfaces; @@ -172,9 +170,6 @@ enum quirk_type { QUIRK_TYPE_COUNT }; -typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t; -typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t; - struct snd_usb_audio_quirk { const char *vendor_name; const char *product_name; @@ -228,12 +223,15 @@ unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size); void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype); void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype); -int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout); +int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, + __u8 request, __u8 requesttype, __u16 value, __u16 index, + void *data, __u16 size, int timeout); -int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif); +int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif); void snd_usb_mixer_disconnect(struct list_head *p); -int snd_usb_create_midi_interface(snd_usb_audio_t *chip, struct usb_interface *iface, const snd_usb_audio_quirk_t *quirk); +int snd_usb_create_midi_interface(struct snd_usb_audio *chip, struct usb_interface *iface, + const struct snd_usb_audio_quirk *quirk); void snd_usbmidi_input_stop(struct list_head* p); void snd_usbmidi_input_start(struct list_head* p); void snd_usbmidi_disconnect(struct list_head *p); diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index f8aa662..f15b021 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -84,39 +84,36 @@ struct usb_ms_endpoint_descriptor { __u8 baAssocJackID[0]; } __attribute__ ((packed)); -typedef struct snd_usb_midi snd_usb_midi_t; -typedef struct snd_usb_midi_endpoint snd_usb_midi_endpoint_t; -typedef struct snd_usb_midi_out_endpoint snd_usb_midi_out_endpoint_t; -typedef struct snd_usb_midi_in_endpoint snd_usb_midi_in_endpoint_t; -typedef struct usbmidi_out_port usbmidi_out_port_t; -typedef struct usbmidi_in_port usbmidi_in_port_t; +struct snd_usb_midi_in_endpoint; +struct snd_usb_midi_out_endpoint; +struct snd_usb_midi_endpoint; struct usb_protocol_ops { - void (*input)(snd_usb_midi_in_endpoint_t*, uint8_t*, int); - void (*output)(snd_usb_midi_out_endpoint_t*); + void (*input)(struct snd_usb_midi_in_endpoint*, uint8_t*, int); + void (*output)(struct snd_usb_midi_out_endpoint*); void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t); - void (*init_out_endpoint)(snd_usb_midi_out_endpoint_t*); - void (*finish_out_endpoint)(snd_usb_midi_out_endpoint_t*); + void (*init_out_endpoint)(struct snd_usb_midi_out_endpoint*); + void (*finish_out_endpoint)(struct snd_usb_midi_out_endpoint*); }; struct snd_usb_midi { - snd_usb_audio_t *chip; + struct snd_usb_audio *chip; struct usb_interface *iface; - const snd_usb_audio_quirk_t *quirk; - snd_rawmidi_t* rmidi; + const struct snd_usb_audio_quirk *quirk; + struct snd_rawmidi *rmidi; struct usb_protocol_ops* usb_protocol_ops; struct list_head list; struct timer_list error_timer; struct snd_usb_midi_endpoint { - snd_usb_midi_out_endpoint_t *out; - snd_usb_midi_in_endpoint_t *in; + struct snd_usb_midi_out_endpoint *out; + struct snd_usb_midi_in_endpoint *in; } endpoints[MIDI_MAX_ENDPOINTS]; unsigned long input_triggered; }; struct snd_usb_midi_out_endpoint { - snd_usb_midi_t* umidi; + struct snd_usb_midi* umidi; struct urb* urb; int urb_active; int max_transfer; /* size of urb buffer */ @@ -125,8 +122,8 @@ struct snd_usb_midi_out_endpoint { spinlock_t buffer_lock; struct usbmidi_out_port { - snd_usb_midi_out_endpoint_t* ep; - snd_rawmidi_substream_t* substream; + struct snd_usb_midi_out_endpoint* ep; + struct snd_rawmidi_substream *substream; int active; uint8_t cable; /* cable number << 4 */ uint8_t state; @@ -143,17 +140,17 @@ struct snd_usb_midi_out_endpoint { }; struct snd_usb_midi_in_endpoint { - snd_usb_midi_t* umidi; + struct snd_usb_midi* umidi; struct urb* urb; struct usbmidi_in_port { - snd_rawmidi_substream_t* substream; + struct snd_rawmidi_substream *substream; } ports[0x10]; u8 seen_f5; u8 error_resubmit; int current_port; }; -static void snd_usbmidi_do_output(snd_usb_midi_out_endpoint_t* ep); +static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep); static const uint8_t snd_usbmidi_cin_length[] = { 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1 @@ -196,10 +193,10 @@ static int snd_usbmidi_urb_error(int status) /* * Receives a chunk of MIDI data. */ -static void snd_usbmidi_input_data(snd_usb_midi_in_endpoint_t* ep, int portidx, +static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int portidx, uint8_t* data, int length) { - usbmidi_in_port_t* port = &ep->ports[portidx]; + struct usbmidi_in_port* port = &ep->ports[portidx]; if (!port->substream) { snd_printd("unexpected port %d!\n", portidx); @@ -227,7 +224,7 @@ static void dump_urb(const char *type, const u8 *data, int length) */ static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs) { - snd_usb_midi_in_endpoint_t* ep = urb->context; + struct snd_usb_midi_in_endpoint* ep = urb->context; if (urb->status == 0) { dump_urb("received", urb->transfer_buffer, urb->actual_length); @@ -251,7 +248,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs) static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs) { - snd_usb_midi_out_endpoint_t* ep = urb->context; + struct snd_usb_midi_out_endpoint* ep = urb->context; spin_lock(&ep->buffer_lock); ep->urb_active = 0; @@ -272,7 +269,7 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs) * This is called when some data should be transferred to the device * (from one or more substreams). */ -static void snd_usbmidi_do_output(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) { struct urb* urb = ep->urb; unsigned long flags; @@ -297,7 +294,7 @@ static void snd_usbmidi_do_output(snd_usb_midi_out_endpoint_t* ep) static void snd_usbmidi_out_tasklet(unsigned long data) { - snd_usb_midi_out_endpoint_t* ep = (snd_usb_midi_out_endpoint_t *) data; + struct snd_usb_midi_out_endpoint* ep = (struct snd_usb_midi_out_endpoint *) data; snd_usbmidi_do_output(ep); } @@ -305,11 +302,11 @@ static void snd_usbmidi_out_tasklet(unsigned long data) /* called after transfers had been interrupted due to some USB error */ static void snd_usbmidi_error_timer(unsigned long data) { - snd_usb_midi_t *umidi = (snd_usb_midi_t *)data; + struct snd_usb_midi *umidi = (struct snd_usb_midi *)data; int i; for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { - snd_usb_midi_in_endpoint_t *in = umidi->endpoints[i].in; + struct snd_usb_midi_in_endpoint *in = umidi->endpoints[i].in; if (in && in->error_resubmit) { in->error_resubmit = 0; in->urb->dev = umidi->chip->dev; @@ -321,7 +318,7 @@ static void snd_usbmidi_error_timer(unsigned long data) } /* helper function to send static data that may not DMA-able */ -static int send_bulk_static_data(snd_usb_midi_out_endpoint_t* ep, +static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep, const void *data, int len) { int err; @@ -342,7 +339,7 @@ static int send_bulk_static_data(snd_usb_midi_out_endpoint_t* ep, * fourth byte in each packet, and uses length instead of CIN. */ -static void snd_usbmidi_standard_input(snd_usb_midi_in_endpoint_t* ep, +static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint* ep, uint8_t* buffer, int buffer_length) { int i; @@ -355,7 +352,7 @@ static void snd_usbmidi_standard_input(snd_usb_midi_in_endpoint_t* ep, } } -static void snd_usbmidi_midiman_input(snd_usb_midi_in_endpoint_t* ep, +static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint* ep, uint8_t* buffer, int buffer_length) { int i; @@ -401,7 +398,7 @@ static void snd_usbmidi_output_midiman_packet(struct urb* urb, uint8_t p0, /* * Converts MIDI commands to USB MIDI packets. */ -static void snd_usbmidi_transmit_byte(usbmidi_out_port_t* port, +static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port, uint8_t b, struct urb* urb) { uint8_t p0 = port->cable; @@ -495,14 +492,14 @@ static void snd_usbmidi_transmit_byte(usbmidi_out_port_t* port, } } -static void snd_usbmidi_standard_output(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_standard_output(struct snd_usb_midi_out_endpoint* ep) { struct urb* urb = ep->urb; int p; /* FIXME: lower-numbered ports can starve higher-numbered ports */ for (p = 0; p < 0x10; ++p) { - usbmidi_out_port_t* port = &ep->ports[p]; + struct usbmidi_out_port* port = &ep->ports[p]; if (!port->active) continue; while (urb->transfer_buffer_length + 3 < ep->max_transfer) { @@ -534,7 +531,7 @@ static struct usb_protocol_ops snd_usbmidi_midiman_ops = { * at the third byte. */ -static void snd_usbmidi_novation_input(snd_usb_midi_in_endpoint_t* ep, +static void snd_usbmidi_novation_input(struct snd_usb_midi_in_endpoint* ep, uint8_t* buffer, int buffer_length) { if (buffer_length < 2 || !buffer[0] || buffer_length < buffer[0] + 1) @@ -542,7 +539,7 @@ static void snd_usbmidi_novation_input(snd_usb_midi_in_endpoint_t* ep, snd_usbmidi_input_data(ep, 0, &buffer[2], buffer[0] - 1); } -static void snd_usbmidi_novation_output(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_novation_output(struct snd_usb_midi_out_endpoint* ep) { uint8_t* transfer_buffer; int count; @@ -571,13 +568,13 @@ static struct usb_protocol_ops snd_usbmidi_novation_ops = { * "raw" protocol: used by the MOTU FastLane. */ -static void snd_usbmidi_raw_input(snd_usb_midi_in_endpoint_t* ep, +static void snd_usbmidi_raw_input(struct snd_usb_midi_in_endpoint* ep, uint8_t* buffer, int buffer_length) { snd_usbmidi_input_data(ep, 0, buffer, buffer_length); } -static void snd_usbmidi_raw_output(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_raw_output(struct snd_usb_midi_out_endpoint* ep) { int count; @@ -602,7 +599,7 @@ static struct usb_protocol_ops snd_usbmidi_raw_ops = { * Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching. */ -static void snd_usbmidi_emagic_init_out(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint* ep) { static const u8 init_data[] = { /* initialization magic: "get version" */ @@ -619,7 +616,7 @@ static void snd_usbmidi_emagic_init_out(snd_usb_midi_out_endpoint_t* ep) send_bulk_static_data(ep, init_data, sizeof(init_data)); } -static void snd_usbmidi_emagic_finish_out(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint* ep) { static const u8 finish_data[] = { /* switch to patch mode with last preset */ @@ -635,7 +632,7 @@ static void snd_usbmidi_emagic_finish_out(snd_usb_midi_out_endpoint_t* ep) send_bulk_static_data(ep, finish_data, sizeof(finish_data)); } -static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, +static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint* ep, uint8_t* buffer, int buffer_length) { int i; @@ -679,7 +676,7 @@ static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, } } -static void snd_usbmidi_emagic_output(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint* ep) { int port0 = ep->current_port; uint8_t* buf = ep->urb->transfer_buffer; @@ -689,7 +686,7 @@ static void snd_usbmidi_emagic_output(snd_usb_midi_out_endpoint_t* ep) for (i = 0; i < 0x10; ++i) { /* round-robin, starting at the last current port */ int portnum = (port0 + i) & 15; - usbmidi_out_port_t* port = &ep->ports[portnum]; + struct usbmidi_out_port* port = &ep->ports[portnum]; if (!port->active) continue; @@ -733,10 +730,10 @@ static struct usb_protocol_ops snd_usbmidi_emagic_ops = { }; -static int snd_usbmidi_output_open(snd_rawmidi_substream_t* substream) +static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) { - snd_usb_midi_t* umidi = substream->rmidi->private_data; - usbmidi_out_port_t* port = NULL; + struct snd_usb_midi* umidi = substream->rmidi->private_data; + struct usbmidi_out_port* port = NULL; int i, j; for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) @@ -755,14 +752,14 @@ static int snd_usbmidi_output_open(snd_rawmidi_substream_t* substream) return 0; } -static int snd_usbmidi_output_close(snd_rawmidi_substream_t* substream) +static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) { return 0; } -static void snd_usbmidi_output_trigger(snd_rawmidi_substream_t* substream, int up) +static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up) { - usbmidi_out_port_t* port = (usbmidi_out_port_t*)substream->runtime->private_data; + struct usbmidi_out_port* port = (struct usbmidi_out_port*)substream->runtime->private_data; port->active = up; if (up) { @@ -777,19 +774,19 @@ static void snd_usbmidi_output_trigger(snd_rawmidi_substream_t* substream, int u } } -static int snd_usbmidi_input_open(snd_rawmidi_substream_t* substream) +static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream) { return 0; } -static int snd_usbmidi_input_close(snd_rawmidi_substream_t* substream) +static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream) { return 0; } -static void snd_usbmidi_input_trigger(snd_rawmidi_substream_t* substream, int up) +static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) { - snd_usb_midi_t* umidi = substream->rmidi->private_data; + struct snd_usb_midi* umidi = substream->rmidi->private_data; if (up) set_bit(substream->number, &umidi->input_triggered); @@ -797,13 +794,13 @@ static void snd_usbmidi_input_trigger(snd_rawmidi_substream_t* substream, int up clear_bit(substream->number, &umidi->input_triggered); } -static snd_rawmidi_ops_t snd_usbmidi_output_ops = { +static struct snd_rawmidi_ops snd_usbmidi_output_ops = { .open = snd_usbmidi_output_open, .close = snd_usbmidi_output_close, .trigger = snd_usbmidi_output_trigger, }; -static snd_rawmidi_ops_t snd_usbmidi_input_ops = { +static struct snd_rawmidi_ops snd_usbmidi_input_ops = { .open = snd_usbmidi_input_open, .close = snd_usbmidi_input_close, .trigger = snd_usbmidi_input_trigger @@ -813,7 +810,7 @@ static snd_rawmidi_ops_t snd_usbmidi_input_ops = { * Frees an input endpoint. * May be called when ep hasn't been initialized completely. */ -static void snd_usbmidi_in_endpoint_delete(snd_usb_midi_in_endpoint_t* ep) +static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint* ep) { if (ep->urb) { usb_buffer_free(ep->umidi->chip->dev, @@ -828,11 +825,11 @@ static void snd_usbmidi_in_endpoint_delete(snd_usb_midi_in_endpoint_t* ep) /* * Creates an input endpoint. */ -static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* ep_info, - snd_usb_midi_endpoint_t* rep) +static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* ep_info, + struct snd_usb_midi_endpoint* rep) { - snd_usb_midi_in_endpoint_t* ep; + struct snd_usb_midi_in_endpoint* ep; void* buffer; unsigned int pipe; int length; @@ -885,7 +882,7 @@ static unsigned int snd_usbmidi_count_bits(unsigned int x) * Frees an output endpoint. * May be called when ep hasn't been initialized completely. */ -static void snd_usbmidi_out_endpoint_delete(snd_usb_midi_out_endpoint_t* ep) +static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint* ep) { if (ep->urb) { usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, @@ -899,11 +896,11 @@ static void snd_usbmidi_out_endpoint_delete(snd_usb_midi_out_endpoint_t* ep) /* * Creates an output endpoint, and initializes output ports. */ -static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* ep_info, - snd_usb_midi_endpoint_t* rep) +static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* ep_info, + struct snd_usb_midi_endpoint* rep) { - snd_usb_midi_out_endpoint_t* ep; + struct snd_usb_midi_out_endpoint* ep; int i; unsigned int pipe; void* buffer; @@ -951,12 +948,12 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, /* * Frees everything. */ -static void snd_usbmidi_free(snd_usb_midi_t* umidi) +static void snd_usbmidi_free(struct snd_usb_midi* umidi) { int i; for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { - snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; + struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; if (ep->out) snd_usbmidi_out_endpoint_delete(ep->out); if (ep->in) @@ -970,13 +967,13 @@ static void snd_usbmidi_free(snd_usb_midi_t* umidi) */ void snd_usbmidi_disconnect(struct list_head* p) { - snd_usb_midi_t* umidi; + struct snd_usb_midi* umidi; int i; - umidi = list_entry(p, snd_usb_midi_t, list); + umidi = list_entry(p, struct snd_usb_midi, list); del_timer_sync(&umidi->error_timer); for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { - snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; + struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; if (ep->out) tasklet_kill(&ep->out->tasklet); if (ep->out && ep->out->urb) { @@ -989,19 +986,19 @@ void snd_usbmidi_disconnect(struct list_head* p) } } -static void snd_usbmidi_rawmidi_free(snd_rawmidi_t* rmidi) +static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) { - snd_usb_midi_t* umidi = rmidi->private_data; + struct snd_usb_midi* umidi = rmidi->private_data; snd_usbmidi_free(umidi); } -static snd_rawmidi_substream_t* snd_usbmidi_find_substream(snd_usb_midi_t* umidi, +static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi, int stream, int number) { struct list_head* list; list_for_each(list, &umidi->rmidi->streams[stream].substreams) { - snd_rawmidi_substream_t* substream = list_entry(list, snd_rawmidi_substream_t, list); + struct snd_rawmidi_substream *substream = list_entry(list, struct snd_rawmidi_substream, list); if (substream->number == number) return substream; } @@ -1097,14 +1094,14 @@ static struct { { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" }, }; -static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, +static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, int stream, int number, - snd_rawmidi_substream_t** rsubstream) + struct snd_rawmidi_substream ** rsubstream) { int i; const char *name_format; - snd_rawmidi_substream_t* substream = snd_usbmidi_find_substream(umidi, stream, number); + struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); if (!substream) { snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number); return; @@ -1128,8 +1125,8 @@ static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, /* * Creates the endpoints and their ports. */ -static int snd_usbmidi_create_endpoints(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* endpoints) +static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* endpoints) { int i, j, err; int out_ports = 0, in_ports = 0; @@ -1169,8 +1166,8 @@ static int snd_usbmidi_create_endpoints(snd_usb_midi_t* umidi, /* * Returns MIDIStreaming device capabilities. */ -static int snd_usbmidi_get_ms_info(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* endpoints) +static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* endpoints) { struct usb_interface* intf; struct usb_host_interface *hostif; @@ -1244,7 +1241,7 @@ static int snd_usbmidi_get_ms_info(snd_usb_midi_t* umidi, * On Roland devices, use the second alternate setting to be able to use * the interrupt input endpoint. */ -static void snd_usbmidi_switch_roland_altsetting(snd_usb_midi_t* umidi) +static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) { struct usb_interface* intf; struct usb_host_interface *hostif; @@ -1270,8 +1267,8 @@ static void snd_usbmidi_switch_roland_altsetting(snd_usb_midi_t* umidi) /* * Try to find any usable endpoints in the interface. */ -static int snd_usbmidi_detect_endpoints(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* endpoint, +static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* endpoint, int max_endpoints) { struct usb_interface* intf; @@ -1318,8 +1315,8 @@ static int snd_usbmidi_detect_endpoints(snd_usb_midi_t* umidi, /* * Detects the endpoints for one-port-per-endpoint protocols. */ -static int snd_usbmidi_detect_per_port_endpoints(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* endpoints) +static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* endpoints) { int err, i; @@ -1336,8 +1333,8 @@ static int snd_usbmidi_detect_per_port_endpoints(snd_usb_midi_t* umidi, /* * Detects the endpoints and ports of Yamaha devices. */ -static int snd_usbmidi_detect_yamaha(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* endpoint) +static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* endpoint) { struct usb_interface* intf; struct usb_host_interface *hostif; @@ -1375,10 +1372,10 @@ static int snd_usbmidi_detect_yamaha(snd_usb_midi_t* umidi, /* * Creates the endpoints and their ports for Midiman devices. */ -static int snd_usbmidi_create_endpoints_midiman(snd_usb_midi_t* umidi, - snd_usb_midi_endpoint_info_t* endpoint) +static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, + struct snd_usb_midi_endpoint_info* endpoint) { - snd_usb_midi_endpoint_info_t ep_info; + struct snd_usb_midi_endpoint_info ep_info; struct usb_interface* intf; struct usb_host_interface *hostif; struct usb_interface_descriptor* intfd; @@ -1458,10 +1455,10 @@ static int snd_usbmidi_create_endpoints_midiman(snd_usb_midi_t* umidi, return 0; } -static int snd_usbmidi_create_rawmidi(snd_usb_midi_t* umidi, +static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, int out_ports, int in_ports) { - snd_rawmidi_t* rmidi; + struct snd_rawmidi *rmidi; int err; err = snd_rawmidi_new(umidi->chip->card, "USB MIDI", @@ -1487,18 +1484,18 @@ static int snd_usbmidi_create_rawmidi(snd_usb_midi_t* umidi, */ void snd_usbmidi_input_stop(struct list_head* p) { - snd_usb_midi_t* umidi; + struct snd_usb_midi* umidi; int i; - umidi = list_entry(p, snd_usb_midi_t, list); + umidi = list_entry(p, struct snd_usb_midi, list); for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { - snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; + struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; if (ep->in) usb_kill_urb(ep->in->urb); } } -static void snd_usbmidi_input_start_ep(snd_usb_midi_in_endpoint_t* ep) +static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) { if (ep) { struct urb* urb = ep->urb; @@ -1512,10 +1509,10 @@ static void snd_usbmidi_input_start_ep(snd_usb_midi_in_endpoint_t* ep) */ void snd_usbmidi_input_start(struct list_head* p) { - snd_usb_midi_t* umidi; + struct snd_usb_midi* umidi; int i; - umidi = list_entry(p, snd_usb_midi_t, list); + umidi = list_entry(p, struct snd_usb_midi, list); for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) snd_usbmidi_input_start_ep(umidi->endpoints[i].in); } @@ -1523,12 +1520,12 @@ void snd_usbmidi_input_start(struct list_head* p) /* * Creates and registers everything needed for a MIDI streaming interface. */ -int snd_usb_create_midi_interface(snd_usb_audio_t* chip, +int snd_usb_create_midi_interface(struct snd_usb_audio* chip, struct usb_interface* iface, - const snd_usb_audio_quirk_t* quirk) + const struct snd_usb_audio_quirk* quirk) { - snd_usb_midi_t* umidi; - snd_usb_midi_endpoint_info_t endpoints[MIDI_MAX_ENDPOINTS]; + struct snd_usb_midi* umidi; + struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; int out_ports, in_ports; int i, err; @@ -1551,7 +1548,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, break; case QUIRK_MIDI_FIXED_ENDPOINT: memcpy(&endpoints[0], quirk->data, - sizeof(snd_usb_midi_endpoint_info_t)); + sizeof(struct snd_usb_midi_endpoint_info)); err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); break; case QUIRK_MIDI_YAMAHA: @@ -1560,7 +1557,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, case QUIRK_MIDI_MIDIMAN: umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; memcpy(&endpoints[0], quirk->data, - sizeof(snd_usb_midi_endpoint_info_t)); + sizeof(struct snd_usb_midi_endpoint_info)); err = 0; break; case QUIRK_MIDI_NOVATION: @@ -1574,7 +1571,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, case QUIRK_MIDI_EMAGIC: umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops; memcpy(&endpoints[0], quirk->data, - sizeof(snd_usb_midi_endpoint_info_t)); + sizeof(struct snd_usb_midi_endpoint_info)); err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); break; case QUIRK_MIDI_MIDITECH: diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index e570d14..678dac2 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -46,18 +46,13 @@ /* ignore error from controls - for debugging */ /* #define IGNORE_CTL_ERROR */ -typedef struct usb_mixer_build mixer_build_t; -typedef struct usb_audio_term usb_audio_term_t; -typedef struct usb_mixer_elem_info usb_mixer_elem_info_t; - - struct usb_mixer_interface { - snd_usb_audio_t *chip; + struct snd_usb_audio *chip; unsigned int ctrlif; struct list_head list; unsigned int ignore_ctl_error; struct urb *urb; - usb_mixer_elem_info_t **id_elems; /* array[256], indexed by unit id */ + struct usb_mixer_elem_info **id_elems; /* array[256], indexed by unit id */ /* Sound Blaster remote control stuff */ enum { @@ -86,21 +81,21 @@ struct usb_audio_term { struct usbmix_name_map; -struct usb_mixer_build { - snd_usb_audio_t *chip; +struct mixer_build { + struct snd_usb_audio *chip; struct usb_mixer_interface *mixer; unsigned char *buffer; unsigned int buflen; DECLARE_BITMAP(unitbitmap, 256); - usb_audio_term_t oterm; + struct usb_audio_term oterm; const struct usbmix_name_map *map; const struct usbmix_selector_map *selector_map; }; struct usb_mixer_elem_info { struct usb_mixer_interface *mixer; - usb_mixer_elem_info_t *next_id_elem; /* list of controls with same id */ - snd_ctl_elem_id_t *elem_id; + struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */ + struct snd_ctl_elem_id *elem_id; unsigned int id; unsigned int control; /* CS or ICN (high byte) */ unsigned int cmask; /* channel mask bitmap: 0 = master */ @@ -179,7 +174,7 @@ enum { #include "usbmixer_maps.c" /* get the mapped name if the unit matches */ -static int check_mapped_name(mixer_build_t *state, int unitid, int control, char *buf, int buflen) +static int check_mapped_name(struct mixer_build *state, int unitid, int control, char *buf, int buflen) { const struct usbmix_name_map *p; @@ -197,7 +192,7 @@ static int check_mapped_name(mixer_build_t *state, int unitid, int control, char } /* check whether the control should be ignored */ -static int check_ignored_ctl(mixer_build_t *state, int unitid, int control) +static int check_ignored_ctl(struct mixer_build *state, int unitid, int control) { const struct usbmix_name_map *p; @@ -214,7 +209,7 @@ static int check_ignored_ctl(mixer_build_t *state, int unitid, int control) } /* get the mapped selector source name */ -static int check_mapped_selector_name(mixer_build_t *state, int unitid, +static int check_mapped_selector_name(struct mixer_build *state, int unitid, int index, char *buf, int buflen) { const struct usbmix_selector_map *p; @@ -231,7 +226,7 @@ static int check_mapped_selector_name(mixer_build_t *state, int unitid, /* * find an audio control unit with the given unit id */ -static void *find_audio_control_unit(mixer_build_t *state, unsigned char unit) +static void *find_audio_control_unit(struct mixer_build *state, unsigned char unit) { unsigned char *p; @@ -248,7 +243,7 @@ static void *find_audio_control_unit(mixer_build_t *state, unsigned char unit) /* * copy a string with the given id */ -static int snd_usb_copy_string_desc(mixer_build_t *state, int index, char *buf, int maxlen) +static int snd_usb_copy_string_desc(struct mixer_build *state, int index, char *buf, int maxlen) { int len = usb_string(state->chip->dev, index, buf, maxlen - 1); buf[len] = 0; @@ -258,7 +253,7 @@ static int snd_usb_copy_string_desc(mixer_build_t *state, int index, char *buf, /* * convert from the byte/word on usb descriptor to the zero-based integer */ -static int convert_signed_value(usb_mixer_elem_info_t *cval, int val) +static int convert_signed_value(struct usb_mixer_elem_info *cval, int val) { switch (cval->val_type) { case USB_MIXER_BOOLEAN: @@ -288,7 +283,7 @@ static int convert_signed_value(usb_mixer_elem_info_t *cval, int val) /* * convert from the zero-based int to the byte/word for usb descriptor */ -static int convert_bytes_value(usb_mixer_elem_info_t *cval, int val) +static int convert_bytes_value(struct usb_mixer_elem_info *cval, int val) { switch (cval->val_type) { case USB_MIXER_BOOLEAN: @@ -305,7 +300,7 @@ static int convert_bytes_value(usb_mixer_elem_info_t *cval, int val) return 0; /* not reached */ } -static int get_relative_value(usb_mixer_elem_info_t *cval, int val) +static int get_relative_value(struct usb_mixer_elem_info *cval, int val) { if (! cval->res) cval->res = 1; @@ -317,7 +312,7 @@ static int get_relative_value(usb_mixer_elem_info_t *cval, int val) return (val - cval->min) / cval->res; } -static int get_abs_value(usb_mixer_elem_info_t *cval, int val) +static int get_abs_value(struct usb_mixer_elem_info *cval, int val) { if (val < 0) return cval->min; @@ -335,7 +330,7 @@ static int get_abs_value(usb_mixer_elem_info_t *cval, int val) * retrieve a mixer value */ -static int get_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, int *value_ret) +static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) { unsigned char buf[2]; int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; @@ -357,13 +352,13 @@ static int get_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, i return -EINVAL; } -static int get_cur_ctl_value(usb_mixer_elem_info_t *cval, int validx, int *value) +static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int *value) { return get_ctl_value(cval, GET_CUR, validx, value); } /* channel = 0: master, 1 = first channel */ -static inline int get_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int *value) +static inline int get_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int *value) { return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); } @@ -372,7 +367,7 @@ static inline int get_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, in * set a mixer value */ -static int set_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, int value_set) +static int set_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int value_set) { unsigned char buf[2]; int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; @@ -394,12 +389,12 @@ static int set_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, i return -EINVAL; } -static int set_cur_ctl_value(usb_mixer_elem_info_t *cval, int validx, int value) +static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) { return set_ctl_value(cval, SET_CUR, validx, value); } -static inline int set_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int value) +static inline int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int value) { return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value); } @@ -409,7 +404,7 @@ static inline int set_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, in * parser routines begin here... */ -static int parse_audio_unit(mixer_build_t *state, int unitid); +static int parse_audio_unit(struct mixer_build *state, int unitid); /* @@ -430,9 +425,9 @@ static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_ou * if failed, give up and free the control instance. */ -static int add_control_to_empty(mixer_build_t *state, snd_kcontrol_t *kctl) +static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl) { - usb_mixer_elem_info_t *cval = kctl->private_data; + struct usb_mixer_elem_info *cval = kctl->private_data; int err; while (snd_ctl_find_id(state->chip->card, &kctl->id)) @@ -496,7 +491,7 @@ static struct iterm_name_combo { { 0 }, }; -static int get_term_name(mixer_build_t *state, usb_audio_term_t *iterm, +static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm, unsigned char *name, int maxlen, int term_only) { struct iterm_name_combo *names; @@ -546,7 +541,7 @@ static int get_term_name(mixer_build_t *state, usb_audio_term_t *iterm, * parse the source unit recursively until it reaches to a terminal * or a branched unit. */ -static int check_input_term(mixer_build_t *state, int id, usb_audio_term_t *term) +static int check_input_term(struct mixer_build *state, int id, struct usb_audio_term *term) { unsigned char *p1; @@ -621,7 +616,7 @@ static struct usb_feature_control_info audio_feature_info[] = { /* private_free callback */ -static void usb_mixer_elem_free(snd_kcontrol_t *kctl) +static void usb_mixer_elem_free(struct snd_kcontrol *kctl) { kfree(kctl->private_data); kctl->private_data = NULL; @@ -635,7 +630,7 @@ static void usb_mixer_elem_free(snd_kcontrol_t *kctl) /* * retrieve the minimum and maximum values for the specified control */ -static int get_min_max(usb_mixer_elem_info_t *cval, int default_min) +static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) { /* for failsafe */ cval->min = default_min; @@ -683,9 +678,9 @@ static int get_min_max(usb_mixer_elem_info_t *cval, int default_min) /* get a feature/mixer unit info */ -static int mixer_ctl_feature_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; if (cval->val_type == USB_MIXER_BOOLEAN || cval->val_type == USB_MIXER_INV_BOOLEAN) @@ -707,9 +702,9 @@ static int mixer_ctl_feature_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t } /* get the current value from feature/mixer unit */ -static int mixer_ctl_feature_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; int c, cnt, val, err; if (cval->cmask) { @@ -748,9 +743,9 @@ static int mixer_ctl_feature_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t } /* put the current value to feature/mixer unit */ -static int mixer_ctl_feature_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; int c, cnt, val, oval, err; int changed = 0; @@ -791,7 +786,7 @@ static int mixer_ctl_feature_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t return changed; } -static snd_kcontrol_new_t usb_feature_unit_ctl = { +static struct snd_kcontrol_new usb_feature_unit_ctl = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "", /* will be filled later manually */ .info = mixer_ctl_feature_info, @@ -804,15 +799,15 @@ static snd_kcontrol_new_t usb_feature_unit_ctl = { * build a feature control */ -static void build_feature_ctl(mixer_build_t *state, unsigned char *desc, +static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, unsigned int ctl_mask, int control, - usb_audio_term_t *iterm, int unitid) + struct usb_audio_term *iterm, int unitid) { unsigned int len = 0; int mapped_name = 0; int nameid = desc[desc[0] - 1]; - snd_kcontrol_t *kctl; - usb_mixer_elem_info_t *cval; + struct snd_kcontrol *kctl; + struct usb_mixer_elem_info *cval; control++; /* change from zero-based to 1-based value */ @@ -928,10 +923,10 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc, * * most of controlls are defined here. */ -static int parse_audio_feature_unit(mixer_build_t *state, int unitid, unsigned char *ftr) +static int parse_audio_feature_unit(struct mixer_build *state, int unitid, unsigned char *ftr) { int channels, i, j; - usb_audio_term_t iterm; + struct usb_audio_term iterm; unsigned int master_bits, first_ch_bits; int err, csize; @@ -984,15 +979,15 @@ static int parse_audio_feature_unit(mixer_build_t *state, int unitid, unsigned c * input channel number (zero based) is given in control field instead. */ -static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc, +static void build_mixer_unit_ctl(struct mixer_build *state, unsigned char *desc, int in_pin, int in_ch, int unitid, - usb_audio_term_t *iterm) + struct usb_audio_term *iterm) { - usb_mixer_elem_info_t *cval; + struct usb_mixer_elem_info *cval; unsigned int input_pins = desc[4]; unsigned int num_outs = desc[5 + input_pins]; unsigned int i, len; - snd_kcontrol_t *kctl; + struct snd_kcontrol *kctl; if (check_ignored_ctl(state, unitid, 0)) return; @@ -1039,9 +1034,9 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc, /* * parse a mixer unit */ -static int parse_audio_mixer_unit(mixer_build_t *state, int unitid, unsigned char *desc) +static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, unsigned char *desc) { - usb_audio_term_t iterm; + struct usb_audio_term iterm; int input_pins, num_ins, num_outs; int pin, ich, err; @@ -1089,9 +1084,9 @@ static int parse_audio_mixer_unit(mixer_build_t *state, int unitid, unsigned cha */ /* get callback for processing/extension unit */ -static int mixer_ctl_procunit_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int mixer_ctl_procunit_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; int err, val; err = get_cur_ctl_value(cval, cval->control << 8, &val); @@ -1107,9 +1102,9 @@ static int mixer_ctl_procunit_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t } /* put callback for processing/extension unit */ -static int mixer_ctl_procunit_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int mixer_ctl_procunit_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; int val, oval, err; err = get_cur_ctl_value(cval, cval->control << 8, &oval); @@ -1128,7 +1123,7 @@ static int mixer_ctl_procunit_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t } /* alsa control interface for processing/extension unit */ -static snd_kcontrol_new_t mixer_procunit_ctl = { +static struct snd_kcontrol_new mixer_procunit_ctl = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "", /* will be filled later */ .info = mixer_ctl_feature_info, @@ -1205,11 +1200,11 @@ static struct procunit_info procunits[] = { /* * build a processing/extension unit */ -static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char *dsc, struct procunit_info *list, char *name) +static int build_audio_procunit(struct mixer_build *state, int unitid, unsigned char *dsc, struct procunit_info *list, char *name) { int num_ins = dsc[6]; - usb_mixer_elem_info_t *cval; - snd_kcontrol_t *kctl; + struct usb_mixer_elem_info *cval; + struct snd_kcontrol *kctl; int i, err, nameid, type, len; struct procunit_info *info; struct procunit_value_info *valinfo; @@ -1297,12 +1292,12 @@ static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char } -static int parse_audio_processing_unit(mixer_build_t *state, int unitid, unsigned char *desc) +static int parse_audio_processing_unit(struct mixer_build *state, int unitid, unsigned char *desc) { return build_audio_procunit(state, unitid, desc, procunits, "Processing Unit"); } -static int parse_audio_extension_unit(mixer_build_t *state, int unitid, unsigned char *desc) +static int parse_audio_extension_unit(struct mixer_build *state, int unitid, unsigned char *desc) { return build_audio_procunit(state, unitid, desc, NULL, "Extension Unit"); } @@ -1315,9 +1310,9 @@ static int parse_audio_extension_unit(mixer_build_t *state, int unitid, unsigned /* info callback for selector unit * use an enumerator type for routing */ -static int mixer_ctl_selector_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int mixer_ctl_selector_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; char **itemlist = (char **)kcontrol->private_value; snd_assert(itemlist, return -EINVAL); @@ -1331,9 +1326,9 @@ static int mixer_ctl_selector_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t } /* get callback for selector unit */ -static int mixer_ctl_selector_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int mixer_ctl_selector_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; int val, err; err = get_cur_ctl_value(cval, 0, &val); @@ -1350,9 +1345,9 @@ static int mixer_ctl_selector_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t } /* put callback for selector unit */ -static int mixer_ctl_selector_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int mixer_ctl_selector_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - usb_mixer_elem_info_t *cval = kcontrol->private_data; + struct usb_mixer_elem_info *cval = kcontrol->private_data; int val, oval, err; err = get_cur_ctl_value(cval, 0, &oval); @@ -1371,7 +1366,7 @@ static int mixer_ctl_selector_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t } /* alsa control interface for selector unit */ -static snd_kcontrol_new_t mixer_selectunit_ctl = { +static struct snd_kcontrol_new mixer_selectunit_ctl = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "", /* will be filled later */ .info = mixer_ctl_selector_info, @@ -1383,12 +1378,12 @@ static snd_kcontrol_new_t mixer_selectunit_ctl = { /* private free callback. * free both private_data and private_value */ -static void usb_mixer_selector_elem_free(snd_kcontrol_t *kctl) +static void usb_mixer_selector_elem_free(struct snd_kcontrol *kctl) { int i, num_ins = 0; if (kctl->private_data) { - usb_mixer_elem_info_t *cval = kctl->private_data; + struct usb_mixer_elem_info *cval = kctl->private_data; num_ins = cval->max; kfree(cval); kctl->private_data = NULL; @@ -1405,13 +1400,13 @@ static void usb_mixer_selector_elem_free(snd_kcontrol_t *kctl) /* * parse a selector unit */ -static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned char *desc) +static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsigned char *desc) { unsigned int num_ins = desc[4]; unsigned int i, nameid, len; int err; - usb_mixer_elem_info_t *cval; - snd_kcontrol_t *kctl; + struct usb_mixer_elem_info *cval; + struct snd_kcontrol *kctl; char **namelist; if (! num_ins || desc[0] < 6 + num_ins) { @@ -1452,7 +1447,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned } #define MAX_ITEM_NAME_LEN 64 for (i = 0; i < num_ins; i++) { - usb_audio_term_t iterm; + struct usb_audio_term iterm; len = 0; namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL); if (! namelist[i]) { @@ -1511,7 +1506,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned * parse an audio unit recursively */ -static int parse_audio_unit(mixer_build_t *state, int unitid) +static int parse_audio_unit(struct mixer_build *state, int unitid) { unsigned char *p1; @@ -1556,7 +1551,7 @@ static void snd_usb_mixer_free(struct usb_mixer_interface *mixer) kfree(mixer); } -static int snd_usb_mixer_dev_free(snd_device_t *device) +static int snd_usb_mixer_dev_free(struct snd_device *device) { struct usb_mixer_interface *mixer = device->device_data; snd_usb_mixer_free(mixer); @@ -1571,7 +1566,7 @@ static int snd_usb_mixer_dev_free(snd_device_t *device) static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) { unsigned char *desc; - mixer_build_t state; + struct mixer_build state; int err; const struct usbmix_ctl_map *map; struct usb_host_interface *hostif; @@ -1611,7 +1606,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) static void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid) { - usb_mixer_elem_info_t *info; + struct usb_mixer_elem_info *info; for (info = mixer->id_elems[unitid]; info; info = info->next_id_elem) snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, @@ -1725,7 +1720,7 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb, wake_up(&mixer->rc_waitq); } -static int snd_usb_sbrc_hwdep_open(snd_hwdep_t *hw, struct file *file) +static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file) { struct usb_mixer_interface *mixer = hw->private_data; @@ -1734,7 +1729,7 @@ static int snd_usb_sbrc_hwdep_open(snd_hwdep_t *hw, struct file *file) return 0; } -static int snd_usb_sbrc_hwdep_release(snd_hwdep_t *hw, struct file *file) +static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file) { struct usb_mixer_interface *mixer = hw->private_data; @@ -1743,7 +1738,7 @@ static int snd_usb_sbrc_hwdep_release(snd_hwdep_t *hw, struct file *file) return 0; } -static long snd_usb_sbrc_hwdep_read(snd_hwdep_t *hw, char __user *buf, +static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset) { struct usb_mixer_interface *mixer = hw->private_data; @@ -1763,7 +1758,7 @@ static long snd_usb_sbrc_hwdep_read(snd_hwdep_t *hw, char __user *buf, return err < 0 ? err : count; } -static unsigned int snd_usb_sbrc_hwdep_poll(snd_hwdep_t *hw, struct file *file, +static unsigned int snd_usb_sbrc_hwdep_poll(struct snd_hwdep *hw, struct file *file, poll_table *wait) { struct usb_mixer_interface *mixer = hw->private_data; @@ -1774,7 +1769,7 @@ static unsigned int snd_usb_sbrc_hwdep_poll(snd_hwdep_t *hw, struct file *file, static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) { - snd_hwdep_t *hwdep; + struct snd_hwdep *hwdep; int err, len; switch (mixer->chip->usb_id) { @@ -1825,7 +1820,7 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) return 0; } -static int snd_audigy2nx_led_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_audigy2nx_led_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -1834,7 +1829,7 @@ static int snd_audigy2nx_led_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_audigy2nx_led_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_audigy2nx_led_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; @@ -1843,7 +1838,7 @@ static int snd_audigy2nx_led_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t return 0; } -static int snd_audigy2nx_led_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; @@ -1863,7 +1858,7 @@ static int snd_audigy2nx_led_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t return changed; } -static snd_kcontrol_new_t snd_audigy2nx_controls[] = { +static struct snd_kcontrol_new snd_audigy2nx_controls[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "CMSS LED Switch", @@ -1904,8 +1899,8 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer) return 0; } -static void snd_audigy2nx_proc_read(snd_info_entry_t *entry, - snd_info_buffer_t *buffer) +static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { static const struct { int unitid; @@ -1935,9 +1930,9 @@ static void snd_audigy2nx_proc_read(snd_info_entry_t *entry, } } -int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif) +int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif) { - static snd_device_ops_t dev_ops = { + static struct snd_device_ops dev_ops = { .dev_free = snd_usb_mixer_dev_free }; struct usb_mixer_interface *mixer; @@ -1967,7 +1962,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif) goto _error; if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if ((err = snd_audigy2nx_controls_create(mixer)) < 0) goto _error; diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index ba506c3..6190ada 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h @@ -45,7 +45,7 @@ #define YAMAHA_DEVICE(id, name) { \ USB_DEVICE(0x0499, id), \ - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { \ + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \ .vendor_name = "Yamaha", \ .product_name = name, \ .ifnum = QUIRK_ANY_INTERFACE, \ @@ -54,7 +54,7 @@ } #define YAMAHA_INTERFACE(id, intf, name) { \ USB_DEVICE_VENDOR_SPEC(0x0499, id), \ - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { \ + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \ .vendor_name = "Yamaha", \ .product_name = name, \ .ifnum = intf, \ @@ -149,12 +149,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), */ { USB_DEVICE(0x0582, 0x0000), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "UA-100", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_AUDIO_FIXED_ENDPOINT, @@ -192,7 +192,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0007, .in_cables = 0x0007 } @@ -205,12 +205,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0002), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UM-4", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -222,7 +222,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x000f, .in_cables = 0x000f } @@ -235,12 +235,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0003), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "SC-8850", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -252,7 +252,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x003f, .in_cables = 0x003f } @@ -265,12 +265,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0004), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "U-8", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -282,7 +282,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0005, .in_cables = 0x0005 } @@ -296,12 +296,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* a later revision uses ID 0x0099 */ USB_DEVICE(0x0582, 0x0005), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UM-2", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -313,7 +313,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0003 } @@ -326,12 +326,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0007), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "SC-8820", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -343,7 +343,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0013, .in_cables = 0x0013 } @@ -356,12 +356,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0008), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "PC-300", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -373,7 +373,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -387,12 +387,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* a later revision uses ID 0x009d */ USB_DEVICE(0x0582, 0x0009), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UM-1", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -404,7 +404,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -417,12 +417,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x000b), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "SK-500", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -434,7 +434,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0013, .in_cables = 0x0013 } @@ -449,12 +449,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), /* thanks to Emiliano Grilli <emillo@libero.it> * for helping researching this data */ USB_DEVICE(0x0582, 0x000c), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "SC-D70", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_AUDIO_FIXED_ENDPOINT, @@ -492,7 +492,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0007, .in_cables = 0x0007 } @@ -513,12 +513,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * the 96kHz sample rate. */ USB_DEVICE(0x0582, 0x0010), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UA-5", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 1, .type = QUIRK_AUDIO_STANDARD_INTERFACE @@ -536,12 +536,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0013 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0012), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "XV-5050", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -550,12 +550,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0015 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0014), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UM-880", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x01ff, .in_cables = 0x01ff } @@ -564,12 +564,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0017 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0016), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "SD-90", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -581,7 +581,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x000f, .in_cables = 0x000f } @@ -595,12 +595,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x001c when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x001b), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "MMP-2", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -612,7 +612,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 2, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -626,12 +626,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x001e when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x001d), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "V-SYNTH", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -640,12 +640,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0024 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0023), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UM-550", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x003f, .in_cables = 0x003f } @@ -658,23 +658,57 @@ YAMAHA_DEVICE(0x7010, "UB99"), * and no MIDI. */ USB_DEVICE(0x0582, 0x0025), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UA-20", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { + { + .ifnum = 0, + .type = QUIRK_IGNORE_INTERFACE + }, { .ifnum = 1, - .type = QUIRK_AUDIO_STANDARD_INTERFACE + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = & (const struct audioformat) { + .format = SNDRV_PCM_FORMAT_S24_3LE, + .channels = 2, + .iface = 1, + .altsetting = 1, + .altset_idx = 1, + .attributes = 0, + .endpoint = 0x01, + .ep_attr = 0x01, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 44100, + .rate_max = 44100, + } }, { .ifnum = 2, - .type = QUIRK_AUDIO_STANDARD_INTERFACE + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = & (const struct audioformat) { + .format = SNDRV_PCM_FORMAT_S24_3LE, + .channels = 2, + .iface = 2, + .altsetting = 1, + .altset_idx = 1, + .attributes = 0, + .endpoint = 0x82, + .ep_attr = 0x01, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 44100, + .rate_max = 44100, + } }, { .ifnum = 3, - .type = QUIRK_MIDI_STANDARD_INTERFACE + .type = QUIRK_MIDI_FIXED_ENDPOINT, + .data = & (const struct snd_usb_midi_endpoint_info) { + .out_cables = 0x0001, + .in_cables = 0x0001 + } }, { .ifnum = -1 @@ -685,12 +719,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0028 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0027), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "SD-20", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0007 } @@ -699,12 +733,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x002a when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0029), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "SD-80", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x000f, .in_cables = 0x000f } @@ -717,12 +751,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * but offers only 16-bit PCM and no MIDI. */ USB_DEVICE_VENDOR_SPEC(0x0582, 0x002b), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UA-700", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 1, .type = QUIRK_AUDIO_EDIROL_UA700_UA25 @@ -744,12 +778,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x002e when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x002d), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "XV-2020", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -758,12 +792,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0030 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x002f), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "VariOS", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0007, .in_cables = 0x0007 } @@ -772,12 +806,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0034 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0033), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "PCR", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0007 } @@ -790,12 +824,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * later revisions use IDs 0x0054 and 0x00a2. */ USB_DEVICE(0x0582, 0x0037), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "Digital Piano", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -808,12 +842,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * and no MIDI. */ USB_DEVICE_VENDOR_SPEC(0x0582, 0x003b), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "BOSS", .product_name = "GS-10", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = & (const snd_usb_audio_quirk_t[]) { + .data = & (const struct snd_usb_audio_quirk[]) { { .ifnum = 1, .type = QUIRK_AUDIO_STANDARD_INTERFACE @@ -835,12 +869,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0041 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0040), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "GI-20", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -849,12 +883,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0043 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0042), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "RS-70", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -862,12 +896,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0044), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "UA-1000", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 1, .type = QUIRK_AUDIO_EDIROL_UA1000 @@ -879,7 +913,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 3, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0003 } @@ -893,12 +927,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x004a when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0048), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UR-80", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0007 } @@ -908,12 +942,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x004f when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x004d), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "PCR-A", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0007 } @@ -925,12 +959,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * is standard compliant, but has only 16-bit PCM. */ USB_DEVICE(0x0582, 0x0050), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UA-3FX", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 1, .type = QUIRK_AUDIO_STANDARD_INTERFACE @@ -947,7 +981,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0582, 0x0052), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UM-1SX", .ifnum = 0, @@ -958,12 +992,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0067 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0065), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "PCR-1", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0003 } @@ -972,12 +1006,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x006b when not in "Advanced Driver" mode */ USB_DEVICE_VENDOR_SPEC(0x0582, 0x006a), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "SP-606", .ifnum = 3, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -986,12 +1020,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x006e when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x006d), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", .product_name = "FANTOM-X", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1004,12 +1038,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * offers only 16-bit PCM at 44.1 kHz and no MIDI. */ USB_DEVICE_VENDOR_SPEC(0x0582, 0x0074), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "EDIROL", .product_name = "UA-25", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = (const snd_usb_audio_quirk_t[]) { + .data = (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_AUDIO_EDIROL_UA700_UA25 @@ -1031,12 +1065,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x0076 when not in "Advanced Driver" mode */ USB_DEVICE(0x0582, 0x0075), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "BOSS", .product_name = "DR-880", .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1045,12 +1079,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* has ID 0x007b when not in "Advanced Driver" mode */ USB_DEVICE_VENDOR_SPEC(0x0582, 0x007a), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Roland", /* "RD" or "RD-700SX"? */ .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0003 } @@ -1066,12 +1100,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * compliant USB MIDI ports for external MIDI and controls. */ USB_DEVICE_VENDOR_SPEC(0x06f8, 0xb000), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Hercules", .product_name = "DJ Console (WE)", .ifnum = 4, .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1090,12 +1124,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), /* Midiman/M-Audio devices */ { USB_DEVICE_VENDOR_SPEC(0x0763, 0x1002), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "MidiSport 2x2", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0003, .in_cables = 0x0003 } @@ -1103,12 +1137,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x1011), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "MidiSport 1x1", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1116,12 +1150,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x1015), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "Keystation", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1129,12 +1163,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x1021), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "MidiSport 4x4", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x000f, .in_cables = 0x000f } @@ -1147,12 +1181,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), * Thanks to Olaf Giesbrecht <Olaf_Giesbrecht@yahoo.de> */ USB_DEVICE_VER(0x0763, 0x1031, 0x0100, 0x0109), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "MidiSport 8x8", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x01ff, .in_cables = 0x01ff } @@ -1160,12 +1194,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x1033), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "MidiSport 8x8", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x01ff, .in_cables = 0x01ff } @@ -1173,12 +1207,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x1041), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "MidiSport 2x4", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x000f, .in_cables = 0x0003 } @@ -1186,12 +1220,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x2001), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "Quattro", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = & (const snd_usb_audio_quirk_t[]) { + .data = & (const struct snd_usb_audio_quirk[]) { /* * Interfaces 0-2 are "Windows-compatible", 16-bit only, * and share endpoints with the other interfaces. @@ -1237,7 +1271,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 9, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1250,12 +1284,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x2003), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "AudioPhile", .ifnum = 6, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1263,12 +1297,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x2008), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "Ozone", .ifnum = 3, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1276,12 +1310,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0763, 0x200d), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "M-Audio", .product_name = "OmniStudio", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = & (const snd_usb_audio_quirk_t[]) { + .data = & (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_IGNORE_INTERFACE @@ -1321,7 +1355,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { .ifnum = 9, .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x0001, .in_cables = 0x0001 } @@ -1342,12 +1376,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), .idVendor = 0x07fd, .idProduct = 0x0001, .bDeviceSubClass = 2, - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "MOTU", .product_name = "Fastlane", .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, - .data = & (const snd_usb_audio_quirk_t[]) { + .data = & (const struct snd_usb_audio_quirk[]) { { .ifnum = 0, .type = QUIRK_MIDI_RAW @@ -1366,7 +1400,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { /* Creative Sound Blaster MP3+ */ USB_DEVICE(0x041e, 0x3010), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Creative Labs", .product_name = "Sound Blaster MP3+", .ifnum = QUIRK_NO_INTERFACE @@ -1377,12 +1411,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), /* Emagic devices */ { USB_DEVICE(0x086a, 0x0001), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Emagic", /* .product_name = "Unitor8", */ .ifnum = 2, .type = QUIRK_MIDI_EMAGIC, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x80ff, .in_cables = 0x80ff } @@ -1390,12 +1424,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x086a, 0x0002), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Emagic", /* .product_name = "AMT8", */ .ifnum = 2, .type = QUIRK_MIDI_EMAGIC, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x80ff, .in_cables = 0x80ff } @@ -1403,12 +1437,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x086a, 0x0003), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Emagic", /* .product_name = "MT4", */ .ifnum = 2, .type = QUIRK_MIDI_EMAGIC, - .data = & (const snd_usb_midi_endpoint_info_t) { + .data = & (const struct snd_usb_midi_endpoint_info) { .out_cables = 0x800f, .in_cables = 0x8003 } @@ -1418,7 +1452,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), /* TerraTec devices */ { USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "TerraTec", .product_name = "PHASE 26", .ifnum = 3, @@ -1427,7 +1461,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0013), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "TerraTec", .product_name = "PHASE 26", .ifnum = 3, @@ -1438,7 +1472,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), /* Novation EMS devices */ { USB_DEVICE_VENDOR_SPEC(0x1235, 0x0001), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Novation", .product_name = "ReMOTE Audio/XStation", .ifnum = 4, @@ -1447,7 +1481,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x1235, 0x0002), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Novation", .product_name = "Speedio", .ifnum = 3, @@ -1456,7 +1490,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE_VENDOR_SPEC(0x1235, 0x4661), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Novation", .product_name = "ReMOTE25", .ifnum = 0, @@ -1466,7 +1500,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), { USB_DEVICE(0x4752, 0x0011), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Miditech", .product_name = "Midistart-2", .ifnum = 0, @@ -1475,7 +1509,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x7104, 0x2202), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Miditech", .product_name = "MidiStudio-2", .ifnum = 0, @@ -1492,7 +1526,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceSubClass = USB_SUBCLASS_MIDI_STREAMING, - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_MIDI_STANDARD_INTERFACE } diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 8abe086..4b52d18 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -31,7 +31,7 @@ #include "usbusx2y.h" #include "usX2Yhwdep.h" -int usX2Y_hwdep_pcm_new(snd_card_t* card); +int usX2Y_hwdep_pcm_new(struct snd_card *card); static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsigned long address, int *type) @@ -49,7 +49,7 @@ static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsign offset = area->vm_pgoff << PAGE_SHIFT; offset += address - area->vm_start; snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); - vaddr = (char*)((usX2Ydev_t*)area->vm_private_data)->us428ctls_sharedmem + offset; + vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset; page = virt_to_page(vaddr); get_page(page); snd_printdd( "vaddr=%p made us428ctls_vm_nopage() return %p; offset=%lX\n", vaddr, page, offset); @@ -64,27 +64,27 @@ static struct vm_operations_struct us428ctls_vm_ops = { .nopage = snd_us428ctls_vm_nopage, }; -static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) +static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) { unsigned long size = (unsigned long)(area->vm_end - area->vm_start); - usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; + struct usX2Ydev *us428 = hw->private_data; // FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs? // so as long as the device isn't fully initialised yet we return -EBUSY here. - if (!(((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT)) + if (!(us428->chip_status & USX2Y_STAT_CHIP_INIT)) return -EBUSY; /* if userspace tries to mmap beyond end of our buffer, fail */ - if (size > ((PAGE_SIZE - 1 + sizeof(us428ctls_sharedmem_t)) / PAGE_SIZE) * PAGE_SIZE) { - snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t)); + if (size > PAGE_ALIGN(sizeof(struct us428ctls_sharedmem))) { + snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(struct us428ctls_sharedmem)); return -EINVAL; } if (!us428->us428ctls_sharedmem) { init_waitqueue_head(&us428->us428ctls_wait_queue_head); - if(!(us428->us428ctls_sharedmem = snd_malloc_pages(sizeof(us428ctls_sharedmem_t), GFP_KERNEL))) + if(!(us428->us428ctls_sharedmem = snd_malloc_pages(sizeof(struct us428ctls_sharedmem), GFP_KERNEL))) return -ENOMEM; - memset(us428->us428ctls_sharedmem, -1, sizeof(us428ctls_sharedmem_t)); + memset(us428->us428ctls_sharedmem, -1, sizeof(struct us428ctls_sharedmem)); us428->us428ctls_sharedmem->CtlSnapShotLast = -2; } area->vm_ops = &us428ctls_vm_ops; @@ -93,11 +93,11 @@ static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_are return 0; } -static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait) +static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, poll_table *wait) { unsigned int mask = 0; - usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; - us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem; + struct usX2Ydev *us428 = hw->private_data; + struct us428ctls_sharedmem *shm = us428->us428ctls_sharedmem; if (us428->chip_status & USX2Y_STAT_CHIP_HUP) return POLLHUP; @@ -110,26 +110,28 @@ static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_ } -static int snd_usX2Y_hwdep_open(snd_hwdep_t *hw, struct file *file) +static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file) { return 0; } -static int snd_usX2Y_hwdep_release(snd_hwdep_t *hw, struct file *file) +static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file) { return 0; } -static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *info) +static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, + struct snd_hwdep_dsp_status *info) { static char *type_ids[USX2Y_TYPE_NUMS] = { [USX2Y_TYPE_122] = "us122", [USX2Y_TYPE_224] = "us224", [USX2Y_TYPE_428] = "us428", }; + struct usX2Ydev *us428 = hw->private_data; int id = -1; - switch (le16_to_cpu(((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct)) { + switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { case USB_ID_US122: id = USX2Y_TYPE_122; break; @@ -144,35 +146,35 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i return -ENODEV; strcpy(info->id, type_ids[id]); info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code - if (((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT) + if (us428->chip_status & USX2Y_STAT_CHIP_INIT) info->chip_ready = 1; info->version = USX2Y_DRIVER_VERSION; return 0; } -static int usX2Y_create_usbmidi(snd_card_t* card ) +static int usX2Y_create_usbmidi(struct snd_card *card) { - static snd_usb_midi_endpoint_info_t quirk_data_1 = { - .out_ep =0x06, + static struct snd_usb_midi_endpoint_info quirk_data_1 = { + .out_ep = 0x06, .in_ep = 0x06, .out_cables = 0x001, .in_cables = 0x001 }; - static snd_usb_audio_quirk_t quirk_1 = { + static struct snd_usb_audio_quirk quirk_1 = { .vendor_name = "TASCAM", .product_name = NAME_ALLCAPS, .ifnum = 0, .type = QUIRK_MIDI_FIXED_ENDPOINT, .data = &quirk_data_1 }; - static snd_usb_midi_endpoint_info_t quirk_data_2 = { - .out_ep =0x06, + static struct snd_usb_midi_endpoint_info quirk_data_2 = { + .out_ep = 0x06, .in_ep = 0x06, .out_cables = 0x003, .in_cables = 0x003 }; - static snd_usb_audio_quirk_t quirk_2 = { + static struct snd_usb_audio_quirk quirk_2 = { .vendor_name = "TASCAM", .product_name = "US428", .ifnum = 0, @@ -181,13 +183,15 @@ static int usX2Y_create_usbmidi(snd_card_t* card ) }; struct usb_device *dev = usX2Y(card)->chip.dev; struct usb_interface *iface = usb_ifnum_to_if(dev, 0); - snd_usb_audio_quirk_t *quirk = le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? &quirk_2 : &quirk_1; + struct snd_usb_audio_quirk *quirk = + le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? + &quirk_2 : &quirk_1; snd_printdd("usX2Y_create_usbmidi \n"); return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk); } -static int usX2Y_create_alsa_devices(snd_card_t* card) +static int usX2Y_create_alsa_devices(struct snd_card *card) { int err; @@ -207,9 +211,10 @@ static int usX2Y_create_alsa_devices(snd_card_t* card) return err; } -static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) +static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, + struct snd_hwdep_dsp_image *dsp) { - usX2Ydev_t *priv = hw->private_data; + struct usX2Ydev *priv = hw->private_data; int lret, err = -EINVAL; snd_printdd( "dsp_load %s\n", dsp->name); @@ -256,10 +261,10 @@ static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) } -int usX2Y_hwdep_new(snd_card_t* card, struct usb_device* device) +int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) { int err; - snd_hwdep_t *hw; + struct snd_hwdep *hw; if ((err = snd_hwdep_new(card, SND_USX2Y_LOADER_ID, 0, &hw)) < 0) return err; diff --git a/sound/usb/usx2y/usX2Yhwdep.h b/sound/usb/usx2y/usX2Yhwdep.h index d612a26..c095d5b 100644 --- a/sound/usb/usx2y/usX2Yhwdep.h +++ b/sound/usb/usx2y/usX2Yhwdep.h @@ -1,6 +1,6 @@ #ifndef USX2YHWDEP_H #define USX2YHWDEP_H -int usX2Y_hwdep_new(snd_card_t* card, struct usb_device* device); +int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device); #endif diff --git a/sound/usb/usx2y/usbus428ctldefs.h b/sound/usb/usx2y/usbus428ctldefs.h index 6af1643..b864e7e 100644 --- a/sound/usb/usx2y/usbus428ctldefs.h +++ b/sound/usb/usx2y/usbus428ctldefs.h @@ -51,7 +51,7 @@ enum E_In84{ #define T_NULL 0x80 -struct us428_ctls{ +struct us428_ctls { unsigned char Fader[9]; unsigned char Transport; unsigned char Modifier; @@ -63,46 +63,42 @@ struct us428_ctls{ unsigned char Wheel[5]; }; -typedef struct us428_ctls us428_ctls_t; - -typedef struct us428_setByte{ +struct us428_setByte { unsigned char Offset, Value; -}us428_setByte_t; +}; enum { eLT_Volume = 0, eLT_Light }; -typedef struct usX2Y_volume { +struct usX2Y_volume { unsigned char Channel, LH, LL, RH, RL; -} usX2Y_volume_t; +}; -struct us428_lights{ - us428_setByte_t Light[7]; +struct us428_lights { + struct us428_setByte Light[7]; }; -typedef struct us428_lights us428_lights_t; -typedef struct { +struct us428_p4out { char type; union { - usX2Y_volume_t vol; - us428_lights_t lights; + struct usX2Y_volume vol; + struct us428_lights lights; } val; -} us428_p4out_t; +}; #define N_us428_ctl_BUFS 16 #define N_us428_p4out_BUFS 16 struct us428ctls_sharedmem{ - us428_ctls_t CtlSnapShot[N_us428_ctl_BUFS]; - int CtlSnapShotDiffersAt[N_us428_ctl_BUFS]; - int CtlSnapShotLast, CtlSnapShotRed; - us428_p4out_t p4out[N_us428_p4out_BUFS]; - int p4outLast, p4outSent; + struct us428_ctls CtlSnapShot[N_us428_ctl_BUFS]; + int CtlSnapShotDiffersAt[N_us428_ctl_BUFS]; + int CtlSnapShotLast, CtlSnapShotRed; + struct us428_p4out p4out[N_us428_p4out_BUFS]; + int p4outLast, p4outSent; }; -typedef struct us428ctls_sharedmem us428ctls_sharedmem_t; diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index a3967f7..e0abb56 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -167,28 +167,28 @@ MODULE_PARM_DESC(enable, "Enable "NAME_ALLCAPS"."); static int snd_usX2Y_card_used[SNDRV_CARDS]; static void usX2Y_usb_disconnect(struct usb_device* usb_device, void* ptr); -static void snd_usX2Y_card_private_free(snd_card_t *card); +static void snd_usX2Y_card_private_free(struct snd_card *card); /* * pipe 4 is used for switching the lamps, setting samplerate, volumes .... */ -static void i_usX2Y_Out04Int(struct urb* urb, struct pt_regs *regs) +static void i_usX2Y_Out04Int(struct urb *urb, struct pt_regs *regs) { #ifdef CONFIG_SND_DEBUG if (urb->status) { int i; - usX2Ydev_t* usX2Y = urb->context; + struct usX2Ydev *usX2Y = urb->context; for (i = 0; i < 10 && usX2Y->AS04.urb[i] != urb; i++); snd_printdd("i_usX2Y_Out04Int() urb %i status=%i\n", i, urb->status); } #endif } -static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs) +static void i_usX2Y_In04Int(struct urb *urb, struct pt_regs *regs) { int err = 0; - usX2Ydev_t *usX2Y = urb->context; - us428ctls_sharedmem_t *us428ctls = usX2Y->us428ctls_sharedmem; + struct usX2Ydev *usX2Y = urb->context; + struct us428ctls_sharedmem *us428ctls = usX2Y->us428ctls_sharedmem; usX2Y->In04IntCalls++; @@ -239,10 +239,10 @@ static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs) send = 0; for (j = 0; j < URBS_AsyncSeq && !err; ++j) if (0 == usX2Y->AS04.urb[j]->status) { - us428_p4out_t *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. + struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, - p4out->type == eLT_Light ? sizeof(us428_lights_t) : 5, + p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, i_usX2Y_Out04Int, usX2Y); err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); us428ctls->p4outSent = send; @@ -261,7 +261,7 @@ static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs) /* * Prepare some urbs */ -int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y) +int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y) { int err = 0, i; @@ -283,9 +283,8 @@ int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y) return err; } -int usX2Y_In04_init(usX2Ydev_t* usX2Y) +int usX2Y_In04_init(struct usX2Ydev *usX2Y) { - int err = 0; if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL))) return -ENOMEM; @@ -299,11 +298,10 @@ int usX2Y_In04_init(usX2Ydev_t* usX2Y) usX2Y->In04Buf, 21, i_usX2Y_In04Int, usX2Y, 10); - err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); - return err; + return usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); } -static void usX2Y_unlinkSeq(snd_usX2Y_AsyncSeq_t* S) +static void usX2Y_unlinkSeq(struct snd_usX2Y_AsyncSeq *S) { int i; for (i = 0; i < URBS_AsyncSeq; ++i) { @@ -336,16 +334,16 @@ static struct usb_device_id snd_usX2Y_usb_id_table[] = { { /* terminator */ } }; -static snd_card_t* usX2Y_create_card(struct usb_device* device) +static struct snd_card *usX2Y_create_card(struct usb_device *device) { int dev; - snd_card_t* card; + struct snd_card * card; for (dev = 0; dev < SNDRV_CARDS; ++dev) if (enable[dev] && !snd_usX2Y_card_used[dev]) break; if (dev >= SNDRV_CARDS) return NULL; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(usX2Ydev_t)); + card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev)); if (!card) return NULL; snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; @@ -369,10 +367,10 @@ static snd_card_t* usX2Y_create_card(struct usb_device* device) } -static void* usX2Y_usb_probe(struct usb_device* device, struct usb_interface *intf, const struct usb_device_id* device_id) +static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *intf, const struct usb_device_id *device_id) { int err; - snd_card_t* card; + struct snd_card * card; if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && @@ -415,7 +413,7 @@ static struct usb_driver snd_usX2Y_usb_driver = { .id_table = snd_usX2Y_usb_id_table, }; -static void snd_usX2Y_card_private_free(snd_card_t *card) +static void snd_usX2Y_card_private_free(struct snd_card *card) { kfree(usX2Y(card)->In04Buf); usb_free_urb(usX2Y(card)->In04urb); @@ -428,23 +426,24 @@ static void snd_usX2Y_card_private_free(snd_card_t *card) /* * Frees the device. */ -static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr) +static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) { if (ptr) { - usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr); - struct list_head* p; + struct snd_card *card = ptr; + struct usX2Ydev *usX2Y = usX2Y(card); + struct list_head *p; usX2Y->chip.shutdown = 1; usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; usX2Y_unlinkSeq(&usX2Y->AS04); usb_kill_urb(usX2Y->In04urb); - snd_card_disconnect((snd_card_t*)ptr); + snd_card_disconnect(card); /* release the midi resources */ list_for_each(p, &usX2Y->chip.midi_list) { snd_usbmidi_disconnect(p); } if (usX2Y->us428ctls_sharedmem) wake_up(&usX2Y->us428ctls_wait_queue_head); - snd_card_free((snd_card_t*)ptr); + snd_card_free(card); } } diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h index f65f3a7..435c1fe 100644 --- a/sound/usb/usx2y/usbusx2y.h +++ b/sound/usb/usx2y/usbusx2y.h @@ -8,47 +8,46 @@ #define URBS_AsyncSeq 10 #define URB_DataLen_AsyncSeq 32 -typedef struct { - struct urb* urb[URBS_AsyncSeq]; - char* buffer; -} snd_usX2Y_AsyncSeq_t; +struct snd_usX2Y_AsyncSeq { + struct urb *urb[URBS_AsyncSeq]; + char *buffer; +}; -typedef struct { +struct snd_usX2Y_urbSeq { int submitted; int len; - struct urb* urb[0]; -} snd_usX2Y_urbSeq_t; + struct urb *urb[0]; +}; -typedef struct snd_usX2Y_substream snd_usX2Y_substream_t; #include "usx2yhwdeppcm.h" -typedef struct { - snd_usb_audio_t chip; +struct usX2Ydev { + struct snd_usb_audio chip; int stride; struct urb *In04urb; void *In04Buf; char In04Last[24]; unsigned In04IntCalls; - snd_usX2Y_urbSeq_t *US04; + struct snd_usX2Y_urbSeq *US04; wait_queue_head_t In04WaitQueue; - snd_usX2Y_AsyncSeq_t AS04; + struct snd_usX2Y_AsyncSeq AS04; unsigned int rate, format; int chip_status; struct semaphore prepare_mutex; - us428ctls_sharedmem_t *us428ctls_sharedmem; + struct us428ctls_sharedmem *us428ctls_sharedmem; int wait_iso_frame; wait_queue_head_t us428ctls_wait_queue_head; - snd_usX2Y_hwdep_pcm_shm_t *hwdep_pcm_shm; - snd_usX2Y_substream_t *subs[4]; - snd_usX2Y_substream_t * volatile prepare_subs; + struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm; + struct snd_usX2Y_substream *subs[4]; + struct snd_usX2Y_substream * volatile prepare_subs; wait_queue_head_t prepare_wait_queue; -} usX2Ydev_t; +}; struct snd_usX2Y_substream { - usX2Ydev_t *usX2Y; - snd_pcm_substream_t *pcm_substream; + struct usX2Ydev *usX2Y; + struct snd_pcm_substream *pcm_substream; int endpoint; unsigned int maxpacksize; /* max packet size in bytes */ @@ -72,12 +71,12 @@ struct snd_usX2Y_substream { }; -#define usX2Y(c) ((usX2Ydev_t*)(c)->private_data) +#define usX2Y(c) ((struct usX2Ydev *)(c)->private_data) -int usX2Y_audio_create(snd_card_t* card); +int usX2Y_audio_create(struct snd_card *card); -int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y); -int usX2Y_In04_init(usX2Ydev_t* usX2Y); +int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y); +int usX2Y_In04_init(struct usX2Ydev *usX2Y); #define NAME_ALLCAPS "US-X2Y" diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index affda97..a6bbc7a 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -67,18 +67,20 @@ #endif -static int usX2Y_urb_capt_retire(snd_usX2Y_substream_t *subs) +static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs) { struct urb *urb = subs->completed_urb; - snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; unsigned char *cp; int i, len, lens = 0, hwptr_done = subs->hwptr_done; - usX2Ydev_t *usX2Y = subs->usX2Y; + struct usX2Ydev *usX2Y = subs->usX2Y; for (i = 0; i < nr_of_packs(); i++) { cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset; if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */ - snd_printk(KERN_ERR "activ frame status %i. Most propably some hardware problem.\n", urb->iso_frame_desc[i].status); + snd_printk(KERN_ERR "active frame status %i. " + "Most propably some hardware problem.\n", + urb->iso_frame_desc[i].status); return urb->iso_frame_desc[i].status; } 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) memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, blen); memcpy(runtime->dma_area, cp + blen, len * usX2Y->stride - blen); } else { - memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, len * usX2Y->stride); + memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, + len * usX2Y->stride); } lens += len; if ((hwptr_done += len) >= runtime->buffer_size) @@ -120,13 +123,13 @@ static int usX2Y_urb_capt_retire(snd_usX2Y_substream_t *subs) * it directly from the buffer. thus the data is once copied to * a temporary buffer and urb points to that. */ -static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs, +static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs, struct urb *cap_urb, struct urb *urb) { int count, counts, pack; - usX2Ydev_t* usX2Y = subs->usX2Y; - snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; + struct usX2Ydev *usX2Y = subs->usX2Y; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; count = 0; for (pack = 0; pack < nr_of_packs(); pack++) { @@ -139,7 +142,8 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs, } /* set up descriptor */ urb->iso_frame_desc[pack].offset = pack ? - urb->iso_frame_desc[pack - 1].offset + urb->iso_frame_desc[pack - 1].length : + urb->iso_frame_desc[pack - 1].offset + + urb->iso_frame_desc[pack - 1].length : 0; urb->iso_frame_desc[pack].length = cap_urb->iso_frame_desc[pack].actual_length; } @@ -151,8 +155,10 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs, int len; len = runtime->buffer_size - subs->hwptr; urb->transfer_buffer = subs->tmpbuf; - memcpy(subs->tmpbuf, runtime->dma_area + subs->hwptr * usX2Y->stride, len * usX2Y->stride); - memcpy(subs->tmpbuf + len * usX2Y->stride, runtime->dma_area, (count - len) * usX2Y->stride); + memcpy(subs->tmpbuf, runtime->dma_area + + subs->hwptr * usX2Y->stride, len * usX2Y->stride); + memcpy(subs->tmpbuf + len * usX2Y->stride, + runtime->dma_area, (count - len) * usX2Y->stride); subs->hwptr += count; subs->hwptr -= runtime->buffer_size; } else { @@ -172,9 +178,9 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs, * * update the current position and call callback if a period is processed. */ -static void usX2Y_urb_play_retire(snd_usX2Y_substream_t *subs, struct urb *urb) +static void usX2Y_urb_play_retire(struct snd_usX2Y_substream *subs, struct urb *urb) { - snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; int len = urb->actual_length / subs->usX2Y->stride; subs->transfer_done += len; @@ -187,7 +193,7 @@ static void usX2Y_urb_play_retire(snd_usX2Y_substream_t *subs, struct urb *urb) } } -static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int frame) +static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, int frame) { int err; if (!urb) @@ -202,50 +208,47 @@ static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int fr return 0; } -static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_usX2Y_substream_t *playbacksubs, int frame) +static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs, + struct snd_usX2Y_substream *playbacksubs, + int frame) { int err, state; - { - struct urb *urb = playbacksubs->completed_urb; - - state = atomic_read(&playbacksubs->state); - if (NULL != urb) { - if (state == state_RUNNING) - usX2Y_urb_play_retire(playbacksubs, urb); - else - if (state >= state_PRERUNNING) { - atomic_inc(&playbacksubs->state); - } - } else { - switch (state) { - case state_STARTING1: - urb = playbacksubs->urb[0]; - atomic_inc(&playbacksubs->state); - break; - case state_STARTING2: - urb = playbacksubs->urb[1]; - atomic_inc(&playbacksubs->state); - break; - } + struct urb *urb = playbacksubs->completed_urb; + + state = atomic_read(&playbacksubs->state); + if (NULL != urb) { + if (state == state_RUNNING) + usX2Y_urb_play_retire(playbacksubs, urb); + else if (state >= state_PRERUNNING) + atomic_inc(&playbacksubs->state); + } else { + switch (state) { + case state_STARTING1: + urb = playbacksubs->urb[0]; + atomic_inc(&playbacksubs->state); + break; + case state_STARTING2: + urb = playbacksubs->urb[1]; + atomic_inc(&playbacksubs->state); + break; } - if (urb) { - if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || - (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { - return err; - } + } + if (urb) { + if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || + (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { + return err; } - - playbacksubs->completed_urb = NULL; } + + playbacksubs->completed_urb = NULL; + state = atomic_read(&capsubs->state); if (state >= state_PREPARED) { if (state == state_RUNNING) { if ((err = usX2Y_urb_capt_retire(capsubs))) return err; - } else - if (state >= state_PRERUNNING) { - atomic_inc(&capsubs->state); - } + } else if (state >= state_PRERUNNING) + atomic_inc(&capsubs->state); if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) return err; } @@ -254,18 +257,19 @@ static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_us } -static void usX2Y_clients_stop(usX2Ydev_t *usX2Y) +static void usX2Y_clients_stop(struct usX2Ydev *usX2Y) { int s, u; + for (s = 0; s < 4; s++) { - snd_usX2Y_substream_t *subs = usX2Y->subs[s]; + struct snd_usX2Y_substream *subs = usX2Y->subs[s]; if (subs) { snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state)); atomic_set(&subs->state, state_STOPPED); } } for (s = 0; s < 4; s++) { - snd_usX2Y_substream_t *subs = usX2Y->subs[s]; + struct snd_usX2Y_substream *subs = usX2Y->subs[s]; if (subs) { if (atomic_read(&subs->state) >= state_PRERUNNING) { snd_pcm_stop(subs->pcm_substream, SNDRV_PCM_STATE_XRUN); @@ -273,7 +277,8 @@ static void usX2Y_clients_stop(usX2Ydev_t *usX2Y) for (u = 0; u < NRURBS; u++) { struct urb *urb = subs->urb[u]; if (NULL != urb) - snd_printdd("%i status=%i start_frame=%i\n", u, urb->status, urb->start_frame); + snd_printdd("%i status=%i start_frame=%i\n", + u, urb->status, urb->start_frame); } } } @@ -281,30 +286,36 @@ static void usX2Y_clients_stop(usX2Ydev_t *usX2Y) wake_up(&usX2Y->prepare_wait_queue); } -static void usX2Y_error_urb_status(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) +static void usX2Y_error_urb_status(struct usX2Ydev *usX2Y, + struct snd_usX2Y_substream *subs, struct urb *urb) { snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status); urb->status = 0; usX2Y_clients_stop(usX2Y); } -static void usX2Y_error_sequence(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) +static void usX2Y_error_sequence(struct usX2Ydev *usX2Y, + struct snd_usX2Y_substream *subs, struct urb *urb) { snd_printk(KERN_ERR "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" KERN_ERR "Most propably some urb of usb-frame %i is still missing.\n" KERN_ERR "Cause could be too long delays in usb-hcd interrupt handling.\n", usb_get_current_frame_number(usX2Y->chip.dev), - subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); + subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", + usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); usX2Y_clients_stop(usX2Y); } static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs) { - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; - usX2Ydev_t *usX2Y = subs->usX2Y; + struct snd_usX2Y_substream *subs = urb->context; + struct usX2Ydev *usX2Y = subs->usX2Y; if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { - 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); + 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); return; } if (unlikely(urb->status)) { @@ -318,10 +329,12 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs) return; } { - snd_usX2Y_substream_t *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE], + struct snd_usX2Y_substream *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE], *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; - if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED && - (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) { + if (capsubs->completed_urb && + atomic_read(&capsubs->state) >= state_PREPARED && + (playbacksubs->completed_urb || + atomic_read(&playbacksubs->state) < state_PREPARED)) { if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) { if (nr_of_packs() <= urb->start_frame && 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) } } -static void usX2Y_urbs_set_complete(usX2Ydev_t * usX2Y, void (*complete)(struct urb *, struct pt_regs *)) +static void usX2Y_urbs_set_complete(struct usX2Ydev * usX2Y, + void (*complete)(struct urb *, struct pt_regs *)) { int s, u; for (s = 0; s < 4; s++) { - snd_usX2Y_substream_t *subs = usX2Y->subs[s]; + struct snd_usX2Y_substream *subs = usX2Y->subs[s]; if (NULL != subs) for (u = 0; u < NRURBS; u++) { struct urb * urb = subs->urb[u]; @@ -350,7 +364,7 @@ static void usX2Y_urbs_set_complete(usX2Ydev_t * usX2Y, void (*complete)(struct } } -static void usX2Y_subs_startup_finish(usX2Ydev_t * usX2Y) +static void usX2Y_subs_startup_finish(struct usX2Ydev * usX2Y) { usX2Y_urbs_set_complete(usX2Y, i_usX2Y_urb_complete); usX2Y->prepare_subs = NULL; @@ -358,9 +372,9 @@ static void usX2Y_subs_startup_finish(usX2Ydev_t * usX2Y) static void i_usX2Y_subs_startup(struct urb *urb, struct pt_regs *regs) { - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; - usX2Ydev_t *usX2Y = subs->usX2Y; - snd_usX2Y_substream_t *prepare_subs = usX2Y->prepare_subs; + struct snd_usX2Y_substream *subs = urb->context; + struct usX2Ydev *usX2Y = subs->usX2Y; + struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs; if (NULL != prepare_subs) if (urb->start_frame == prepare_subs->urb[0]->start_frame) { usX2Y_subs_startup_finish(usX2Y); @@ -371,9 +385,10 @@ static void i_usX2Y_subs_startup(struct urb *urb, struct pt_regs *regs) i_usX2Y_urb_complete(urb, regs); } -static void usX2Y_subs_prepare(snd_usX2Y_substream_t *subs) +static void usX2Y_subs_prepare(struct snd_usX2Y_substream *subs) { - snd_printdd("usX2Y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", subs, subs->endpoint, subs->urb[0], subs->urb[1]); + snd_printdd("usX2Y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", + subs, subs->endpoint, subs->urb[0], subs->urb[1]); /* reset the pointer */ subs->hwptr = 0; subs->hwptr_done = 0; @@ -381,7 +396,7 @@ static void usX2Y_subs_prepare(snd_usX2Y_substream_t *subs) } -static void usX2Y_urb_release(struct urb** urb, int free_tb) +static void usX2Y_urb_release(struct urb **urb, int free_tb) { if (*urb) { usb_kill_urb(*urb); @@ -394,12 +409,13 @@ static void usX2Y_urb_release(struct urb** urb, int free_tb) /* * release a substreams urbs */ -static void usX2Y_urbs_release(snd_usX2Y_substream_t *subs) +static void usX2Y_urbs_release(struct snd_usX2Y_substream *subs) { int i; snd_printdd("usX2Y_urbs_release() %i\n", subs->endpoint); for (i = 0; i < NRURBS; i++) - usX2Y_urb_release(subs->urb + i, subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]); + usX2Y_urb_release(subs->urb + i, + subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]); kfree(subs->tmpbuf); subs->tmpbuf = NULL; @@ -407,7 +423,7 @@ static void usX2Y_urbs_release(snd_usX2Y_substream_t *subs) /* * initialize a substream's urbs */ -static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs) +static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) { int i; unsigned int pipe; @@ -429,7 +445,7 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs) } /* allocate and initialize data urbs */ for (i = 0; i < NRURBS; i++) { - struct urb** purb = subs->urb + i; + struct urb **purb = subs->urb + i; if (*purb) { usb_kill_urb(*purb); continue; @@ -457,70 +473,68 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs) return 0; } -static void usX2Y_subs_startup(snd_usX2Y_substream_t *subs) +static void usX2Y_subs_startup(struct snd_usX2Y_substream *subs) { - usX2Ydev_t *usX2Y = subs->usX2Y; + struct usX2Ydev *usX2Y = subs->usX2Y; usX2Y->prepare_subs = subs; subs->urb[0]->start_frame = -1; wmb(); usX2Y_urbs_set_complete(usX2Y, i_usX2Y_subs_startup); } -static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs) +static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) { int i, err; - usX2Ydev_t *usX2Y = subs->usX2Y; + struct usX2Ydev *usX2Y = subs->usX2Y; if ((err = usX2Y_urbs_allocate(subs)) < 0) return err; subs->completed_urb = NULL; for (i = 0; i < 4; i++) { - snd_usX2Y_substream_t *subs = usX2Y->subs[i]; + struct snd_usX2Y_substream *subs = usX2Y->subs[i]; if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) goto start; } usX2Y->wait_iso_frame = -1; + start: - { - usX2Y_subs_startup(subs); - for (i = 0; i < NRURBS; i++) { - struct urb *urb = subs->urb[i]; - if (usb_pipein(urb->pipe)) { - unsigned long pack; - if (0 == i) - atomic_set(&subs->state, state_STARTING3); - urb->dev = usX2Y->chip.dev; - urb->transfer_flags = URB_ISO_ASAP; - for (pack = 0; pack < nr_of_packs(); pack++) { - urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; - urb->iso_frame_desc[pack].length = subs->maxpacksize; - } - urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); - if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { - snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); - err = -EPIPE; - goto cleanup; - } else { - if (0 > usX2Y->wait_iso_frame) - usX2Y->wait_iso_frame = urb->start_frame; - } - urb->transfer_flags = 0; + usX2Y_subs_startup(subs); + for (i = 0; i < NRURBS; i++) { + struct urb *urb = subs->urb[i]; + if (usb_pipein(urb->pipe)) { + unsigned long pack; + if (0 == i) + atomic_set(&subs->state, state_STARTING3); + urb->dev = usX2Y->chip.dev; + urb->transfer_flags = URB_ISO_ASAP; + for (pack = 0; pack < nr_of_packs(); pack++) { + urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; + urb->iso_frame_desc[pack].length = subs->maxpacksize; + } + urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); + if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { + snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); + err = -EPIPE; + goto cleanup; } else { - atomic_set(&subs->state, state_STARTING1); - break; + if (0 > usX2Y->wait_iso_frame) + usX2Y->wait_iso_frame = urb->start_frame; } + urb->transfer_flags = 0; + } else { + atomic_set(&subs->state, state_STARTING1); + break; } - err = 0; - wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); - if (atomic_read(&subs->state) != state_PREPARED) { - err = -EPIPE; - } - - cleanup: - if (err) { - usX2Y_subs_startup_finish(usX2Y); - usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything - } + } + err = 0; + wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); + if (atomic_read(&subs->state) != state_PREPARED) + err = -EPIPE; + + cleanup: + if (err) { + usX2Y_subs_startup_finish(usX2Y); + usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything } return err; } @@ -528,17 +542,17 @@ static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs) /* * return the current pcm pointer. just return the hwptr_done value. */ -static snd_pcm_uframes_t snd_usX2Y_pcm_pointer(snd_pcm_substream_t *substream) +static snd_pcm_uframes_t snd_usX2Y_pcm_pointer(struct snd_pcm_substream *substream) { - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)substream->runtime->private_data; + struct snd_usX2Y_substream *subs = substream->runtime->private_data; return subs->hwptr_done; } /* * start/stop substream */ -static int snd_usX2Y_pcm_trigger(snd_pcm_substream_t *substream, int cmd) +static int snd_usX2Y_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)substream->runtime->private_data; + struct snd_usX2Y_substream *subs = substream->runtime->private_data; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -649,9 +663,9 @@ static struct s_c2 SetRate48000[] = }; #define NOOF_SETRATE_URBS ARRAY_SIZE(SetRate48000) -static void i_usX2Y_04Int(struct urb* urb, struct pt_regs *regs) +static void i_usX2Y_04Int(struct urb *urb, struct pt_regs *regs) { - usX2Ydev_t* usX2Y = urb->context; + struct usX2Ydev *usX2Y = urb->context; if (urb->status) 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) wake_up(&usX2Y->In04WaitQueue); } -static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) +static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) { int err = 0, i; - snd_usX2Y_urbSeq_t *us = NULL; + struct snd_usX2Y_urbSeq *us = NULL; int *usbdata = NULL; struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; if (usX2Y->rate != rate) { - us = kmalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); + us = kzalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); if (NULL == us) { err = -ENOMEM; goto cleanup; } - memset(us, 0, sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS); - usbdata = kmalloc(sizeof(int)*NOOF_SETRATE_URBS, GFP_KERNEL); + usbdata = kmalloc(sizeof(int) * NOOF_SETRATE_URBS, GFP_KERNEL); if (NULL == usbdata) { err = -ENOMEM; goto cleanup; @@ -713,9 +726,8 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) usX2Y->US04 = NULL; kfree(usbdata); kfree(us); - if (!err) { + if (!err) usX2Y->rate = rate; - } } } @@ -723,7 +735,7 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) } -static int usX2Y_format_set(usX2Ydev_t *usX2Y, snd_pcm_format_t format) +static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) { int alternate, err; struct list_head* p; @@ -753,40 +765,40 @@ static int usX2Y_format_set(usX2Ydev_t *usX2Y, snd_pcm_format_t format) } -static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream, - snd_pcm_hw_params_t *hw_params) +static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { int err = 0; unsigned int rate = params_rate(hw_params); snd_pcm_format_t format = params_format(hw_params); - snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); + struct snd_card *card = substream->pstr->pcm->card; + struct list_head *list; - { // all pcm substreams off one usX2Y have to operate at the same rate & format - snd_card_t *card = substream->pstr->pcm->card; - struct list_head *list; - list_for_each(list, &card->devices) { - snd_device_t *dev; - snd_pcm_t *pcm; - int s; - dev = snd_device(list); - if (dev->type != SNDRV_DEV_PCM) - continue; - pcm = dev->device_data; - for (s = 0; s < 2; ++s) { - snd_pcm_substream_t *test_substream; - test_substream = pcm->streams[s].substream; - if (test_substream && test_substream != substream && - test_substream->runtime && - ((test_substream->runtime->format && - test_substream->runtime->format != format) || - (test_substream->runtime->rate && - test_substream->runtime->rate != rate))) - return -EINVAL; - } + snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); + // all pcm substreams off one usX2Y have to operate at the same rate & format + list_for_each(list, &card->devices) { + struct snd_device *dev; + struct snd_pcm *pcm; + int s; + dev = snd_device(list); + if (dev->type != SNDRV_DEV_PCM) + continue; + pcm = dev->device_data; + for (s = 0; s < 2; ++s) { + struct snd_pcm_substream *test_substream; + test_substream = pcm->streams[s].substream; + if (test_substream && test_substream != substream && + test_substream->runtime && + ((test_substream->runtime->format && + test_substream->runtime->format != format) || + (test_substream->runtime->rate && + test_substream->runtime->rate != rate))) + return -EINVAL; } } if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) { - snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", substream, params_buffer_bytes(hw_params), err); + snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", + substream, params_buffer_bytes(hw_params), err); return err; } return 0; @@ -795,15 +807,15 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream, /* * free the buffer */ -static int snd_usX2Y_pcm_hw_free(snd_pcm_substream_t *substream) +static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usX2Y_substream *subs = runtime->private_data; down(&subs->usX2Y->prepare_mutex); snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { - snd_usX2Y_substream_t *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; + struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; atomic_set(&subs->state, state_STOPPED); usX2Y_urbs_release(subs); if (!cap_subs->pcm_substream || @@ -814,7 +826,7 @@ static int snd_usX2Y_pcm_hw_free(snd_pcm_substream_t *substream) usX2Y_urbs_release(cap_subs); } } else { - snd_usX2Y_substream_t *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; + struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; if (atomic_read(&playback_subs->state) < state_PREPARED) { atomic_set(&subs->state, state_STOPPED); usX2Y_urbs_release(subs); @@ -828,12 +840,12 @@ static int snd_usX2Y_pcm_hw_free(snd_pcm_substream_t *substream) * * set format and initialize urbs */ -static int snd_usX2Y_pcm_prepare(snd_pcm_substream_t *substream) +static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; - usX2Ydev_t *usX2Y = subs->usX2Y; - snd_usX2Y_substream_t *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usX2Y_substream *subs = runtime->private_data; + struct usX2Ydev *usX2Y = subs->usX2Y; + struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; int err = 0; snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); @@ -861,7 +873,7 @@ static int snd_usX2Y_pcm_prepare(snd_pcm_substream_t *substream) return err; } -static snd_pcm_hardware_t snd_usX2Y_2c = +static struct snd_pcm_hardware snd_usX2Y_2c = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -882,11 +894,11 @@ static snd_pcm_hardware_t snd_usX2Y_2c = -static int snd_usX2Y_pcm_open(snd_pcm_substream_t *substream) +static int snd_usX2Y_pcm_open(struct snd_pcm_substream *substream) { - snd_usX2Y_substream_t *subs = ((snd_usX2Y_substream_t **) + struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **) snd_pcm_substream_chip(substream))[substream->stream]; - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; if (subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) return -EBUSY; @@ -900,19 +912,18 @@ static int snd_usX2Y_pcm_open(snd_pcm_substream_t *substream) -static int snd_usX2Y_pcm_close(snd_pcm_substream_t *substream) +static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; - int err = 0; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usX2Y_substream *subs = runtime->private_data; subs->pcm_substream = NULL; - return err; + return 0; } -static snd_pcm_ops_t snd_usX2Y_pcm_ops = +static struct snd_pcm_ops snd_usX2Y_pcm_ops = { .open = snd_usX2Y_pcm_open, .close = snd_usX2Y_pcm_close, @@ -928,7 +939,7 @@ static snd_pcm_ops_t snd_usX2Y_pcm_ops = /* * free a usb stream instance */ -static void usX2Y_audio_stream_free(snd_usX2Y_substream_t **usX2Y_substream) +static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream) { if (NULL != usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]) { kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]); @@ -938,25 +949,23 @@ static void usX2Y_audio_stream_free(snd_usX2Y_substream_t **usX2Y_substream) usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL; } -static void snd_usX2Y_pcm_private_free(snd_pcm_t *pcm) +static void snd_usX2Y_pcm_private_free(struct snd_pcm *pcm) { - snd_usX2Y_substream_t **usX2Y_stream = pcm->private_data; - if (usX2Y_stream) { - snd_pcm_lib_preallocate_free_for_all(pcm); + struct snd_usX2Y_substream **usX2Y_stream = pcm->private_data; + if (usX2Y_stream) usX2Y_audio_stream_free(usX2Y_stream); - } } -static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int capture_endpoint) +static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err, i; - snd_usX2Y_substream_t **usX2Y_substream = + struct snd_usX2Y_substream **usX2Y_substream = usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs; for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { - usX2Y_substream[i] = kzalloc(sizeof(snd_usX2Y_substream_t), GFP_KERNEL); + usX2Y_substream[i] = kzalloc(sizeof(struct snd_usX2Y_substream), GFP_KERNEL); if (NULL == usX2Y_substream[i]) { snd_printk(KERN_ERR "cannot malloc\n"); return -ENOMEM; @@ -1006,7 +1015,7 @@ static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int c /* * create a chip instance and set its names. */ -int usX2Y_audio_create(snd_card_t* card) +int usX2Y_audio_create(struct snd_card *card) { int err = 0; diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index c9136a9..796a7dce 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c @@ -58,12 +58,12 @@ #include <sound/hwdep.h> -static int usX2Y_usbpcm_urb_capt_retire(snd_usX2Y_substream_t *subs) +static int usX2Y_usbpcm_urb_capt_retire(struct snd_usX2Y_substream *subs) { struct urb *urb = subs->completed_urb; - snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; int i, lens = 0, hwptr_done = subs->hwptr_done; - usX2Ydev_t *usX2Y = subs->usX2Y; + struct usX2Ydev *usX2Y = subs->usX2Y; if (0 > usX2Y->hwdep_pcm_shm->capture_iso_start) { //FIXME int head = usX2Y->hwdep_pcm_shm->captured_iso_head + 1; if (head >= ARRAY_SIZE(usX2Y->hwdep_pcm_shm->captured_iso)) @@ -90,7 +90,8 @@ static int usX2Y_usbpcm_urb_capt_retire(snd_usX2Y_substream_t *subs) return 0; } -static inline int usX2Y_iso_frames_per_buffer(snd_pcm_runtime_t *runtime, usX2Ydev_t * usX2Y) +static inline int usX2Y_iso_frames_per_buffer(struct snd_pcm_runtime *runtime, + struct usX2Ydev * usX2Y) { return (runtime->buffer_size * 1000) / usX2Y->rate + 1; //FIXME: so far only correct period_size == 2^x ? } @@ -105,13 +106,13 @@ static inline int usX2Y_iso_frames_per_buffer(snd_pcm_runtime_t *runtime, usX2Yd * it directly from the buffer. thus the data is once copied to * a temporary buffer and urb points to that. */ -static int usX2Y_hwdep_urb_play_prepare(snd_usX2Y_substream_t *subs, - struct urb *urb) +static int usX2Y_hwdep_urb_play_prepare(struct snd_usX2Y_substream *subs, + struct urb *urb) { int count, counts, pack; - usX2Ydev_t *usX2Y = subs->usX2Y; + struct usX2Ydev *usX2Y = subs->usX2Y; struct snd_usX2Y_hwdep_pcm_shm *shm = usX2Y->hwdep_pcm_shm; - snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; if (0 > shm->playback_iso_start) { shm->playback_iso_start = shm->captured_iso_head - @@ -144,13 +145,14 @@ static int usX2Y_hwdep_urb_play_prepare(snd_usX2Y_substream_t *subs, } -static inline void usX2Y_usbpcm_urb_capt_iso_advance(snd_usX2Y_substream_t *subs, struct urb *urb) +static inline void usX2Y_usbpcm_urb_capt_iso_advance(struct snd_usX2Y_substream *subs, + struct urb *urb) { int pack; for (pack = 0; pack < nr_of_packs(); ++pack) { struct usb_iso_packet_descriptor *desc = urb->iso_frame_desc + pack; if (NULL != subs) { - snd_usX2Y_hwdep_pcm_shm_t *shm = subs->usX2Y->hwdep_pcm_shm; + struct snd_usX2Y_hwdep_pcm_shm *shm = subs->usX2Y->hwdep_pcm_shm; int head = shm->captured_iso_head + 1; if (head >= ARRAY_SIZE(shm->captured_iso)) head = 0; @@ -166,9 +168,10 @@ static inline void usX2Y_usbpcm_urb_capt_iso_advance(snd_usX2Y_substream_t *subs } } -static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, - snd_usX2Y_substream_t *capsubs2, - snd_usX2Y_substream_t *playbacksubs, int frame) +static inline int usX2Y_usbpcm_usbframe_complete(struct snd_usX2Y_substream *capsubs, + struct snd_usX2Y_substream *capsubs2, + struct snd_usX2Y_substream *playbacksubs, + int frame) { int err, state; struct urb *urb = playbacksubs->completed_urb; @@ -177,10 +180,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, if (NULL != urb) { if (state == state_RUNNING) usX2Y_urb_play_retire(playbacksubs, urb); - else - if (state >= state_PRERUNNING) { - atomic_inc(&playbacksubs->state); - } + else if (state >= state_PRERUNNING) + atomic_inc(&playbacksubs->state); } else { switch (state) { case state_STARTING1: @@ -207,10 +208,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, if (state == state_RUNNING) { if ((err = usX2Y_usbpcm_urb_capt_retire(capsubs))) return err; - } else { - if (state >= state_PRERUNNING) - atomic_inc(&capsubs->state); - } + } else if (state >= state_PRERUNNING) + atomic_inc(&capsubs->state); usX2Y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb); if (NULL != capsubs2) usX2Y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb); @@ -229,12 +228,15 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs) { - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; - usX2Ydev_t *usX2Y = subs->usX2Y; - snd_usX2Y_substream_t *capsubs, *capsubs2, *playbacksubs; + struct snd_usX2Y_substream *subs = urb->context; + struct usX2Ydev *usX2Y = subs->usX2Y; + struct snd_usX2Y_substream *capsubs, *capsubs2, *playbacksubs; if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { - 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); + 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); return; } if (unlikely(urb->status)) { @@ -268,7 +270,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs) } -static void usX2Y_hwdep_urb_release(struct urb** urb) +static void usX2Y_hwdep_urb_release(struct urb **urb) { usb_kill_urb(*urb); usb_free_urb(*urb); @@ -278,7 +280,7 @@ static void usX2Y_hwdep_urb_release(struct urb** urb) /* * release a substream */ -static void usX2Y_usbpcm_urbs_release(snd_usX2Y_substream_t *subs) +static void usX2Y_usbpcm_urbs_release(struct snd_usX2Y_substream *subs) { int i; snd_printdd("snd_usX2Y_urbs_release() %i\n", subs->endpoint); @@ -286,7 +288,7 @@ static void usX2Y_usbpcm_urbs_release(snd_usX2Y_substream_t *subs) usX2Y_hwdep_urb_release(subs->urb + i); } -static void usX2Y_usbpcm_subs_startup_finish(usX2Ydev_t * usX2Y) +static void usX2Y_usbpcm_subs_startup_finish(struct usX2Ydev * usX2Y) { usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_urb_complete); usX2Y->prepare_subs = NULL; @@ -294,14 +296,14 @@ static void usX2Y_usbpcm_subs_startup_finish(usX2Ydev_t * usX2Y) static void i_usX2Y_usbpcm_subs_startup(struct urb *urb, struct pt_regs *regs) { - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; - usX2Ydev_t *usX2Y = subs->usX2Y; - snd_usX2Y_substream_t *prepare_subs = usX2Y->prepare_subs; + struct snd_usX2Y_substream *subs = urb->context; + struct usX2Ydev *usX2Y = subs->usX2Y; + struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs; if (NULL != prepare_subs && urb->start_frame == prepare_subs->urb[0]->start_frame) { atomic_inc(&prepare_subs->state); if (prepare_subs == usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]) { - snd_usX2Y_substream_t *cap_subs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; + struct snd_usX2Y_substream *cap_subs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; if (cap_subs2 != NULL) atomic_inc(&cap_subs2->state); } @@ -315,7 +317,7 @@ static void i_usX2Y_usbpcm_subs_startup(struct urb *urb, struct pt_regs *regs) /* * initialize a substream's urbs */ -static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs) +static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) { int i; unsigned int pipe; @@ -330,7 +332,7 @@ static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs) /* allocate and initialize data urbs */ for (i = 0; i < NRURBS; i++) { - struct urb** purb = subs->urb + i; + struct urb **purb = subs->urb + i; if (*purb) { usb_kill_urb(*purb); continue; @@ -359,16 +361,16 @@ static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs) /* * free the buffer */ -static int snd_usX2Y_usbpcm_hw_free(snd_pcm_substream_t *substream) +static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data, + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usX2Y_substream *subs = runtime->private_data, *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; down(&subs->usX2Y->prepare_mutex); snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream); if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { - snd_usX2Y_substream_t *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; + struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; atomic_set(&subs->state, state_STOPPED); usX2Y_usbpcm_urbs_release(subs); if (!cap_subs->pcm_substream || @@ -383,7 +385,7 @@ static int snd_usX2Y_usbpcm_hw_free(snd_pcm_substream_t *substream) usX2Y_usbpcm_urbs_release(cap_subs2); } } else { - snd_usX2Y_substream_t *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; + struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; if (atomic_read(&playback_subs->state) < state_PREPARED) { atomic_set(&subs->state, state_STOPPED); if (NULL != cap_subs2) @@ -397,20 +399,20 @@ static int snd_usX2Y_usbpcm_hw_free(snd_pcm_substream_t *substream) return snd_pcm_lib_free_pages(substream); } -static void usX2Y_usbpcm_subs_startup(snd_usX2Y_substream_t *subs) +static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs) { - usX2Ydev_t * usX2Y = subs->usX2Y; + struct usX2Ydev * usX2Y = subs->usX2Y; usX2Y->prepare_subs = subs; subs->urb[0]->start_frame = -1; smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup() usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); } -static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs) +static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) { int p, u, err, stream = subs->pcm_substream->stream; - usX2Ydev_t *usX2Y = subs->usX2Y; + struct usX2Ydev *usX2Y = subs->usX2Y; if (SNDRV_PCM_STREAM_CAPTURE == stream) { usX2Y->hwdep_pcm_shm->captured_iso_head = -1; @@ -418,7 +420,7 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs) } for (p = 0; 3 >= (stream + p); p += 2) { - snd_usX2Y_substream_t *subs = usX2Y->subs[stream + p]; + struct snd_usX2Y_substream *subs = usX2Y->subs[stream + p]; if (subs != NULL) { if ((err = usX2Y_usbpcm_urbs_allocate(subs)) < 0) return err; @@ -427,7 +429,7 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs) } for (p = 0; p < 4; p++) { - snd_usX2Y_substream_t *subs = usX2Y->subs[p]; + struct snd_usX2Y_substream *subs = usX2Y->subs[p]; if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) goto start; } @@ -437,7 +439,7 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs) usX2Y_usbpcm_subs_startup(subs); for (u = 0; u < NRURBS; u++) { for (p = 0; 3 >= (stream + p); p += 2) { - snd_usX2Y_substream_t *subs = usX2Y->subs[stream + p]; + struct snd_usX2Y_substream *subs = usX2Y->subs[stream + p]; if (subs != NULL) { struct urb *urb = subs->urb[u]; if (usb_pipein(urb->pipe)) { @@ -486,19 +488,19 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs) * * set format and initialize urbs */ -static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) +static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; - usX2Ydev_t *usX2Y = subs->usX2Y; - snd_usX2Y_substream_t *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usX2Y_substream *subs = runtime->private_data; + struct usX2Ydev *usX2Y = subs->usX2Y; + struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; int err = 0; snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); if (NULL == usX2Y->hwdep_pcm_shm) { - if (NULL == (usX2Y->hwdep_pcm_shm = snd_malloc_pages(sizeof(snd_usX2Y_hwdep_pcm_shm_t), GFP_KERNEL))) + if (NULL == (usX2Y->hwdep_pcm_shm = snd_malloc_pages(sizeof(struct snd_usX2Y_hwdep_pcm_shm), GFP_KERNEL))) return -ENOMEM; - memset(usX2Y->hwdep_pcm_shm, 0, sizeof(snd_usX2Y_hwdep_pcm_shm_t)); + memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); } down(&usX2Y->prepare_mutex); @@ -512,7 +514,8 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) if (usX2Y->rate != runtime->rate) if ((err = usX2Y_rate_set(usX2Y, runtime->rate)) < 0) goto up_prepare_mutex; - snd_printdd("starting capture pipe for %s\n", subs == capsubs ? "self" : "playpipe"); + snd_printdd("starting capture pipe for %s\n", subs == capsubs ? + "self" : "playpipe"); if (0 > (err = usX2Y_usbpcm_urbs_start(capsubs))) goto up_prepare_mutex; } @@ -520,8 +523,12 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) if (subs != capsubs) { usX2Y->hwdep_pcm_shm->playback_iso_start = -1; if (atomic_read(&subs->state) < state_PREPARED) { - while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { - snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); + while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > + usX2Y->hwdep_pcm_shm->captured_iso_frames) { + snd_printdd("Wait: iso_frames_per_buffer=%i," + "captured_iso_frames=%i\n", + usX2Y_iso_frames_per_buffer(runtime, usX2Y), + usX2Y->hwdep_pcm_shm->captured_iso_frames); if (msleep_interruptible(10)) { err = -ERESTARTSYS; goto up_prepare_mutex; @@ -530,7 +537,9 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) if (0 > (err = usX2Y_usbpcm_urbs_start(subs))) goto up_prepare_mutex; } - snd_printd("Ready: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); + snd_printdd("Ready: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", + usX2Y_iso_frames_per_buffer(runtime, usX2Y), + usX2Y->hwdep_pcm_shm->captured_iso_frames); } else usX2Y->hwdep_pcm_shm->capture_iso_start = -1; @@ -539,7 +548,7 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) return err; } -static snd_pcm_hardware_t snd_usX2Y_4c = +static struct snd_pcm_hardware snd_usX2Y_4c = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -560,11 +569,11 @@ static snd_pcm_hardware_t snd_usX2Y_4c = -static int snd_usX2Y_usbpcm_open(snd_pcm_substream_t *substream) +static int snd_usX2Y_usbpcm_open(struct snd_pcm_substream *substream) { - snd_usX2Y_substream_t *subs = ((snd_usX2Y_substream_t **) + struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **) snd_pcm_substream_chip(substream))[substream->stream]; - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; if (!(subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS)) return -EBUSY; @@ -578,18 +587,17 @@ static int snd_usX2Y_usbpcm_open(snd_pcm_substream_t *substream) } -static int snd_usX2Y_usbpcm_close(snd_pcm_substream_t *substream) +static int snd_usX2Y_usbpcm_close(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; - int err = 0; - snd_printd("\n"); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_usX2Y_substream *subs = runtime->private_data; + subs->pcm_substream = NULL; - return err; + return 0; } -static snd_pcm_ops_t snd_usX2Y_usbpcm_ops = +static struct snd_pcm_ops snd_usX2Y_usbpcm_ops = { .open = snd_usX2Y_usbpcm_open, .close = snd_usX2Y_usbpcm_close, @@ -602,11 +610,11 @@ static snd_pcm_ops_t snd_usX2Y_usbpcm_ops = }; -static int usX2Y_pcms_lock_check(snd_card_t *card) +static int usX2Y_pcms_lock_check(struct snd_card *card) { struct list_head *list; - snd_device_t *dev; - snd_pcm_t *pcm; + struct snd_device *dev; + struct snd_pcm *pcm; int err = 0; list_for_each(list, &card->devices) { dev = snd_device(list); @@ -622,7 +630,7 @@ static int usX2Y_pcms_lock_check(snd_card_t *card) continue; pcm = dev->device_data; for (s = 0; s < 2; ++s) { - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; substream = pcm->streams[s].substream; if (substream && substream->ffile != NULL) err = -EBUSY; @@ -632,11 +640,11 @@ static int usX2Y_pcms_lock_check(snd_card_t *card) } -static void usX2Y_pcms_unlock(snd_card_t *card) +static void usX2Y_pcms_unlock(struct snd_card *card) { struct list_head *list; - snd_device_t *dev; - snd_pcm_t *pcm; + struct snd_device *dev; + struct snd_pcm *pcm; list_for_each(list, &card->devices) { dev = snd_device(list); if (dev->type != SNDRV_DEV_PCM) @@ -647,10 +655,10 @@ static void usX2Y_pcms_unlock(snd_card_t *card) } -static int snd_usX2Y_hwdep_pcm_open(snd_hwdep_t *hw, struct file *file) +static int snd_usX2Y_hwdep_pcm_open(struct snd_hwdep *hw, struct file *file) { // we need to be the first - snd_card_t *card = hw->card; + struct snd_card *card = hw->card; int err = usX2Y_pcms_lock_check(card); if (0 == err) usX2Y(card)->chip_status |= USX2Y_STAT_CHIP_MMAP_PCM_URBS; @@ -659,9 +667,9 @@ static int snd_usX2Y_hwdep_pcm_open(snd_hwdep_t *hw, struct file *file) } -static int snd_usX2Y_hwdep_pcm_release(snd_hwdep_t *hw, struct file *file) +static int snd_usX2Y_hwdep_pcm_release(struct snd_hwdep *hw, struct file *file) { - snd_card_t *card = hw->card; + struct snd_card *card = hw->card; int err = usX2Y_pcms_lock_check(card); if (0 == err) usX2Y(hw->card)->chip_status &= ~USX2Y_STAT_CHIP_MMAP_PCM_URBS; @@ -689,7 +697,7 @@ static struct page * snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area, offset = area->vm_pgoff << PAGE_SHIFT; offset += address - area->vm_start; snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); - vaddr = (char*)((usX2Ydev_t*)area->vm_private_data)->hwdep_pcm_shm + offset; + vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->hwdep_pcm_shm + offset; page = virt_to_page(vaddr); get_page(page); @@ -707,17 +715,17 @@ static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { }; -static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) +static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) { unsigned long size = (unsigned long)(area->vm_end - area->vm_start); - usX2Ydev_t *usX2Y = (usX2Ydev_t*)hw->private_data; + struct usX2Ydev *usX2Y = hw->private_data; - if (!(((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT)) + if (!(usX2Y->chip_status & USX2Y_STAT_CHIP_INIT)) return -EBUSY; /* if userspace tries to mmap beyond end of our buffer, fail */ - if (size > PAGE_ALIGN(sizeof(snd_usX2Y_hwdep_pcm_shm_t))) { - snd_printd("%lu > %lu\n", size, (unsigned long)sizeof(snd_usX2Y_hwdep_pcm_shm_t)); + if (size > PAGE_ALIGN(sizeof(struct snd_usX2Y_hwdep_pcm_shm))) { + snd_printd("%lu > %lu\n", size, (unsigned long)sizeof(struct snd_usX2Y_hwdep_pcm_shm)); return -EINVAL; } @@ -726,39 +734,31 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct } area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; area->vm_flags |= VM_RESERVED; - snd_printd("vm_flags=0x%lX\n", area->vm_flags); area->vm_private_data = hw->private_data; return 0; } -static void snd_usX2Y_hwdep_pcm_private_free(snd_hwdep_t *hwdep) +static void snd_usX2Y_hwdep_pcm_private_free(struct snd_hwdep *hwdep) { - usX2Ydev_t *usX2Y = (usX2Ydev_t *)hwdep->private_data; + struct usX2Ydev *usX2Y = hwdep->private_data; if (NULL != usX2Y->hwdep_pcm_shm) - snd_free_pages(usX2Y->hwdep_pcm_shm, sizeof(snd_usX2Y_hwdep_pcm_shm_t)); + snd_free_pages(usX2Y->hwdep_pcm_shm, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); } -static void snd_usX2Y_usbpcm_private_free(snd_pcm_t *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - - -int usX2Y_hwdep_pcm_new(snd_card_t* card) +int usX2Y_hwdep_pcm_new(struct snd_card *card) { int err; - snd_hwdep_t *hw; - snd_pcm_t *pcm; + struct snd_hwdep *hw; + struct snd_pcm *pcm; struct usb_device *dev = usX2Y(card)->chip.dev; if (1 != nr_of_packs()) return 0; - if ((err = snd_hwdep_new(card, SND_USX2Y_USBPCM_ID, 1, &hw)) < 0) { - snd_printd("\n"); + if ((err = snd_hwdep_new(card, SND_USX2Y_USBPCM_ID, 1, &hw)) < 0) return err; - } + hw->iface = SNDRV_HWDEP_IFACE_USX2Y_PCM; hw->private_data = usX2Y(card); hw->private_free = snd_usX2Y_hwdep_pcm_private_free; @@ -776,7 +776,6 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usX2Y_usbpcm_ops); pcm->private_data = usX2Y(card)->subs; - pcm->private_free = snd_usX2Y_usbpcm_private_free; pcm->info_flags = 0; sprintf(pcm->name, NAME_ALLCAPS" hwdep Audio"); @@ -788,7 +787,6 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card) SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 64*1024, 128*1024))) { - snd_usX2Y_usbpcm_private_free(pcm); return err; } @@ -798,7 +796,7 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card) #else -int usX2Y_hwdep_pcm_new(snd_card_t* card) +int usX2Y_hwdep_pcm_new(struct snd_card *card) { return 0; } diff --git a/sound/usb/usx2y/usx2yhwdeppcm.h b/sound/usb/usx2y/usx2yhwdeppcm.h index d68f0cb..c3382fd 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.h +++ b/sound/usb/usx2y/usx2yhwdeppcm.h @@ -18,4 +18,3 @@ struct snd_usX2Y_hwdep_pcm_shm { volatile unsigned captured_iso_frames; int capture_iso_start; }; -typedef struct snd_usX2Y_hwdep_pcm_shm snd_usX2Y_hwdep_pcm_shm_t; |