Commit 1387c386 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update

D:2003/08/20 10:59:59
A:Jaroslav Kysela <perex@suse.cz>
F:usb/usbaudio.c:1.62->1.63 
F:usb/usbaudio.h:1.20->1.21 
F:usb/usbmixer.c:1.21->1.22 
L:Synced USB audio driver with the latest 2.6 code
parent 8e9106ba
......@@ -1057,7 +1057,7 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt)
int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK;
int err;
iface = &config->interface[fmt->iface];
iface = get_iface(config, fmt->iface);
alts = &iface->altsetting[fmt->altset_idx];
altsd = get_iface_desc(alts);
snd_assert(altsd->bAlternateSetting == fmt->altsetting, return -EINVAL);
......@@ -1182,7 +1182,7 @@ static int snd_usb_hw_params(snd_pcm_substream_t *substream,
struct usb_host_config *config = subs->dev->actconfig;
struct usb_host_interface *alts;
struct usb_interface *iface;
iface = &config->interface[fmt->iface];
iface = get_iface(config, fmt->iface);
alts = &iface->altsetting[fmt->altset_idx];
ret = init_usb_sample_rate(subs->dev, subs->interface, alts, fmt, rate);
if (ret < 0)
......@@ -2215,7 +2215,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
config = dev->actconfig;
/* parse the interface's altsettings */
iface = &config->interface[iface_no];
iface = get_iface(config, iface_no);
for (i = 0; i < iface->num_altsetting; i++) {
alts = &iface->altsetting[i];
altsd = get_iface_desc(alts);
......@@ -2386,7 +2386,7 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif)
/* find audiocontrol interface */
config = dev->actconfig;
host_iface = &config->interface[ctrlif].altsetting[0];
host_iface = &get_iface(config, ctrlif)->altsetting[0];
if (!(p1 = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen, NULL, HEADER))) {
snd_printk(KERN_ERR "cannot find HEADER\n");
return -EINVAL;
......@@ -2408,7 +2408,7 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif)
dev->devnum, ctrlif, j);
continue;
}
iface = &config->interface[j];
iface = get_iface(config, j);
if (usb_interface_claimed(iface)) {
snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", dev->devnum, ctrlif, j);
continue;
......@@ -2524,7 +2524,7 @@ static int create_composite_quirk(snd_usb_audio_t *chip,
for (quirk = quirk->data; quirk->ifnum >= 0; ++quirk) {
if (quirk->ifnum >= get_cfg_desc(config)->bNumInterfaces)
continue;
iface = &config->interface[quirk->ifnum];
iface = get_iface(config, quirk->ifnum);
if (quirk->ifnum != probed_ifnum &&
usb_interface_claimed(iface))
continue;
......@@ -2560,8 +2560,8 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac
err = usb_get_device_descriptor(dev);
config = dev->actconfig;
if (err < 0) snd_printdd("error usb_get_device_descriptor: %d\n", err);
err = usb_set_configuration(dev, get_cfg_desc(config)->bConfigurationValue);
if (err < 0) snd_printdd("error usb_set_configuration: %d\n", err);
err = usb_reset_configuration(dev);
if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err);
snd_printdd("extigy_boot: new boot length = %d\n", get_cfg_desc(config)->wTotalLength);
return -ENODEV; /* quit this anyway */
}
......@@ -2761,8 +2761,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
* now look for an empty slot and create a new card instance
*/
/* first, set the current configuration for this device */
if (usb_set_configuration(dev, get_cfg_desc(config)->bConfigurationValue) < 0) {
snd_printk(KERN_ERR "cannot set configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue);
if (usb_reset_configuration(dev) < 0) {
snd_printk(KERN_ERR "cannot reset configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue);
goto __error;
}
for (i = 0; i < SNDRV_CARDS; i++)
......
......@@ -210,6 +210,7 @@ void snd_usbmidi_disconnect(struct list_head *p, struct usb_driver *driver);
* (conditional for compatibility with the older API)
*/
#ifndef get_iface_desc
#define get_iface(cfg, num) ((cfg)->interface[(num)])
#define get_iface_desc(iface) (&iface->desc)
#define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc)
#define get_ep_desc(ep) (&(ep)->desc)
......
......@@ -1490,7 +1490,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
int err;
const struct usbmix_ctl_map *map;
struct usb_device_descriptor *dev = &chip->dev->descriptor;
struct usb_host_interface *hostif = &chip->dev->actconfig->interface[ctrlif].altsetting[0];
struct usb_host_interface *hostif = &get_iface(chip->dev->actconfig, ctrlif)->altsetting[0];
strcpy(chip->card->mixername, "USB Mixer");
......
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