Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp341964pxj; Thu, 20 May 2021 10:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHWKbsONovGDEVRuRLfmxGEy8QRDf6sImi7x5M/XLXgFRql9auCtQyTDAatXW2paAjtRtj X-Received: by 2002:a17:906:ca55:: with SMTP id jx21mr5796449ejb.161.1621531949491; Thu, 20 May 2021 10:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621531949; cv=none; d=google.com; s=arc-20160816; b=oKCBr3fnpR3EzQqtUyoEjjyOQHSM6wgRnzXSvehCgD0mGyJ6aAHvSq7xMKSABOIR/a 8kol4AiH6smVlZqxnLTMdbvVw2bYEaO+6+YHomNsWp0AdbgvB/B73T5O0Y8ZkvXo9koz yVru7wzxggYfJoFnkMgVL3yZMEL3Uu5VcowjHgiCWymeBDHqISvHAAMFUXz25x0BoBPu LTEnGh9SPrZwl0qfA8zXd8HDkbRxch4lAWXFn8VI6UcYtpL8Wo0EuF3t4HVMYRlx9rFA MAvuxnJID9tsovLYGajRWyzuCyuUh8aq4h96ajNstnLUPCae8Yby0qHfjGMN4T3fgwYm IojA== 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=huW4D51mcW+rDNrdbstbMnDiSEPFvB6ut+GdLMONpP4=; b=gY93mjFHOMIERLWfcfiOSF08w3ZU6dXGpE5/w63q1bonSZr5efUuJ1s+KoSZq7Ppay 7yMTnIrmraanKe61lJrRt/5M9eFAs93LBGzP6nRMmAGi5sz377vvMVZ5U7Ek/1fYBpIT oTNJ+7a8UyTV7LkeZQuay/dsGp37jmHyCYeJaFiNanRg0shbtLGeIkjxjup4id1NK4/S C8Gj/eFNATsn6j9uspOAv1UK1k5OhgJgLlIk/oZ6ANwt6dCKoeYG5riTgO9fGKVQreg9 qnND3ND1JvO6z4RxCpNc+p459C7ArJA2IqzW4iR704+Le5hKRu7VqmzVaYVyIwtPDZ3+ RqEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g6zky58d; 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 gq23si2912186ejb.429.2021.05.20.10.32.04; Thu, 20 May 2021 10:32:29 -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=g6zky58d; 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 S231881AbhETKAK (ORCPT + 99 others); Thu, 20 May 2021 06:00:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:59040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235045AbhETJzp (ORCPT ); Thu, 20 May 2021 05:55:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E358A613EA; Thu, 20 May 2021 09:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503438; bh=nVfJjXUXarJcFPOTEUQBEynBKn2Hs/DzH3wByMC8xTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6zky58dX67acqO+V+lghNORwY05XwvgvcLh4KDsQyB1xlnXqe1YeMWN+qa7Ddiir 5cKYEd88Pn6NI55g5Lz+AgsV3uSTdH+CuDtskWHFXS+WFSNMF1DALHyCmMaoVYReaX UwsPyAehevfmMZFyv9kUOXrOTnh/l07BH3WnfKso= 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.19 188/425] fotg210-udc: Complete OUT requests on short packets Date: Thu, 20 May 2021 11:19:17 +0200 Message-Id: <20210520092137.596615891@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 7ae0243c32e5..785822ecc3f1 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -853,12 +853,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