aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2004-12-19 23:43:59 -0800
committerGreg Kroah-Hartman <greg@kroah.com>2004-12-19 23:43:59 -0800
commitb9efd2edd9c2523c6eac512c442197b87178d717 (patch)
treea9a297d07fe59c4309563ab3ea24b33640a20a38 /sound
parent596c4b84ebab15c9f6c97fedfc254c631ffb9d5f (diff)
downloadhistory-b9efd2edd9c2523c6eac512c442197b87178d717.tar.gz
USB: convert the idVendor, idProduct, bcdDevice and bcdUSB fields to __le16
These fields are in the struct usb_device_descriptor, and now we keep the native (on-the-wire mode) format of these fields. Any driver using these fields needs to convert it to cpu endian before using them. All USB drivers in the kernel tree have been fixed up to work properly with this change. All out-of-the USB kernel drivers are on their own... Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/usbaudio.c47
-rw-r--r--sound/usb/usbmidi.c6
-rw-r--r--sound/usb/usbmixer.c6
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c4
-rw-r--r--sound/usb/usx2y/usbusx2y.c11
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c4
6 files changed, 43 insertions, 35 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 37ec3346c3be34..9160f5c44948e6 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2176,13 +2176,13 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor
static int is_big_endian_format(struct usb_device *dev, struct audioformat *fp)
{
/* M-Audio */
- if (dev->descriptor.idVendor == 0x0763) {
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x0763) {
/* Quattro: captured data only */
- if (dev->descriptor.idProduct == 0x2001 &&
+ if (le16_to_cpu(dev->descriptor.idProduct) == 0x2001 &&
fp->endpoint & USB_DIR_IN)
return 1;
/* Audiophile USB */
- if (dev->descriptor.idProduct == 0x2003)
+ if (le16_to_cpu(dev->descriptor.idProduct) == 0x2003)
return 1;
}
return 0;
@@ -2246,7 +2246,8 @@ static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat
break;
case USB_AUDIO_FORMAT_PCM8:
/* Dallas DS4201 workaround */
- if (dev->descriptor.idVendor == 0x04fa && dev->descriptor.idProduct == 0x4201)
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x04fa &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x4201)
pcm_format = SNDRV_PCM_FORMAT_S8;
else
pcm_format = SNDRV_PCM_FORMAT_U8;
@@ -2414,7 +2415,8 @@ static int parse_audio_format(struct usb_device *dev, struct audioformat *fp,
/* extigy apparently supports sample rates other than 48k
* but not in ordinary way. so we enable only 48k atm.
*/
- if (dev->descriptor.idVendor == 0x041e && dev->descriptor.idProduct == 0x3000) {
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x041e &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x3000) {
if (fmt[3] == USB_FORMAT_TYPE_I &&
stream == SNDRV_PCM_STREAM_PLAYBACK &&
fp->rates != SNDRV_PCM_RATE_48000)
@@ -2517,8 +2519,8 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
/* some quirks for attributes here */
/* workaround for AudioTrak Optoplay */
- if (dev->descriptor.idVendor == 0x0a92 &&
- dev->descriptor.idProduct == 0x0053) {
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x0a92 &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x0053) {
/* Optoplay sets the sample rate attribute although
* it seems not supporting it in fact.
*/
@@ -2526,8 +2528,8 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
}
/* workaround for M-Audio Audiophile USB */
- if (dev->descriptor.idVendor == 0x0763 &&
- dev->descriptor.idProduct == 0x2003) {
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x0763 &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x2003) {
/* doesn't set the sample rate attribute, but supports it */
fp->attributes |= EP_CS_ATTR_SAMPLE_RATE;
}
@@ -2536,11 +2538,11 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
* plantronics headset and Griffin iMic have set adaptive-in
* although it's really not...
*/
- if ((dev->descriptor.idVendor == 0x047f &&
- dev->descriptor.idProduct == 0x0ca1) ||
+ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x047f &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x0ca1) ||
/* Griffin iMic (note that there is an older model 77d:223) */
- (dev->descriptor.idVendor == 0x077d &&
- dev->descriptor.idProduct == 0x07af)) {
+ (le16_to_cpu(dev->descriptor.idVendor) == 0x077d &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x07af)) {
fp->ep_attr &= ~EP_ATTR_MASK;
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
fp->ep_attr |= EP_ATTR_ADAPTIVE;
@@ -2788,7 +2790,7 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
.type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = &ua25_ep
};
- if (chip->dev->descriptor.idProduct == 0x002b)
+ if (le16_to_cpu(chip->dev->descriptor.idProduct) == 0x002b)
return snd_usb_create_midi_interface(chip, iface,
&ua700_quirk);
else
@@ -3000,7 +3002,9 @@ static void proc_audio_usbid_read(snd_info_entry_t *entry, snd_info_buffer_t *bu
{
snd_usb_audio_t *chip = entry->private_data;
if (! chip->shutdown)
- snd_iprintf(buffer, "%04x:%04x\n", chip->dev->descriptor.idVendor, chip->dev->descriptor.idProduct);
+ snd_iprintf(buffer, "%04x:%04x\n",
+ le16_to_cpu(chip->dev->descriptor.idVendor),
+ le16_to_cpu(chip->dev->descriptor.idProduct));
}
static void snd_usb_audio_create_proc(snd_usb_audio_t *chip)
@@ -3081,7 +3085,8 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
strcpy(card->driver, "USB-Audio");
sprintf(component, "USB%04x:%04x",
- dev->descriptor.idVendor, dev->descriptor.idProduct);
+ le16_to_cpu(dev->descriptor.idVendor),
+ le16_to_cpu(dev->descriptor.idProduct));
snd_component_add(card, component);
/* retrieve the device string as shortname */
@@ -3093,7 +3098,8 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
card->shortname, sizeof(card->shortname)) <= 0) {
/* no name available from anywhere, so use ID */
sprintf(card->shortname, "USB Device %#04x:%#04x",
- dev->descriptor.idVendor, dev->descriptor.idProduct);
+ le16_to_cpu(dev->descriptor.idVendor),
+ le16_to_cpu(dev->descriptor.idProduct));
}
}
@@ -3160,7 +3166,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
/* SB Extigy needs special boot-up sequence */
/* if more models come, this will go to the quirk list. */
- if (dev->descriptor.idVendor == 0x041e && dev->descriptor.idProduct == 0x3000) {
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x041e &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x3000) {
if (snd_usb_extigy_boot_quirk(dev, intf) < 0)
goto __err_val;
config = dev->actconfig;
@@ -3194,8 +3201,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
}
for (i = 0; i < SNDRV_CARDS; i++)
if (enable[i] && ! usb_chip[i] &&
- (vid[i] == -1 || vid[i] == dev->descriptor.idVendor) &&
- (pid[i] == -1 || pid[i] == dev->descriptor.idProduct)) {
+ (vid[i] == -1 || vid[i] == le16_to_cpu(dev->descriptor.idVendor)) &&
+ (pid[i] == -1 || pid[i] == le16_to_cpu(dev->descriptor.idProduct))) {
if (snd_usb_audio_create(dev, i, quirk, &chip) < 0) {
goto __error;
}
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 7851da4133587a..ea90667b057b61 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -521,7 +521,7 @@ static struct usb_endpoint_descriptor* snd_usbmidi_get_int_epd(snd_usb_midi_t* u
struct usb_host_interface *hostif;
struct usb_interface_descriptor* intfd;
- if (umidi->chip->dev->descriptor.idVendor != 0x0582)
+ if (le16_to_cpu(umidi->chip->dev->descriptor.idVendor) != 0x0582)
return NULL;
intf = umidi->iface;
if (!intf || intf->num_altsetting != 2)
@@ -839,8 +839,8 @@ static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi,
/* TODO: read port name from jack descriptor */
name_format = "%s MIDI %d";
- vendor = umidi->chip->dev->descriptor.idVendor;
- product = umidi->chip->dev->descriptor.idProduct;
+ vendor = le16_to_cpu(umidi->chip->dev->descriptor.idVendor);
+ product = le16_to_cpu(umidi->chip->dev->descriptor.idProduct);
for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_names); ++i) {
if (snd_usbmidi_port_names[i].vendor == vendor &&
snd_usbmidi_port_names[i].product == product &&
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 1d0aa0332403af..141aadcda849f9 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1490,12 +1490,12 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
state.buffer = hostif->extra;
state.buflen = hostif->extralen;
state.ctrlif = ctrlif;
- state.vendor = dev->idVendor;
- state.product = dev->idProduct;
+ state.vendor = le16_to_cpu(dev->idVendor);
+ state.product = le16_to_cpu(dev->idProduct);
/* check the mapping table */
for (map = usbmix_ctl_maps; map->vendor; map++) {
- if (map->vendor == dev->idVendor && map->product == dev->idProduct) {
+ if (map->vendor == le16_to_cpu(dev->idVendor) && map->product == le16_to_cpu(dev->idProduct)) {
state.map = map->map;
chip->ignore_ctl_error = map->ignore_ctl_error;
break;
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index e6717f3e1bfc2c..ece2917152870f 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -133,7 +133,7 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i
};
int id = -1;
- switch (((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct) {
+ switch (le16_to_cpu(((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct)) {
case USB_ID_US122:
id = USX2Y_TYPE_122;
break;
@@ -185,7 +185,7 @@ 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 = dev->descriptor.idProduct == USB_ID_US428 ? &quirk_2 : &quirk_1;
+ snd_usb_audio_quirk_t *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);
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index 82ecbf6025b05d..f6aec1d6e1d618 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -331,7 +331,8 @@ static snd_card_t* usX2Y_create_card(struct usb_device* device)
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
card->shortname,
- device->descriptor.idVendor, device->descriptor.idProduct,
+ le16_to_cpu(device->descriptor.idVendor),
+ le16_to_cpu(device->descriptor.idProduct),
0,//us428(card)->usbmidi.ifnum,
usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum
);
@@ -344,10 +345,10 @@ static void* usX2Y_usb_probe(struct usb_device* device, struct usb_interface *in
{
int err;
snd_card_t* card;
- if (device->descriptor.idVendor != 0x1604 ||
- (device->descriptor.idProduct != USB_ID_US122 &&
- device->descriptor.idProduct != USB_ID_US224 &&
- device->descriptor.idProduct != USB_ID_US428) ||
+ 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 &&
+ le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428) ||
!(card = usX2Y_create_card(device)))
return NULL;
if ((err = usX2Y_hwdep_new(card, device)) < 0 ||
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 75890061890168..85d6c527341792 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -1023,10 +1023,10 @@ int usX2Y_audio_create(snd_card_t* card)
if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8)))
return err;
- if (usX2Y(card)->chip.dev->descriptor.idProduct == USB_ID_US428)
+ if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) == USB_ID_US428)
if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA)))
return err;
- if (usX2Y(card)->chip.dev->descriptor.idProduct != USB_ID_US122)
+ if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) != USB_ID_US122)
err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122.
return err;
}