From patchwork Wed Dec 13 01:59:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121708 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4897518qgn; Tue, 12 Dec 2017 18:15:49 -0800 (PST) X-Google-Smtp-Source: ACJfBotOEEi2zn859k9CggHxUYpu/DDi2PIv8VvvlpkW0ik+1XvOcWbvbOLkvKCl+/2v+0oRMTS9 X-Received: by 10.98.158.89 with SMTP id s86mr644094pfd.216.1513131349569; Tue, 12 Dec 2017 18:15:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513131349; cv=none; d=google.com; s=arc-20160816; b=qlorqj8+yNRzEJOs3b1Syn/KT0QGSA5GmkvuQlqL0xq20GfTKorlgh5yVNYnkTTAaF +WaG0zgnNSfON1OyjT2gs4npAB1ruyg8vvDrPJlPzxA6zfeTV70N33gedHenhGpK7ZTf +L/kGV+Wh/KwLLoQfZmduzounQigOIJLRjNDuCP6BBr8hGaLo1bQwQeSJybitlHOHC83 mmiACZw99DuN2C6ixMZXVUOyV8m6goBvz8t7tqbMHPStmV38y8oZwuPSZ3VASDCOQOG5 iAJFf+7es2fC5QBUHr2fWKMXRl5REzt++OCe7w1UtdLecD+nPKk4UCXjtuoCzulmzz5d FtjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=C/MeMvi0S7OnZ2SUC02AeTf/bG2hf6L60l32tFtyQUI=; b=R0Rh9S2F37Lru/8ztVpcpw3+1JvWxh4nHuVA6a91UxOfnqEndKivmqYel9PUMGN+Kr 5I84S5tV+Qk/qUBc3uxbl1F2vXz269D4TuSpms0sX75CD8SItqfwFc9tCZ4/bk4s6tQc Od/yXJ8PjZmnik7bQVY0BhZKNarowRQ1E6BkFlpwy0PodAOLveYJL1PpyygDriun8NDo yfO5TFVluWcH0A49R5ZackcAEWpzNGl5CgG0D+rjfrrC4sVPDkP3pRriUiF4fSXQoBdf XISBcqWsDVl5QZ9JotdD+UEZWRGjYgEwALWpKUxu7akoX/Tl7LVSaw2axd/DW8mdF+qQ wwxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=HCcLcUps; dkim=fail header.i=@verizon.com header.s=corp header.b=Y/dx/jod; dkim=fail header.i=@verizon.com header.s=corp header.b=i/okyBoI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si446259plr.112.2017.12.12.18.15.49; Tue, 12 Dec 2017 18:15:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=HCcLcUps; dkim=fail header.i=@verizon.com header.s=corp header.b=Y/dx/jod; dkim=fail header.i=@verizon.com header.s=corp header.b=i/okyBoI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753158AbdLMCPr (ORCPT + 10 others); Tue, 12 Dec 2017 21:15:47 -0500 Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:59672 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753711AbdLMCBH (ORCPT ); Tue, 12 Dec 2017 21:01:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130467; x=1544666467; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=URfCD1FNCw8xQX6gkxUIOCHwCxSAM9dG2x088SxWLb8=; b=HCcLcUpsKKfJDDf0jpkF4s/CQ15TMOagPZK5bt9KO56IYN8PYCyxN/iI hgtB/u951znmtAGDBrwkWokMKsjYOOqxqbAfzO7C2xHi8AW+O8zQtJrwY /Bz8kwYg5Os9vSRw5fzYvqKRyIhpr1MqIHzKSwsOU4Psg99ryzlOhI+ca Q=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by omzsmtpe03.verizonbusiness.com with ESMTP; 13 Dec 2017 02:01:03 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 02:00:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130459; x=1544666459; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=URfCD1FNCw8xQX6gkxUIOCHwCxSAM9dG2x088SxWLb8=; b=Y/dx/jod59jxIV8IUU4ZsENN1uPmd6s3XZAnjWBjKiF7lStSn8P6balK gPXQl5Ie2a/CKwvKHfwbBW4ocbDEoq0iFKI0fIx3j4QSQbCbKN/CgrXEp CYMGASGA1Ft1cw9ZBF7Fi0QnQXHa21Zd0K4+IPA278ZeqmC/KwxVA9q5j E=; Received: from surveyor.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.83]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 21:00:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130458; x=1544666458; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=URfCD1FNCw8xQX6gkxUIOCHwCxSAM9dG2x088SxWLb8=; b=i/okyBoIpder9Fk9QTk5svx/VeqCDoyusw+gdeM81P+XItucdm44HPPK zJAdsLA/f77/iQwxLgZOrAFeC0+wN1SxcF/RKMN3TcZkorfcfnQpNTGaZ kpkYp5HBGgMpfJLaEpe2U9A0ZY6BVdjCQ/ITWXm/oGnZJjcsATszuBBNK k=; From: alexander.levin@verizon.com Cc: Roger Quadros , Felipe Balbi , alexander.levin@verizon.com X-Host: surveyor.tdc.vzwcorp.com Received: from ohtwi1exh002.uswin.ad.vzwcorp.com ([10.144.218.44]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 02:00:58 +0000 Received: from tbwexch02apd.uswin.ad.vzwcorp.com (153.114.162.26) by OHTWI1EXH002.uswin.ad.vzwcorp.com (10.144.218.44) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 21:00:58 -0500 Received: from OMZP1LUMXCA15.uswin.ad.vzwcorp.com (144.8.22.190) by tbwexch02apd.uswin.ad.vzwcorp.com (153.114.162.26) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 21:00:58 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA15.uswin.ad.vzwcorp.com (144.8.22.190) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:00:57 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 20:00:57 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 3.18 06/40] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Thread-Topic: [PATCH AUTOSEL for 3.18 06/40] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Thread-Index: AQHTc7X4diAH0Ix2i0akCtFyQNiSTA== Date: Wed, 13 Dec 2017 01:59:12 +0000 Message-ID: <20171213015905.7059-6-alexander.levin@verizon.com> References: <20171213015905.7059-1-alexander.levin@verizon.com> In-Reply-To: <20171213015905.7059-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roger Quadros [ Upstream commit 16bb05d98c904a4f6c5ce7e2d992299f794acbf2 ] As per USB3.0 Specification "Table 9-20. Standard Endpoint Descriptor", for interrupt and isochronous endpoints, wMaxPacketSize must be set to 1024 if the endpoint defines bMaxBurst to be greater than zero. Reviewed-by: Laurent Pinchart Signed-off-by: Roger Quadros Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uvc.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.11.0 diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index f4a0b25d1810..5e679fec4e33 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -612,6 +612,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) opts->streaming_maxpacket = clamp(opts->streaming_maxpacket, 1U, 3072U); opts->streaming_maxburst = min(opts->streaming_maxburst, 15U); + /* For SS, wMaxPacketSize has to be 1024 if bMaxBurst is not 0 */ + if (opts->streaming_maxburst && + (opts->streaming_maxpacket % 1024) != 0) { + opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024); + INFO(cdev, "overriding streaming_maxpacket to %d\n", + opts->streaming_maxpacket); + } + /* Fill in the FS/HS/SS Video Streaming specific descriptors from the * module parameters. *