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"
......
This diff is collapsed.
This diff is collapsed.
......@@ -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