sound: usxxx: cleanup chip field

The chip field is no longer needed.  Move those of its fields that are
actually used to the device structure itself.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Clemens Ladisch 2009-11-16 12:26:30 +01:00 committed by Takashi Iwai
parent d82af9f9aa
commit a014bbadb5
7 changed files with 72 additions and 72 deletions

View File

@ -59,7 +59,7 @@ static int us122l_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_US122L, .type = QUIRK_MIDI_US122L,
.data = &quirk_data .data = &quirk_data
}; };
struct usb_device *dev = US122L(card)->chip.dev; struct usb_device *dev = US122L(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 1); struct usb_interface *iface = usb_ifnum_to_if(dev, 1);
return snd_usbmidi_create(card, iface, return snd_usbmidi_create(card, iface,
@ -81,7 +81,7 @@ static int us144_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_US122L, .type = QUIRK_MIDI_US122L,
.data = &quirk_data .data = &quirk_data
}; };
struct usb_device *dev = US122L(card)->chip.dev; struct usb_device *dev = US122L(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 0); struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
return snd_usbmidi_create(card, iface, return snd_usbmidi_create(card, iface,
@ -194,11 +194,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file)
if (!us122l->first) if (!us122l->first)
us122l->first = file; us122l->first = file;
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
iface = usb_ifnum_to_if(us122l->chip.dev, 0); iface = usb_ifnum_to_if(us122l->dev, 0);
usb_autopm_get_interface(iface); usb_autopm_get_interface(iface);
} }
iface = usb_ifnum_to_if(us122l->chip.dev, 1); iface = usb_ifnum_to_if(us122l->dev, 1);
usb_autopm_get_interface(iface); usb_autopm_get_interface(iface);
return 0; return 0;
} }
@ -209,11 +209,11 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file)
struct usb_interface *iface; struct usb_interface *iface;
snd_printdd(KERN_DEBUG "%p %p\n", hw, file); snd_printdd(KERN_DEBUG "%p %p\n", hw, file);
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
iface = usb_ifnum_to_if(us122l->chip.dev, 0); iface = usb_ifnum_to_if(us122l->dev, 0);
usb_autopm_put_interface(iface); usb_autopm_put_interface(iface);
} }
iface = usb_ifnum_to_if(us122l->chip.dev, 1); iface = usb_ifnum_to_if(us122l->dev, 1);
usb_autopm_put_interface(iface); usb_autopm_put_interface(iface);
if (us122l->first == file) if (us122l->first == file)
us122l->first = NULL; us122l->first = NULL;
@ -330,7 +330,7 @@ static bool us122l_start(struct us122l *us122l,
unsigned use_packsize = 0; unsigned use_packsize = 0;
bool success = false; bool success = false;
if (us122l->chip.dev->speed == USB_SPEED_HIGH) { if (us122l->dev->speed == USB_SPEED_HIGH) {
/* The us-122l's descriptor defaults to iso max_packsize 78, /* The us-122l's descriptor defaults to iso max_packsize 78,
which isn't needed for samplerates <= 48000. which isn't needed for samplerates <= 48000.
Lets save some memory: Lets save some memory:
@ -347,11 +347,11 @@ static bool us122l_start(struct us122l *us122l,
break; break;
} }
} }
if (!usb_stream_new(&us122l->sk, us122l->chip.dev, 1, 2, if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2,
rate, use_packsize, period_frames, 6)) rate, use_packsize, period_frames, 6))
goto out; goto out;
err = us122l_set_sample_rate(us122l->chip.dev, rate); err = us122l_set_sample_rate(us122l->dev, rate);
if (err < 0) { if (err < 0) {
us122l_stop(us122l); us122l_stop(us122l);
snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); snd_printk(KERN_ERR "us122l_set_sample_rate error \n");
@ -390,7 +390,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
err = -ENXIO; err = -ENXIO;
goto free; goto free;
} }
high_speed = us122l->chip.dev->speed == USB_SPEED_HIGH; high_speed = us122l->dev->speed == USB_SPEED_HIGH;
if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 &&
(!high_speed || (!high_speed ||
(cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) ||
@ -450,7 +450,7 @@ static int usb_stream_hwdep_new(struct snd_card *card)
{ {
int err; int err;
struct snd_hwdep *hw; struct snd_hwdep *hw;
struct usb_device *dev = US122L(card)->chip.dev; struct usb_device *dev = US122L(card)->dev;
err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw);
if (err < 0) if (err < 0)
@ -476,26 +476,26 @@ static bool us122l_create_card(struct snd_card *card)
int err; int err;
struct us122l *us122l = US122L(card); struct us122l *us122l = US122L(card);
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
err = usb_set_interface(us122l->chip.dev, 0, 1); err = usb_set_interface(us122l->dev, 0, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
return false; return false;
} }
} }
err = usb_set_interface(us122l->chip.dev, 1, 1); err = usb_set_interface(us122l->dev, 1, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
return false; return false;
} }
pt_info_set(us122l->chip.dev, 0x11); pt_info_set(us122l->dev, 0x11);
pt_info_set(us122l->chip.dev, 0x10); pt_info_set(us122l->dev, 0x10);
if (!us122l_start(us122l, 44100, 256)) if (!us122l_start(us122l, 44100, 256))
return false; return false;
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) if (us122l->dev->descriptor.idProduct == USB_ID_US144)
err = us144_create_usbmidi(card); err = us144_create_usbmidi(card);
else else
err = us122l_create_usbmidi(card); err = us122l_create_usbmidi(card);
@ -520,7 +520,7 @@ static bool us122l_create_card(struct snd_card *card)
static void snd_us122l_free(struct snd_card *card) static void snd_us122l_free(struct snd_card *card)
{ {
struct us122l *us122l = US122L(card); struct us122l *us122l = US122L(card);
int index = us122l->chip.index; int index = us122l->card_index;
if (index >= 0 && index < SNDRV_CARDS) if (index >= 0 && index < SNDRV_CARDS)
snd_us122l_card_used[index] = 0; snd_us122l_card_used[index] = 0;
} }
@ -540,10 +540,9 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
sizeof(struct us122l), &card); sizeof(struct us122l), &card);
if (err < 0) if (err < 0)
return err; return err;
snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; snd_us122l_card_used[US122L(card)->card_index = dev] = 1;
card->private_free = snd_us122l_free; card->private_free = snd_us122l_free;
US122L(card)->chip.dev = device; US122L(card)->dev = device;
US122L(card)->chip.card = card;
mutex_init(&US122L(card)->mutex); mutex_init(&US122L(card)->mutex);
init_waitqueue_head(&US122L(card)->sk.sleep); init_waitqueue_head(&US122L(card)->sk.sleep);
INIT_LIST_HEAD(&US122L(card)->midi_list); INIT_LIST_HEAD(&US122L(card)->midi_list);
@ -554,8 +553,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
le16_to_cpu(device->descriptor.idVendor), le16_to_cpu(device->descriptor.idVendor),
le16_to_cpu(device->descriptor.idProduct), le16_to_cpu(device->descriptor.idProduct),
0, 0,
US122L(card)->chip.dev->bus->busnum, US122L(card)->dev->bus->busnum,
US122L(card)->chip.dev->devnum US122L(card)->dev->devnum
); );
*cardp = card; *cardp = card;
return 0; return 0;
@ -635,16 +634,15 @@ static void snd_us122l_disconnect(struct usb_interface *intf)
mutex_lock(&us122l->mutex); mutex_lock(&us122l->mutex);
us122l_stop(us122l); us122l_stop(us122l);
mutex_unlock(&us122l->mutex); mutex_unlock(&us122l->mutex);
us122l->chip.shutdown = 1;
/* release the midi resources */ /* release the midi resources */
list_for_each(p, &us122l->midi_list) { list_for_each(p, &us122l->midi_list) {
snd_usbmidi_disconnect(p); snd_usbmidi_disconnect(p);
} }
usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); usb_put_intf(usb_ifnum_to_if(us122l->dev, 0));
usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); usb_put_intf(usb_ifnum_to_if(us122l->dev, 1));
usb_put_dev(us122l->chip.dev); usb_put_dev(us122l->dev);
while (atomic_read(&us122l->mmap_count)) while (atomic_read(&us122l->mmap_count))
msleep(500); msleep(500);
@ -694,23 +692,23 @@ static int snd_us122l_resume(struct usb_interface *intf)
mutex_lock(&us122l->mutex); mutex_lock(&us122l->mutex);
/* needed, doesn't restart without: */ /* needed, doesn't restart without: */
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
err = usb_set_interface(us122l->chip.dev, 0, 1); err = usb_set_interface(us122l->dev, 0, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
goto unlock; goto unlock;
} }
} }
err = usb_set_interface(us122l->chip.dev, 1, 1); err = usb_set_interface(us122l->dev, 1, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
goto unlock; goto unlock;
} }
pt_info_set(us122l->chip.dev, 0x11); pt_info_set(us122l->dev, 0x11);
pt_info_set(us122l->chip.dev, 0x10); pt_info_set(us122l->dev, 0x10);
err = us122l_set_sample_rate(us122l->chip.dev, err = us122l_set_sample_rate(us122l->dev,
us122l->sk.s->cfg.sample_rate); us122l->sk.s->cfg.sample_rate);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); snd_printk(KERN_ERR "us122l_set_sample_rate error \n");

View File

@ -3,7 +3,8 @@
struct us122l { struct us122l {
struct snd_usb_audio chip; struct usb_device *dev;
int card_index;
int stride; int stride;
struct usb_stream_kernel sk; struct usb_stream_kernel sk;

View File

@ -114,7 +114,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
struct usX2Ydev *us428 = hw->private_data; struct usX2Ydev *us428 = hw->private_data;
int id = -1; int id = -1;
switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { switch (le16_to_cpu(us428->dev->descriptor.idProduct)) {
case USB_ID_US122: case USB_ID_US122:
id = USX2Y_TYPE_122; id = USX2Y_TYPE_122;
break; break;
@ -164,7 +164,7 @@ static int usX2Y_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_FIXED_ENDPOINT, .type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = &quirk_data_2 .data = &quirk_data_2
}; };
struct usb_device *dev = usX2Y(card)->chip.dev; struct usb_device *dev = usX2Y(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 0); struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
struct snd_usb_audio_quirk *quirk = struct snd_usb_audio_quirk *quirk =
le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ?
@ -202,7 +202,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
snd_printdd( "dsp_load %s\n", dsp->name); snd_printdd( "dsp_load %s\n", dsp->name);
if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { if (access_ok(VERIFY_READ, dsp->image, dsp->length)) {
struct usb_device* dev = priv->chip.dev; struct usb_device* dev = priv->dev;
char *buf; char *buf;
buf = memdup_user(dsp->image, dsp->length); buf = memdup_user(dsp->image, dsp->length);

View File

@ -239,8 +239,8 @@ static void i_usX2Y_In04Int(struct urb *urb)
for (j = 0; j < URBS_AsyncSeq && !err; ++j) for (j = 0; j < URBS_AsyncSeq && !err; ++j)
if (0 == usX2Y->AS04.urb[j]->status) { if (0 == usX2Y->AS04.urb[j]->status) {
struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost.
usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->dev,
usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol,
p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5,
i_usX2Y_Out04Int, usX2Y); i_usX2Y_Out04Int, usX2Y);
err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC);
@ -253,7 +253,7 @@ static void i_usX2Y_In04Int(struct urb *urb)
if (err) if (err)
snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err);
urb->dev = usX2Y->chip.dev; urb->dev = usX2Y->dev;
usb_submit_urb(urb, GFP_ATOMIC); usb_submit_urb(urb, GFP_ATOMIC);
} }
@ -273,8 +273,8 @@ int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y)
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->chip.dev, usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->dev,
usb_sndbulkpipe(usX2Y->chip.dev, 0x04), usb_sndbulkpipe(usX2Y->dev, 0x04),
usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0,
i_usX2Y_Out04Int, usX2Y i_usX2Y_Out04Int, usX2Y
); );
@ -293,7 +293,7 @@ int usX2Y_In04_init(struct usX2Ydev *usX2Y)
} }
init_waitqueue_head(&usX2Y->In04WaitQueue); init_waitqueue_head(&usX2Y->In04WaitQueue);
usb_fill_int_urb(usX2Y->In04urb, usX2Y->chip.dev, usb_rcvintpipe(usX2Y->chip.dev, 0x4), usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4),
usX2Y->In04Buf, 21, usX2Y->In04Buf, 21,
i_usX2Y_In04Int, usX2Y, i_usX2Y_In04Int, usX2Y,
10); 10);
@ -348,10 +348,9 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp)
sizeof(struct usX2Ydev), &card); sizeof(struct usX2Ydev), &card);
if (err < 0) if (err < 0)
return err; return err;
snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1;
card->private_free = snd_usX2Y_card_private_free; card->private_free = snd_usX2Y_card_private_free;
usX2Y(card)->chip.dev = device; usX2Y(card)->dev = device;
usX2Y(card)->chip.card = card;
init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); init_waitqueue_head(&usX2Y(card)->prepare_wait_queue);
mutex_init(&usX2Y(card)->prepare_mutex); mutex_init(&usX2Y(card)->prepare_mutex);
INIT_LIST_HEAD(&usX2Y(card)->midi_list); INIT_LIST_HEAD(&usX2Y(card)->midi_list);
@ -362,7 +361,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp)
le16_to_cpu(device->descriptor.idVendor), le16_to_cpu(device->descriptor.idVendor),
le16_to_cpu(device->descriptor.idProduct), le16_to_cpu(device->descriptor.idProduct),
0,//us428(card)->usbmidi.ifnum, 0,//us428(card)->usbmidi.ifnum,
usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum usX2Y(card)->dev->bus->busnum, usX2Y(card)->dev->devnum
); );
*cardp = card; *cardp = card;
return 0; return 0;
@ -432,8 +431,8 @@ static void snd_usX2Y_card_private_free(struct snd_card *card)
usb_free_urb(usX2Y(card)->In04urb); usb_free_urb(usX2Y(card)->In04urb);
if (usX2Y(card)->us428ctls_sharedmem) if (usX2Y(card)->us428ctls_sharedmem)
snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem)); snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem));
if (usX2Y(card)->chip.index >= 0 && usX2Y(card)->chip.index < SNDRV_CARDS) if (usX2Y(card)->card_index >= 0 && usX2Y(card)->card_index < SNDRV_CARDS)
snd_usX2Y_card_used[usX2Y(card)->chip.index] = 0; snd_usX2Y_card_used[usX2Y(card)->card_index] = 0;
} }
/* /*
@ -445,7 +444,6 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr)
struct snd_card *card = ptr; struct snd_card *card = ptr;
struct usX2Ydev *usX2Y = usX2Y(card); struct usX2Ydev *usX2Y = usX2Y(card);
struct list_head *p; struct list_head *p;
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);

View File

@ -22,7 +22,8 @@ struct snd_usX2Y_urbSeq {
#include "usx2yhwdeppcm.h" #include "usx2yhwdeppcm.h"
struct usX2Ydev { struct usX2Ydev {
struct snd_usb_audio chip; struct usb_device *dev;
int card_index;
int stride; int stride;
struct urb *In04urb; struct urb *In04urb;
void *In04Buf; void *In04Buf;
@ -43,6 +44,8 @@ struct usX2Ydev {
struct snd_usX2Y_substream * volatile prepare_subs; struct snd_usX2Y_substream * volatile prepare_subs;
wait_queue_head_t prepare_wait_queue; wait_queue_head_t prepare_wait_queue;
struct list_head midi_list; struct list_head midi_list;
struct list_head pcm_list;
int pcm_devs;
}; };

View File

@ -199,7 +199,7 @@ static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, i
return -ENODEV; return -ENODEV;
urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks
urb->hcpriv = NULL; urb->hcpriv = NULL;
urb->dev = subs->usX2Y->chip.dev; /* we need to set this at each time */ urb->dev = subs->usX2Y->dev; /* we need to set this at each time */
if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err);
return err; return err;
@ -300,7 +300,7 @@ static void usX2Y_error_sequence(struct usX2Ydev *usX2Y,
"Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n"
"Most propably some urb of usb-frame %i is still missing.\n" "Most propably some urb of usb-frame %i is still missing.\n"
"Cause could be too long delays in usb-hcd interrupt handling.\n", "Cause could be too long delays in usb-hcd interrupt handling.\n",
usb_get_current_frame_number(usX2Y->chip.dev), usb_get_current_frame_number(usX2Y->dev),
subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame);
usX2Y_clients_stop(usX2Y); usX2Y_clients_stop(usX2Y);
@ -313,7 +313,7 @@ static void i_usX2Y_urb_complete(struct urb *urb)
if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { if (unlikely(atomic_read(&subs->state) < state_PREPARED)) {
snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
usb_get_current_frame_number(usX2Y->chip.dev), usb_get_current_frame_number(usX2Y->dev),
subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
urb->status, urb->start_frame); urb->status, urb->start_frame);
return; return;
@ -424,7 +424,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs)
int i; int i;
unsigned int pipe; unsigned int pipe;
int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
struct usb_device *dev = subs->usX2Y->chip.dev; struct usb_device *dev = subs->usX2Y->dev;
pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) :
usb_rcvisocpipe(dev, subs->endpoint); usb_rcvisocpipe(dev, subs->endpoint);
@ -500,7 +500,7 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
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->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;
@ -692,7 +692,7 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
} }
((char*)(usbdata + i))[0] = ra[i].c1; ((char*)(usbdata + i))[0] = ra[i].c1;
((char*)(usbdata + i))[1] = ra[i].c2; ((char*)(usbdata + i))[1] = ra[i].c2;
usb_fill_bulk_urb(us->urb[i], usX2Y->chip.dev, usb_sndbulkpipe(usX2Y->chip.dev, 4), usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4),
usbdata + i, 2, i_usX2Y_04Int, usX2Y); usbdata + i, 2, i_usX2Y_04Int, usX2Y);
#ifdef OLD_USB #ifdef OLD_USB
us->urb[i]->transfer_flags = USB_QUEUE_BULK; us->urb[i]->transfer_flags = USB_QUEUE_BULK;
@ -744,11 +744,11 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format)
snd_usbmidi_input_stop(p); snd_usbmidi_input_stop(p);
} }
usb_kill_urb(usX2Y->In04urb); usb_kill_urb(usX2Y->In04urb);
if ((err = usb_set_interface(usX2Y->chip.dev, 0, alternate))) { if ((err = usb_set_interface(usX2Y->dev, 0, alternate))) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
return err; return err;
} }
usX2Y->In04urb->dev = usX2Y->chip.dev; usX2Y->In04urb->dev = usX2Y->dev;
err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
list_for_each(p, &usX2Y->midi_list) { list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_input_start(p); snd_usbmidi_input_start(p);
@ -955,7 +955,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err, i; int err, i;
struct snd_usX2Y_substream **usX2Y_substream = struct snd_usX2Y_substream **usX2Y_substream =
usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs; usX2Y(card)->subs + 2 * usX2Y(card)->pcm_devs;
for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { i <= SNDRV_PCM_STREAM_CAPTURE; ++i) {
@ -971,7 +971,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint;
usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint;
err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->chip.pcm_devs, err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->pcm_devs,
playback_endpoint ? 1 : 0, 1, playback_endpoint ? 1 : 0, 1,
&pcm); &pcm);
if (err < 0) { if (err < 0) {
@ -987,7 +987,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
pcm->private_free = snd_usX2Y_pcm_private_free; pcm->private_free = snd_usX2Y_pcm_private_free;
pcm->info_flags = 0; pcm->info_flags = 0;
sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->chip.pcm_devs); sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs);
if ((playback_endpoint && if ((playback_endpoint &&
0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
@ -1001,7 +1001,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
snd_usX2Y_pcm_private_free(pcm); snd_usX2Y_pcm_private_free(pcm);
return err; return err;
} }
usX2Y(card)->chip.pcm_devs++; usX2Y(card)->pcm_devs++;
return 0; return 0;
} }
@ -1013,14 +1013,14 @@ int usX2Y_audio_create(struct snd_card *card)
{ {
int err = 0; int err = 0;
INIT_LIST_HEAD(&usX2Y(card)->chip.pcm_list); INIT_LIST_HEAD(&usX2Y(card)->pcm_list);
if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8)))
return err; return err;
if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) == USB_ID_US428) if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428)
if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA)))
return err; return err;
if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) != USB_ID_US122) if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122)
err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122.
return err; return err;
} }

View File

@ -234,7 +234,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { if (unlikely(atomic_read(&subs->state) < state_PREPARED)) {
snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
usb_get_current_frame_number(usX2Y->chip.dev), usb_get_current_frame_number(usX2Y->dev),
subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
urb->status, urb->start_frame); urb->status, urb->start_frame);
return; return;
@ -318,7 +318,7 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs)
int i; int i;
unsigned int pipe; unsigned int pipe;
int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
struct usb_device *dev = subs->usX2Y->chip.dev; struct usb_device *dev = subs->usX2Y->dev;
pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) :
usb_rcvisocpipe(dev, subs->endpoint); usb_rcvisocpipe(dev, subs->endpoint);
@ -441,7 +441,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
unsigned long pack; unsigned long pack;
if (0 == u) if (0 == u)
atomic_set(&subs->state, state_STARTING3); atomic_set(&subs->state, state_STARTING3);
urb->dev = usX2Y->chip.dev; urb->dev = usX2Y->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 + u * nr_of_packs()); urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs());
@ -741,7 +741,7 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card)
int err; int err;
struct snd_hwdep *hw; struct snd_hwdep *hw;
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct usb_device *dev = usX2Y(card)->chip.dev; struct usb_device *dev = usX2Y(card)->dev;
if (1 != nr_of_packs()) if (1 != nr_of_packs())
return 0; return 0;