Commit df23a2466a4961092625b487ead60f526e401062

Authored by Eldad Zack
Committed by Takashi Iwai
1 parent 06613f547a

ALSA: usb-audio: rename alt_idx to altsetting

As Clemens Ladisch kindly explained:
 "Please note that there are two methods to identify alternate settings:
  the number, which is the value in bAlternateSetting, and the index,
  which is the index in the descriptor array.  There might be some wording
  in the USB spec that these two values must be the same, but in reality,
  [insert standard rant about firmware writers], bAlternateSetting
  must be treated as a random ID value."

This patch changes the name to express the correct usage semantics.
No functional change.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 3 changed files with 7 additions and 7 deletions Side-by-side Diff

... ... @@ -96,7 +96,7 @@
96 96 unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */
97 97 unsigned char silence_value;
98 98 unsigned int stride;
99   - int iface, alt_idx;
  99 + int iface, altsetting;
100 100 int skip_packets; /* quirks for devices to ignore the first n packets
101 101 in a stream */
102 102  
sound/usb/endpoint.c
... ... @@ -426,9 +426,9 @@
426 426 list_for_each_entry(ep, &chip->ep_list, list) {
427 427 if (ep->ep_num == ep_num &&
428 428 ep->iface == alts->desc.bInterfaceNumber &&
429   - ep->alt_idx == alts->desc.bAlternateSetting) {
  429 + ep->altsetting == alts->desc.bAlternateSetting) {
430 430 snd_printdd(KERN_DEBUG "Re-using EP %x in iface %d,%d @%p\n",
431   - ep_num, ep->iface, ep->alt_idx, ep);
  431 + ep_num, ep->iface, ep->altsetting, ep);
432 432 goto __exit_unlock;
433 433 }
434 434 }
... ... @@ -447,7 +447,7 @@
447 447 ep->type = type;
448 448 ep->ep_num = ep_num;
449 449 ep->iface = alts->desc.bInterfaceNumber;
450   - ep->alt_idx = alts->desc.bAlternateSetting;
  450 + ep->altsetting = alts->desc.bAlternateSetting;
451 451 INIT_LIST_HEAD(&ep->ready_playback_urbs);
452 452 ep_num &= USB_ENDPOINT_NUMBER_MASK;
453 453  
... ... @@ -241,17 +241,17 @@
241 241 struct snd_usb_endpoint *ep = subs->sync_endpoint;
242 242  
243 243 if (subs->data_endpoint->iface != subs->sync_endpoint->iface ||
244   - subs->data_endpoint->alt_idx != subs->sync_endpoint->alt_idx) {
  244 + subs->data_endpoint->altsetting != subs->sync_endpoint->altsetting) {
245 245 err = usb_set_interface(subs->dev,
246 246 subs->sync_endpoint->iface,
247   - subs->sync_endpoint->alt_idx);
  247 + subs->sync_endpoint->altsetting);
248 248 if (err < 0) {
249 249 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags);
250 250 snd_printk(KERN_ERR
251 251 "%d:%d:%d: cannot set interface (%d)\n",
252 252 subs->dev->devnum,
253 253 subs->sync_endpoint->iface,
254   - subs->sync_endpoint->alt_idx, err);
  254 + subs->sync_endpoint->altsetting, err);
255 255 return -EIO;
256 256 }
257 257 }