Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk

Signed-off-by: Alberto Aguirre <albaguirre@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Alberto Aguirre and committed by
Takashi Iwai
103e9625 c99c5a3b

+20 -32
+20 -32
sound/usb/pcm.c
··· 321 321 struct usb_host_interface *alts; 322 322 struct usb_interface *iface; 323 323 unsigned int ep; 324 + unsigned int ifnum; 324 325 325 326 /* Implicit feedback sync EPs consumers are always playback EPs */ 326 327 if (subs->direction != SNDRV_PCM_STREAM_PLAYBACK) ··· 331 330 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ 332 331 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ 333 332 ep = 0x81; 334 - iface = usb_ifnum_to_if(dev, 3); 335 - 336 - if (!iface || iface->num_altsetting == 0) 337 - return -EINVAL; 338 - 339 - alts = &iface->altsetting[1]; 340 - goto add_sync_ep; 341 - break; 333 + ifnum = 3; 334 + goto add_sync_ep_from_ifnum; 342 335 case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */ 343 336 case USB_ID(0x0763, 0x2081): 344 337 ep = 0x81; 345 - iface = usb_ifnum_to_if(dev, 2); 346 - 347 - if (!iface || iface->num_altsetting == 0) 348 - return -EINVAL; 349 - 350 - alts = &iface->altsetting[1]; 351 - goto add_sync_ep; 352 - case USB_ID(0x2466, 0x8003): 338 + ifnum = 2; 339 + goto add_sync_ep_from_ifnum; 340 + case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */ 353 341 ep = 0x86; 354 - iface = usb_ifnum_to_if(dev, 2); 355 - 356 - if (!iface || iface->num_altsetting == 0) 357 - return -EINVAL; 358 - 359 - alts = &iface->altsetting[1]; 360 - goto add_sync_ep; 361 - case USB_ID(0x1397, 0x0002): 342 + ifnum = 2; 343 + goto add_sync_ep_from_ifnum; 344 + case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ 362 345 ep = 0x81; 363 - iface = usb_ifnum_to_if(dev, 1); 364 - 365 - if (!iface || iface->num_altsetting == 0) 366 - return -EINVAL; 367 - 368 - alts = &iface->altsetting[1]; 369 - goto add_sync_ep; 370 - 346 + ifnum = 1; 347 + goto add_sync_ep_from_ifnum; 371 348 } 349 + 372 350 if (attr == USB_ENDPOINT_SYNC_ASYNC && 373 351 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && 374 352 altsd->bInterfaceProtocol == 2 && ··· 361 381 362 382 /* No quirk */ 363 383 return 0; 384 + 385 + add_sync_ep_from_ifnum: 386 + iface = usb_ifnum_to_if(dev, ifnum); 387 + 388 + if (!iface || iface->num_altsetting == 0) 389 + return -EINVAL; 390 + 391 + alts = &iface->altsetting[1]; 364 392 365 393 add_sync_ep: 366 394 subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip,