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

[ALSA] usx2y - Code clean up

Modules: USB USX2Y

Clean up snd-usb-usx2y driver code:

- Avoid unnecessary cast
- Fix spaces/indents
- Use kzalloc()
- Remove weird debug prints
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9fd9156c
...@@ -67,15 +67,15 @@ static struct vm_operations_struct us428ctls_vm_ops = { ...@@ -67,15 +67,15 @@ static struct vm_operations_struct us428ctls_vm_ops = {
static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area)
{ {
unsigned long size = (unsigned long)(area->vm_end - area->vm_start); unsigned long size = (unsigned long)(area->vm_end - area->vm_start);
usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; usX2Ydev_t *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? // 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. // 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; return -EBUSY;
/* if userspace tries to mmap beyond end of our buffer, fail */ /* if userspace tries to mmap beyond end of our buffer, fail */
if (size > ((PAGE_SIZE - 1 + sizeof(us428ctls_sharedmem_t)) / PAGE_SIZE) * PAGE_SIZE) { if (size > PAGE_ALIGN(sizeof(us428ctls_sharedmem_t))) {
snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t)); snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t));
return -EINVAL; return -EINVAL;
} }
...@@ -96,7 +96,7 @@ static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_are ...@@ -96,7 +96,7 @@ static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_are
static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait) static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait)
{ {
unsigned int mask = 0; unsigned int mask = 0;
usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; usX2Ydev_t *us428 = hw->private_data;
us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem; us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem;
if (us428->chip_status & USX2Y_STAT_CHIP_HUP) if (us428->chip_status & USX2Y_STAT_CHIP_HUP)
return POLLHUP; return POLLHUP;
...@@ -127,9 +127,10 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i ...@@ -127,9 +127,10 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i
[USX2Y_TYPE_224] = "us224", [USX2Y_TYPE_224] = "us224",
[USX2Y_TYPE_428] = "us428", [USX2Y_TYPE_428] = "us428",
}; };
usX2Ydev_t *us428 = hw->private_data;
int id = -1; 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: case USB_ID_US122:
id = USX2Y_TYPE_122; id = USX2Y_TYPE_122;
break; break;
...@@ -144,7 +145,7 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i ...@@ -144,7 +145,7 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i
return -ENODEV; return -ENODEV;
strcpy(info->id, type_ids[id]); strcpy(info->id, type_ids[id]);
info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code 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->chip_ready = 1;
info->version = USX2Y_DRIVER_VERSION; info->version = USX2Y_DRIVER_VERSION;
return 0; return 0;
......
...@@ -285,7 +285,6 @@ int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y) ...@@ -285,7 +285,6 @@ int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y)
int usX2Y_In04_init(usX2Ydev_t* usX2Y) int usX2Y_In04_init(usX2Ydev_t* usX2Y)
{ {
int err = 0;
if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL))) if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
...@@ -299,8 +298,7 @@ int usX2Y_In04_init(usX2Ydev_t* usX2Y) ...@@ -299,8 +298,7 @@ int usX2Y_In04_init(usX2Ydev_t* usX2Y)
usX2Y->In04Buf, 21, usX2Y->In04Buf, 21,
i_usX2Y_In04Int, usX2Y, i_usX2Y_In04Int, usX2Y,
10); 10);
err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); return usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
return err;
} }
static void usX2Y_unlinkSeq(snd_usX2Y_AsyncSeq_t* S) static void usX2Y_unlinkSeq(snd_usX2Y_AsyncSeq_t* S)
...@@ -432,20 +430,21 @@ static void snd_usX2Y_card_private_free(snd_card_t *card) ...@@ -432,20 +430,21 @@ static void snd_usX2Y_card_private_free(snd_card_t *card)
static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr) static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr)
{ {
if (ptr) { if (ptr) {
usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr); snd_card_t *card = ptr;
struct list_head* p; usX2Ydev_t* usX2Y = usX2Y(card);
struct list_head *p;
usX2Y->chip.shutdown = 1; usX2Y->chip.shutdown = 1;
usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; usX2Y->chip_status = USX2Y_STAT_CHIP_HUP;
usX2Y_unlinkSeq(&usX2Y->AS04); usX2Y_unlinkSeq(&usX2Y->AS04);
usb_kill_urb(usX2Y->In04urb); usb_kill_urb(usX2Y->In04urb);
snd_card_disconnect((snd_card_t*)ptr); snd_card_disconnect(card);
/* release the midi resources */ /* release the midi resources */
list_for_each(p, &usX2Y->chip.midi_list) { list_for_each(p, &usX2Y->chip.midi_list) {
snd_usbmidi_disconnect(p); snd_usbmidi_disconnect(p);
} }
if (usX2Y->us428ctls_sharedmem) if (usX2Y->us428ctls_sharedmem)
wake_up(&usX2Y->us428ctls_wait_queue_head); wake_up(&usX2Y->us428ctls_wait_queue_head);
snd_card_free((snd_card_t*)ptr); snd_card_free(card);
} }
} }
......
...@@ -205,47 +205,42 @@ static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int fr ...@@ -205,47 +205,42 @@ static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int fr
static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_usX2Y_substream_t *playbacksubs, int frame) static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_usX2Y_substream_t *playbacksubs, int frame)
{ {
int err, state; int err, state;
{ struct urb *urb = playbacksubs->completed_urb;
struct urb *urb = playbacksubs->completed_urb;
state = atomic_read(&playbacksubs->state);
state = atomic_read(&playbacksubs->state); if (NULL != urb) {
if (NULL != urb) { if (state == state_RUNNING)
if (state == state_RUNNING) usX2Y_urb_play_retire(playbacksubs, urb);
usX2Y_urb_play_retire(playbacksubs, urb); else
else if (state >= state_PRERUNNING)
if (state >= state_PRERUNNING) {
atomic_inc(&playbacksubs->state);
}
} else {
switch (state) {
case state_STARTING1:
urb = playbacksubs->urb[0];
atomic_inc(&playbacksubs->state); atomic_inc(&playbacksubs->state);
break; } else {
case state_STARTING2: switch (state) {
urb = playbacksubs->urb[1]; case state_STARTING1:
atomic_inc(&playbacksubs->state); urb = playbacksubs->urb[0];
break; atomic_inc(&playbacksubs->state);
} break;
} case state_STARTING2:
if (urb) { urb = playbacksubs->urb[1];
if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || atomic_inc(&playbacksubs->state);
(err = usX2Y_urb_submit(playbacksubs, urb, frame))) { break;
return err;
}
} }
playbacksubs->completed_urb = NULL;
} }
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;
state = atomic_read(&capsubs->state); state = atomic_read(&capsubs->state);
if (state >= state_PREPARED) { if (state >= state_PREPARED) {
if (state == state_RUNNING) { if (state == state_RUNNING) {
if ((err = usX2Y_urb_capt_retire(capsubs))) if ((err = usX2Y_urb_capt_retire(capsubs)))
return err; return err;
} else } else if (state >= state_PRERUNNING)
if (state >= state_PRERUNNING) { atomic_inc(&capsubs->state);
atomic_inc(&capsubs->state);
}
if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame)))
return err; return err;
} }
...@@ -429,7 +424,7 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs) ...@@ -429,7 +424,7 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs)
} }
/* allocate and initialize data urbs */ /* allocate and initialize data urbs */
for (i = 0; i < NRURBS; i++) { for (i = 0; i < NRURBS; i++) {
struct urb** purb = subs->urb + i; struct urb **purb = subs->urb + i;
if (*purb) { if (*purb) {
usb_kill_urb(*purb); usb_kill_urb(*purb);
continue; continue;
...@@ -480,47 +475,45 @@ static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs) ...@@ -480,47 +475,45 @@ static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs)
goto start; goto start;
} }
usX2Y->wait_iso_frame = -1; usX2Y->wait_iso_frame = -1;
start: start:
{ usX2Y_subs_startup(subs);
usX2Y_subs_startup(subs); for (i = 0; i < NRURBS; i++) {
for (i = 0; i < NRURBS; i++) { struct urb *urb = subs->urb[i];
struct urb *urb = subs->urb[i]; if (usb_pipein(urb->pipe)) {
if (usb_pipein(urb->pipe)) { unsigned long pack;
unsigned long pack; if (0 == i)
if (0 == i) atomic_set(&subs->state, state_STARTING3);
atomic_set(&subs->state, state_STARTING3); urb->dev = usX2Y->chip.dev;
urb->dev = usX2Y->chip.dev; urb->transfer_flags = URB_ISO_ASAP;
urb->transfer_flags = URB_ISO_ASAP; for (pack = 0; pack < nr_of_packs(); pack++) {
for (pack = 0; pack < nr_of_packs(); pack++) { urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack;
urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; urb->iso_frame_desc[pack].length = subs->maxpacksize;
urb->iso_frame_desc[pack].length = subs->maxpacksize; }
} urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs();
urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); err = -EPIPE;
err = -EPIPE; goto cleanup;
goto cleanup;
} else {
if (0 > usX2Y->wait_iso_frame)
usX2Y->wait_iso_frame = urb->start_frame;
}
urb->transfer_flags = 0;
} else { } else {
atomic_set(&subs->state, state_STARTING1); if (0 > usX2Y->wait_iso_frame)
break; 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); err = 0;
if (atomic_read(&subs->state) != state_PREPARED) { wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs);
err = -EPIPE; if (atomic_read(&subs->state) != state_PREPARED)
} err = -EPIPE;
cleanup: cleanup:
if (err) { if (err) {
usX2Y_subs_startup_finish(usX2Y); usX2Y_subs_startup_finish(usX2Y);
usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything
}
} }
return err; return err;
} }
...@@ -667,13 +660,12 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) ...@@ -667,13 +660,12 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate)
struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100;
if (usX2Y->rate != rate) { 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) { if (NULL == us) {
err = -ENOMEM; err = -ENOMEM;
goto cleanup; 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) { if (NULL == usbdata) {
err = -ENOMEM; err = -ENOMEM;
goto cleanup; goto cleanup;
...@@ -713,9 +705,8 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) ...@@ -713,9 +705,8 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate)
usX2Y->US04 = NULL; usX2Y->US04 = NULL;
kfree(usbdata); kfree(usbdata);
kfree(us); kfree(us);
if (!err) { if (!err)
usX2Y->rate = rate; usX2Y->rate = rate;
}
} }
} }
...@@ -759,30 +750,29 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream, ...@@ -759,30 +750,29 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream,
int err = 0; int err = 0;
unsigned int rate = params_rate(hw_params); unsigned int rate = params_rate(hw_params);
snd_pcm_format_t format = params_format(hw_params); snd_pcm_format_t format = params_format(hw_params);
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
snd_card_t *card = substream->pstr->pcm->card; snd_card_t *card = substream->pstr->pcm->card;
struct list_head *list; struct list_head *list;
list_for_each(list, &card->devices) {
snd_device_t *dev; snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params);
snd_pcm_t *pcm; // all pcm substreams off one usX2Y have to operate at the same rate & format
int s; list_for_each(list, &card->devices) {
dev = snd_device(list); snd_device_t *dev;
if (dev->type != SNDRV_DEV_PCM) snd_pcm_t *pcm;
continue; int s;
pcm = dev->device_data; dev = snd_device(list);
for (s = 0; s < 2; ++s) { if (dev->type != SNDRV_DEV_PCM)
snd_pcm_substream_t *test_substream; continue;
test_substream = pcm->streams[s].substream; pcm = dev->device_data;
if (test_substream && test_substream != substream && for (s = 0; s < 2; ++s) {
test_substream->runtime && snd_pcm_substream_t *test_substream;
((test_substream->runtime->format && test_substream = pcm->streams[s].substream;
test_substream->runtime->format != format) || if (test_substream && test_substream != substream &&
(test_substream->runtime->rate && test_substream->runtime &&
test_substream->runtime->rate != rate))) ((test_substream->runtime->format &&
return -EINVAL; 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)))) { if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) {
......
...@@ -177,10 +177,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, ...@@ -177,10 +177,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs,
if (NULL != urb) { if (NULL != urb) {
if (state == state_RUNNING) if (state == state_RUNNING)
usX2Y_urb_play_retire(playbacksubs, urb); usX2Y_urb_play_retire(playbacksubs, urb);
else else if (state >= state_PRERUNNING)
if (state >= state_PRERUNNING) { atomic_inc(&playbacksubs->state);
atomic_inc(&playbacksubs->state);
}
} else { } else {
switch (state) { switch (state) {
case state_STARTING1: case state_STARTING1:
...@@ -207,10 +205,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, ...@@ -207,10 +205,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs,
if (state == state_RUNNING) { if (state == state_RUNNING) {
if ((err = usX2Y_usbpcm_urb_capt_retire(capsubs))) if ((err = usX2Y_usbpcm_urb_capt_retire(capsubs)))
return err; return err;
} else { } else if (state >= state_PRERUNNING)
if (state >= state_PRERUNNING) atomic_inc(&capsubs->state);
atomic_inc(&capsubs->state);
}
usX2Y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb); usX2Y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb);
if (NULL != capsubs2) if (NULL != capsubs2)
usX2Y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb); usX2Y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb);
...@@ -330,7 +326,7 @@ static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs) ...@@ -330,7 +326,7 @@ static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs)
/* allocate and initialize data urbs */ /* allocate and initialize data urbs */
for (i = 0; i < NRURBS; i++) { for (i = 0; i < NRURBS; i++) {
struct urb** purb = subs->urb + i; struct urb **purb = subs->urb + i;
if (*purb) { if (*purb) {
usb_kill_urb(*purb); usb_kill_urb(*purb);
continue; continue;
...@@ -582,10 +578,9 @@ static int snd_usX2Y_usbpcm_close(snd_pcm_substream_t *substream) ...@@ -582,10 +578,9 @@ static int snd_usX2Y_usbpcm_close(snd_pcm_substream_t *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_runtime_t *runtime = substream->runtime;
snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data;
int err = 0;
snd_printd("\n");
subs->pcm_substream = NULL; subs->pcm_substream = NULL;
return err; return 0;
} }
...@@ -710,9 +705,9 @@ static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { ...@@ -710,9 +705,9 @@ 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(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area)
{ {
unsigned long size = (unsigned long)(area->vm_end - area->vm_start); unsigned long size = (unsigned long)(area->vm_end - area->vm_start);
usX2Ydev_t *usX2Y = (usX2Ydev_t*)hw->private_data; usX2Ydev_t *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; return -EBUSY;
/* if userspace tries to mmap beyond end of our buffer, fail */ /* if userspace tries to mmap beyond end of our buffer, fail */
...@@ -726,7 +721,6 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct ...@@ -726,7 +721,6 @@ 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_ops = &snd_usX2Y_hwdep_pcm_vm_ops;
area->vm_flags |= VM_RESERVED; area->vm_flags |= VM_RESERVED;
snd_printd("vm_flags=0x%lX\n", area->vm_flags);
area->vm_private_data = hw->private_data; area->vm_private_data = hw->private_data;
return 0; return 0;
} }
...@@ -734,7 +728,7 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct ...@@ -734,7 +728,7 @@ 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(snd_hwdep_t *hwdep)
{ {
usX2Ydev_t *usX2Y = (usX2Ydev_t *)hwdep->private_data; usX2Ydev_t *usX2Y = hwdep->private_data;
if (NULL != usX2Y->hwdep_pcm_shm) 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(snd_usX2Y_hwdep_pcm_shm_t));
} }
...@@ -749,10 +743,9 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card) ...@@ -749,10 +743,9 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card)
if (1 != nr_of_packs()) if (1 != nr_of_packs())
return 0; return 0;
if ((err = snd_hwdep_new(card, SND_USX2Y_USBPCM_ID, 1, &hw)) < 0) { if ((err = snd_hwdep_new(card, SND_USX2Y_USBPCM_ID, 1, &hw)) < 0)
snd_printd("\n");
return err; return err;
}
hw->iface = SNDRV_HWDEP_IFACE_USX2Y_PCM; hw->iface = SNDRV_HWDEP_IFACE_USX2Y_PCM;
hw->private_data = usX2Y(card); hw->private_data = usX2Y(card);
hw->private_free = snd_usX2Y_hwdep_pcm_private_free; hw->private_free = snd_usX2Y_hwdep_pcm_private_free;
......
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