Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp434162pxj; Thu, 20 May 2021 12:48:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3YC+duLvZwStEefOPC6LX+TUHZObxwVvl+ae+C56tVag+4pjjmEDiv3FFhVH/VUHM9GKT X-Received: by 2002:a17:906:1dc2:: with SMTP id v2mr6502247ejh.8.1621540098619; Thu, 20 May 2021 12:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621540098; cv=none; d=google.com; s=arc-20160816; b=rucREJGz5wvTSy2EpnD+iSGhWOkA2srDUnrmqGDdY7F7a+7knS2FeI+QqBZCJJgy+o wnMpzDp9xYIQX5OIC+kM9+3V2WMgdjpUPo+l6WFRBAkGehkFmzf0KfRTMLanBNRY4Cul IAZrgG9pJ84V1lsB55upf0qVr2frSDOarSCxbd0lLn0W/gtLhSohDh2AwQBMOs4UKTnJ /SoXEyqxXSoK0GYGGW9KGIwBjgvZdgcIUPSzGiNIi0RarfAS8xJsG7Iji2nzsRX09NI0 gz2VvR0mudLABhUxON1rKXMi3sBPwK0udDLAkR7NFXUXudi7FfbFWYy1/wHDM7RMCsqU yTSA== 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=qNLh93Y0kFaHsaxbYRB1jz6x7oZsWUmHdg+vO3Be4xw=; b=Kdsfmiyb2kxGNw+B3PrFr07aMJf4dEFJxqmV6YK5eHRJu3mpa1E64J/7u1yGXpRDLG K5GYaJlXEADz/LJYUZKBx4yUN+ttX46+BdGUO3n+fFUM/gWeZTBI+7aAa4z5Oi7FZVDT 7mgb1jhoQg+hL32aIyJ8VrF0YdFM5VJ1e/W9S+JeMbysxx4ZAqEaH+LxB0U3sk5ZQoWF ikaiXGzIeOFvv17cd5rijMDe+x2LKtgK1PNGO3naQB9mTSvtTOA9uIti5eOfVVCV4hu3 kxDDjTyC+HkqgkEjK834hOwsCs3hwS7Fwxj039yrJ0GYAcYkKWppZx0jVh0vd2KB6Y+F zLAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DBd80LiY; 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 qw5si2413726ejb.81.2021.05.20.12.47.55; Thu, 20 May 2021 12:48:18 -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=DBd80LiY; 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 S237436AbhETKnM (ORCPT + 99 others); Thu, 20 May 2021 06:43:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbhETK1t (ORCPT ); Thu, 20 May 2021 06:27:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B9DC61C28; Thu, 20 May 2021 09:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504241; bh=PFz0vzBcaTOiSeUcsZ/qvTbrrYS3LdT+lRnpobao/Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DBd80LiYqYjwXWdGMh5BWRnl03YotQav+18zxkWRFDtGVy/e2XtWSwdGXJYHRNkOX 9zgGMroJhRGOS6onrwnlhgAOHU4mAfITQh8JtXZoY8nfuVOU/N4HDXRomlfkLhUeYW xgcDQ/rGdRjZopXSQPamKl6EFTCWIYCIG0eQqLAs= 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.14 156/323] fotg210-udc: Complete OUT requests on short packets Date: Thu, 20 May 2021 11:20:48 +0200 Message-Id: <20210520092125.447339235@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 315d0e485d32..9440973cdb44 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