Commit bbe85bbd authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: USB-USX2Y

Modules: USB USX2Y

Remove xxx_t typedefs from the USB-USX2Y driver.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 86e07d34
......@@ -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,10 +64,10 @@ 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 = 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.
......@@ -75,16 +75,16 @@ static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_are
return -EBUSY;
/* if userspace tries to mmap beyond end of our buffer, fail */
if (size > PAGE_ALIGN(sizeof(us428ctls_sharedmem_t))) {
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 = 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,24 +110,25 @@ 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",
};
usX2Ydev_t *us428 = hw->private_data;
struct usX2Ydev *us428 = hw->private_data;
int id = -1;
switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) {
......@@ -145,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 (us428->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,
......@@ -182,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;
......@@ -208,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);
......@@ -257,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;
......
#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
......@@ -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;
......@@ -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,7 +283,7 @@ int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y)
return err;
}
int usX2Y_In04_init(usX2Ydev_t* usX2Y)
int usX2Y_In04_init(struct usX2Ydev *usX2Y)
{
if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL)))
return -ENOMEM;
......@@ -301,7 +301,7 @@ int usX2Y_In04_init(usX2Ydev_t* usX2Y)
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) {
......@@ -334,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;
......@@ -367,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 &&
......@@ -414,7 +414,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);
......@@ -427,11 +427,11 @@ 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) {
snd_card_t *card = ptr;
usX2Ydev_t* usX2Y = usX2Y(card);
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;
......
......@@ -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"
......
......@@ -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,7 +208,9 @@ 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;
......@@ -211,9 +219,8 @@ static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_us
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:
......@@ -228,8 +235,9 @@ static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_us
}
if (urb) {
if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) ||
(err = usX2Y_urb_submit(playbacksubs, urb, frame)))
(err = usX2Y_urb_submit(playbacksubs, urb, frame))) {
return err;
}
}
playbacksubs->completed_urb = NULL;
......@@ -249,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);
......@@ -268,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);
}
}
}
......@@ -276,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)) {
......@@ -313,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
......@@ -331,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];
......@@ -345,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;
......@@ -353,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);
......@@ -366,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;
......@@ -376,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);
......@@ -389,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;
......@@ -402,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;
......@@ -452,25 +473,25 @@ 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;
}
......@@ -521,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:
......@@ -642,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);
......@@ -652,10 +673,10 @@ 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;
......@@ -714,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;
......@@ -744,27 +765,27 @@ 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_card_t *card = substream->pstr->pcm->card;
struct list_head *list;
struct snd_card *card = substream->pstr->pcm->card;
struct list_head *list;
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) {
snd_device_t *dev;
snd_pcm_t *pcm;
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) {
snd_pcm_substream_t *test_substream;
struct snd_pcm_substream *test_substream;
test_substream = pcm->streams[s].substream;
if (test_substream && test_substream != substream &&
test_substream->runtime &&
......@@ -776,7 +797,8 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream,
}
}
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;
......@@ -785,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 ||
......@@ -804,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);
......@@ -818,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);
......@@ -851,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 |
......@@ -872,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;
......@@ -890,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,
......@@ -918,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]);
......@@ -928,23 +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;
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;
......@@ -994,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;
......
......@@ -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;
......@@ -225,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)) {
......@@ -264,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);
......@@ -274,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);
......@@ -282,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;
......@@ -290,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);
}
......@@ -311,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;
......@@ -355,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 ||
......@@ -379,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)
......@@ -393,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;
......@@ -414,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;
......@@ -423,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;
}
......@@ -433,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)) {
......@@ -482,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);
......@@ -508,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;
}
......@@ -516,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;
......@@ -526,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;
......@@ -535,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 |
......@@ -556,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;
......@@ -574,17 +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;
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_usX2Y_substream *subs = runtime->private_data;
subs->pcm_substream = NULL;
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,
......@@ -597,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);
......@@ -617,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;
......@@ -627,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)
......@@ -642,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;
......@@ -654,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;
......@@ -684,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);
......@@ -702,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 = hw->private_data;
struct usX2Ydev *usX2Y = hw->private_data;
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,19 +739,19 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct
}
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 = 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));
}
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;
......@@ -783,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;
}
......
......@@ -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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment