Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp62096pxj; Thu, 20 May 2021 04:37:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywplXJiyhe8GngsNTyzv6cmOTRL8XB9JnzboIgJctsFox/LhuYLJvbiAwtkNyhTWcGf9MZ X-Received: by 2002:aa7:c485:: with SMTP id m5mr4389494edq.230.1621510630998; Thu, 20 May 2021 04:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510630; cv=none; d=google.com; s=arc-20160816; b=NW/1gm6Lk1oKnn2qTaoIV7r3rO6R52wYcrg/xvFEHSMXgvSfjPZjnzl/DOHMXDyAk6 bJnAhh1V5lwtLGamnWCUcmGSmgPgwkkbJNZLsz/lVCLN8cOWEQHztqHvYe31HCiT66xy U0GaInHi+r5OFDydYmq+LZ0bLschUNaspVuQRsl4ADDN76b4LCNihAWf1WwS8MJ5X+Jx O5IXHpkSCHoij5oknkWL4h5gR3XCbnYUnabOtTRE/SjKHLHAFNo0FdCIhUtEaeO3xsAm uxCQF6BkXYY2Es5kUEOV9iuVDT4GIqqfZ4Bcf10p6jnXacxccI6CbP6h2KhvEcHASAEA d6wQ== 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=66t5oOEUIffzONJNo/8YPmP4CMQy03o6hpngMijFtxo=; b=Erwny/5Rb3ihpwM2GqFz+m9qksNl7497t4PQydnE3uKu4Dn/Fq3sMwMNVh8RC8VML3 vtTLAmOry93ORskG9mqVGdBKprktJ9eURI5gxA46ivMwKF9OM47RBEsolctDIp1hBo/K tUGVHDrL2KhnbGgOx6sN1ACXd8fZlYOoe/+0anUry5zR3v3QX60eWQTYtxVI05XMXI5m Hvr6Gn4TjrAPaYH13K5LqFdbyRwHMm+zxtTrTsIz/a51c7hNVNsLcFSD1KCXDiP3xcHm 7kEXu3onjbUfuo6hAfmune4ljpZP2FO0xT+1TgLQfsUi+TurbTP52H8f0NHMgkRMMrUG QNfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mcixy1jP; 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 e20si1996701eds.560.2021.05.20.04.36.47; Thu, 20 May 2021 04:37:10 -0700 (PDT) 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=mcixy1jP; 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 S242519AbhETLfd (ORCPT + 99 others); Thu, 20 May 2021 07:35:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:37932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240657AbhETLPH (ORCPT ); Thu, 20 May 2021 07:15:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E23E61950; Thu, 20 May 2021 10:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505333; bh=ikUvAc2dvmrT59VybQQhYjoK9wTU9L4Bvf+kBTfqDcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcixy1jPv4sqhv+00m1zN8S8LYmaCNpU5kJcWDcm3GD8ddWbcLuiY2T7PTQco9gQv ceM5JxC4GKdnEvXIlROlev8zjvBy+Jl1FU3w4Hqj8tP9I7kTEyLAqKlTmu70mHe76c lgKJJR04hHg0/GB5sq4GRzMEWNvHSspboS+pEngg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabian Vogt , Sasha Levin Subject: [PATCH 4.4 088/190] fotg210-udc: Complete OUT requests on short packets Date: Thu, 20 May 2021 11:22:32 +0200 Message-Id: <20210520092105.107456554@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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: Fabian Vogt [ Upstream commit 75bb93be0027123b5db6cbcce89eb62f0f6b3c5b ] A short packet indicates the end of a transfer and marks the request as complete. Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") Signed-off-by: Fabian Vogt Link: https://lore.kernel.org/r/20210324141115.9384-8-fabian@ritter-vogt.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/fotg210-udc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index b2910bc65e51..9e102ba9cf66 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -856,12 +856,16 @@ static void fotg210_out_fifo_handler(struct fotg210_ep *ep) { struct fotg210_request *req = list_entry(ep->queue.next, struct fotg210_request, queue); + int disgr1 = ioread32(ep->fotg210->reg + FOTG210_DISGR1); fotg210_start_dma(ep, req); - /* finish out transfer */ + /* Complete the request when it's full or a short packet arrived. + * Like other drivers, short_not_ok isn't handled. + */ + if (req->req.length == req->req.actual || - req->req.actual < ep->ep.maxpacket) + (disgr1 & DISGR1_SPK_INT(ep->epnum - 1))) fotg210_done(ep, req, 0); } -- 2.30.2