From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F01ED2DE1E2; Tue, 12 Aug 2025 17:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755021333; cv=none; b=oXk6CSRX3ffnStWmu1Ila8ZM1yOrJLss421vEgFL2KcZTM5+SFO4DepyaRSGXbIddIZS6rNfnKsdi11bWtakj9g/Z2kLP5fUrr/tm8aeodtzztTuIWAfJZV03bzkXIHG8Qs/YbqyYA5uADKndp2DCxSrWM5GjftxjyhOWlLU384= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755021333; c=relaxed/simple; bh=OQF2IZIs9VrOS3Ro2dQaMltZdxgwfXUMZoxZ3HVtOnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UjpPqFvys6ic2sS5WgNcYhSvpNInMeTW8SQAmBC2IEVAqq+myUoTTCIwzbWe3xPYI8tI+RAxK4z2DfvqwXV87SXclBhBYpyI5DXb+z/EzC2CpzaWQZdToUolCQ9mdC8ix85+qekBnDUOLZfeqertSbiPK+wCg+1krtovkLMQ2LA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BtksfO7o; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BtksfO7o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0462CC4CEF1; Tue, 12 Aug 2025 17:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755021332; bh=OQF2IZIs9VrOS3Ro2dQaMltZdxgwfXUMZoxZ3HVtOnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtksfO7owPWr17pahZDDGnpEj3rAkWbvGQBLfI/zpuuww152X/fcaIkvrq1hpbb+M 79YXfKWYoAKT0SM4xjDcZyW+wnMVMNcUsrbYnrlwZ+gBjt/QfDfRrME5P2cmA57LaL LfZ/4dPa5lFhsrmcAhAf7L8cAjYXe74qhCDTD5Ho= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Geoffrey D. Bennett" , Takashi Iwai Subject: [PATCH 6.1 249/253] ALSA: scarlett2: Add retry on -EPROTO from scarlett2_usb_tx() Date: Tue, 12 Aug 2025 19:30:37 +0200 Message-ID: <20250812172959.457907251@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812172948.675299901@linuxfoundation.org> References: <20250812172948.675299901@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Geoffrey D. Bennett commit 8a15ca0ca51399b652b1bbb23b590b220cf03d62 upstream. During communication with Focusrite Scarlett Gen 2/3/4 USB audio interfaces, -EPROTO is sometimes returned from scarlett2_usb_tx(), snd_usb_ctl_msg() which can cause initialisation and control operations to fail intermittently. This patch adds up to 5 retries in scarlett2_usb(), with a delay starting at 5ms and doubling each time. This follows the same approach as the fix for usb_set_interface() in endpoint.c (commit f406005e162b ("ALSA: usb-audio: Add retry on -EPROTO from usb_set_interface()")), which resolved similar -EPROTO issues during device initialisation, and is the same approach as in fcp.c:fcp_usb(). Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Closes: https://github.com/geoffreybennett/linux-fcp/issues/41 Cc: stable@vger.kernel.org Signed-off-by: Geoffrey D. Bennett Link: https://patch.msgid.link/aIdDO6ld50WQwNim@m.b4.vu Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/mixer_scarlett2.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -1279,6 +1279,8 @@ static int scarlett2_usb( struct scarlett2_usb_packet *req, *resp = NULL; size_t req_buf_size = struct_size(req, data, req_size); size_t resp_buf_size = struct_size(resp, data, resp_size); + int retries = 0; + const int max_retries = 5; int err; req = kmalloc(req_buf_size, GFP_KERNEL); @@ -1302,10 +1304,15 @@ static int scarlett2_usb( if (req_size) memcpy(req->data, req_data, req_size); +retry: err = scarlett2_usb_tx(dev, private->bInterfaceNumber, req, req_buf_size); if (err != req_buf_size) { + if (err == -EPROTO && ++retries <= max_retries) { + msleep(5 * (1 << (retries - 1))); + goto retry; + } usb_audio_err( mixer->chip, "%s USB request result cmd %x was %d\n",