Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp347893pxu; Thu, 7 Jan 2021 06:39:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDlwy3IU79E7U0IsL5DjLvY15dzB8tqKDcxROHiJ5aByJ/N7HW7AuOu6Q78wQFqZsw/GIr X-Received: by 2002:a17:906:a181:: with SMTP id s1mr6822755ejy.60.1610030348366; Thu, 07 Jan 2021 06:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610030348; cv=none; d=google.com; s=arc-20160816; b=zuDHWyxom8A+V7s0jt+H1IL4EiUV7/02m0iBRcOS2MKCYPx4gC3uEyjLNF/4aIeIb4 CXFeBvFNPu/GxVWTaqcJjhoIy4nFNnE3H4zlTW2/9Qq4KMuAsomULTee60Eotk2T73XN WfWswIrLyHs0dCoM/lOPLdwMUmHBGRHm7qXEci7+GZC5w2gmaXtAQz7oeI4YbQfwRaNE aTpqOnVEplLxMz3CAte+eyndonk5Avr4VyR+MZb452hs/pQu7/jBRtl0IbmCwT8vQLF4 ukFhtAwxQ+ie60kbQAl9lDKqhYrnabAz5RjrEyzd0FGjihGi+TXwoZVMgZAvJ/IUwLMg QzyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3oVLhJePMfM4fyY75SyGEVPh3iVKb1BQhxguq4r0fcU=; b=IZBEg2+CGhfFexZTHmiizRRrFzN/fhNYR5TY9jOrHQ5AjLoyNSJlrZBKI8uhVb8pQm YAmzCSATaLjsw4wa0eo0FHMUdciUVGWNNSpj6IeIRO7nnlw7qfVImutN5uE/ABoh7vmJ EeLU7LDDE5OfS7MLP3J/E23fqTZaARPbclelLIxOIP28HfmvKv/l2ADv5BL+DsjXpVhc hi7WHvICCpbVwXo68luGBbvguWr37yHJiVt31SiuQ7GHNkWdqEe+CZUSJ37sUuWONle5 oxXcGqMqtPc3o0WHh5UiZdb5pANjP4zxjEiiT92Ciek/yFlZtp4FL75wfDUVPGr5PzPZ s2vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tUStcHLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq18si2218813ejb.693.2021.01.07.06.38.45; Thu, 07 Jan 2021 06:39:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tUStcHLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729326AbhAGOgm (ORCPT + 99 others); Thu, 7 Jan 2021 09:36:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:46398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729287AbhAGOcT (ORCPT ); Thu, 7 Jan 2021 09:32:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D2F1233E2; Thu, 7 Jan 2021 14:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610029881; bh=bmG8cDKhmZ3Yu1LN9m5aZPQoMKQO1lvaFBzrdJo7uPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tUStcHLvizQdQRmZBW7jEXG1zVZj7xop7qWfPgJuW9BbzB1rqfyeMZjs/o3nd6MwE i8u2P9CU72MyBJY9m7yitrlDsEG6Oxfx154Peffdc4/UeP6G1No/uPOn0lC0TBAQq/ b91T9Ogl+JoShTuPvgQlLAoTwX6Rl7/H8oaVMnMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alberto Aguirre , Takashi Iwai , Sudip Mukherjee Subject: [PATCH 4.14 04/29] ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk Date: Thu, 7 Jan 2021 15:31:19 +0100 Message-Id: <20210107143053.539114711@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210107143052.973437064@linuxfoundation.org> References: <20210107143052.973437064@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alberto Aguirre commit 103e9625647ad74d201e26fb74afcd8479142a37 upstream Signed-off-by: Alberto Aguirre Signed-off-by: Takashi Iwai Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- sound/usb/pcm.c | 52 ++++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -324,6 +324,7 @@ static int set_sync_ep_implicit_fb_quirk struct usb_host_interface *alts; struct usb_interface *iface; unsigned int ep; + unsigned int ifnum; /* Implicit feedback sync EPs consumers are always playback EPs */ if (subs->direction != SNDRV_PCM_STREAM_PLAYBACK) @@ -334,44 +335,23 @@ static int set_sync_ep_implicit_fb_quirk case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */ ep = 0x81; - iface = usb_ifnum_to_if(dev, 3); - - if (!iface || iface->num_altsetting == 0) - return -EINVAL; - - alts = &iface->altsetting[1]; - goto add_sync_ep; - break; + ifnum = 3; + goto add_sync_ep_from_ifnum; case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */ case USB_ID(0x0763, 0x2081): ep = 0x81; - iface = usb_ifnum_to_if(dev, 2); - - if (!iface || iface->num_altsetting == 0) - return -EINVAL; - - alts = &iface->altsetting[1]; - goto add_sync_ep; - case USB_ID(0x2466, 0x8003): + ifnum = 2; + goto add_sync_ep_from_ifnum; + case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */ ep = 0x86; - iface = usb_ifnum_to_if(dev, 2); - - if (!iface || iface->num_altsetting == 0) - return -EINVAL; - - alts = &iface->altsetting[1]; - goto add_sync_ep; - case USB_ID(0x1397, 0x0002): + ifnum = 2; + goto add_sync_ep_from_ifnum; + case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ ep = 0x81; - iface = usb_ifnum_to_if(dev, 1); - - if (!iface || iface->num_altsetting == 0) - return -EINVAL; - - alts = &iface->altsetting[1]; - goto add_sync_ep; - + ifnum = 1; + goto add_sync_ep_from_ifnum; } + if (attr == USB_ENDPOINT_SYNC_ASYNC && altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && altsd->bInterfaceProtocol == 2 && @@ -386,6 +366,14 @@ static int set_sync_ep_implicit_fb_quirk /* No quirk */ return 0; +add_sync_ep_from_ifnum: + iface = usb_ifnum_to_if(dev, ifnum); + + if (!iface || iface->num_altsetting == 0) + return -EINVAL; + + alts = &iface->altsetting[1]; + add_sync_ep: subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip, alts, ep, !subs->direction,