Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4592321pxj; Wed, 12 May 2021 08:51:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPLOIH01DdoR0lkACxkx7m8SRKhE5k4DuR9JNLeW9gyTpGCJyGHOT5cluQxMhF1fpBoN/u X-Received: by 2002:a17:907:961d:: with SMTP id gb29mr5028207ejc.339.1620834686767; Wed, 12 May 2021 08:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834686; cv=none; d=google.com; s=arc-20160816; b=FhEEI/ttHvW/JsN6IY+kMnHjwYKScV9DGfIWzldDJOVWWBf7H7jCIWBqv3ZTH/6UQb dJFNkkSCPpMExdX0yCi4uox5i7rWAKyONWOh6RcIOrJMEutIjl+FoijXvV6DF7FJVBAl KJR7YDH4cjgmOz77j14lt8i2qznz6SfMdfxj8JT3tX0PmF+mgcnIwxsDh6KsGDPaxW0W 147YthuPonWyfBu6WQHXNcZ9o4gwlyWUyLZo9g/hNsrCb5cAlCOXzFeaWIhFuWh5le4n 9PQWUSAkuRggAGOv8NvBv3c57hUpxu7ZxhWyzmcp+tq6z8225svAFG5hRsamS8/7vd1z RF+w== 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=sZRFWWgzYeAViYlAAzsVVrtmQDe4z3jaGpODweuwnlE=; b=nzUvSwWFd9xHIVo36S5mQJ4h5wycEy5NDUO+I4J6c0iyqoXvdiqpHgBaVbClYzT74T 8hzXwGURvpMCQbFOn6ILKtAE8EQGp45tfMGEgQUOaStDQLoZQPaoU5UsHpsvjycTBdsn xxPY12WOG51t9qwrhKfg7Dyg1r+WZIYqnrrr7MCK9ZTfs9vSm6BLDeEOAGRPwDBkb1Mf wLXHKH8qrj4ZNdvv7XtztTfNhsBBEi0jnfznL9JupFnltAkY+/A9TzVWAFKcSz4SwWz4 295+oNdHlwLOmLgAXJB1BT+pLizdG+x5DR1JuaWMmeg/Vmp+eIzrTE6OC9bgEqWVmqMm mupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sjdIbppv; 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 w1si90843edc.221.2021.05.12.08.51.01; Wed, 12 May 2021 08:51:26 -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=sjdIbppv; 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 S237615AbhELPvD (ORCPT + 99 others); Wed, 12 May 2021 11:51:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:40754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234809AbhELPZp (ORCPT ); Wed, 12 May 2021 11:25:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F1A26619CE; Wed, 12 May 2021 15:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832239; bh=HjCaItIy7fL3QVxAC//0oOeWiZ0GOZuAuyIzVwGcdv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjdIbppvri+9ZrMd1tiXsBA6BHQ8vl2rLTzdvRC52rNpdm+8K6hv1kgiZ6DbRULVP mPnnkqYSqFAQ1cvP9lTJshP+jorkskXtAvrpflAiaG1As+Bt471f0+kFOxg2U95OhB 8yq2TEoBolLi3EGhjVihoQmN9JntfsljrQDc7HYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabian Vogt , Sasha Levin Subject: [PATCH 5.10 181/530] fotg210-udc: Complete OUT requests on short packets Date: Wed, 12 May 2021 16:44:51 +0200 Message-Id: <20210512144825.780167910@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 9925d7ac9138..75bf446f4a66 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -849,12 +849,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