From patchwork Tue Sep 7 15:23:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 161421 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o87FQ6gj004268 for ; Tue, 7 Sep 2010 15:26:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757723Ab0IGPZt (ORCPT ); Tue, 7 Sep 2010 11:25:49 -0400 Received: from mail-px0-f174.google.com ([209.85.212.174]:51861 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757700Ab0IGPZo (ORCPT ); Tue, 7 Sep 2010 11:25:44 -0400 Received: by pxi10 with SMTP id 10so1362917pxi.19 for ; Tue, 07 Sep 2010 08:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=SrX/hNpBqLY5lTxk9enFg0DEVu8ewzsyX2M96ScPO1Q=; b=R+2T0rYNYVbzaMjoT1N+zGdUocXdkYv+E0UhdEr3y44j8De07/XyBNhwei1tCJDfuY cKPYVMsYN2ovisM2cosl5UsL7k/bj3T5PFSL/GlGpot2hC8sANNNasHKGM+F2u/wOk66 XvjC3Rgt45kvm7BZC0xIxcDXqc2E7Cs9j8IhE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=Fu6GOtMzZkJy+XaBxmBbyHfynbFmdnWE2TKPPFT5dJIShARzC705VmDHFWRGmB3Bxt 4lJgY1B6gaNmtDFjPX9YKS8Mmoc4JJvotkKhZDUj8xJMPtbtl927Bu8tg8hapk7D8pcO m6NtSmrwD2cCzLIfxsotn6ngBOD3qVkMYuaEA= Received: by 10.142.212.10 with SMTP id k10mr110245wfg.158.1283873144003; Tue, 07 Sep 2010 08:25:44 -0700 (PDT) Received: from localhost ([183.16.32.111]) by mx.google.com with ESMTPS id t18sm5929893wfc.11.2010.09.07.08.25.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Sep 2010 08:25:43 -0700 (PDT) From: tom.leiming@gmail.com To: greg@kroah.com Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Ming Lei , David Brownell , Felipe Balbi , Anand Gadiyar , Mike Frysinger , Sergei Shtylyov Subject: [RESEND/PATCH 6/6] USB: musb-gadget: fix dma length in txstate Date: Tue, 7 Sep 2010 23:23:34 +0800 Message-Id: <1283873014-32511-7-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1283873014-32511-1-git-send-email-tom.leiming@gmail.com> References: <1283873014-32511-1-git-send-email-tom.leiming@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 07 Sep 2010 15:26:07 +0000 (UTC) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index fa826f9..cacae96 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -300,6 +300,11 @@ static void txstate(struct musb *musb, struct musb_request *req) #ifndef CONFIG_MUSB_PIO_ONLY if (is_dma_capable() && musb_ep->dma) { struct dma_controller *c = musb->dma_controller; + size_t request_size; + + /* setup DMA, then program endpoint CSR */ + request_size = min_t(size_t, request->length - request->actual, + musb_ep->dma->max_len); use_dma = (request->dma != DMA_ADDR_INVALID); @@ -307,11 +312,6 @@ static void txstate(struct musb *musb, struct musb_request *req) #ifdef CONFIG_USB_INVENTRA_DMA { - size_t request_size; - - /* setup DMA, then program endpoint CSR */ - request_size = min_t(size_t, request->length, - musb_ep->dma->max_len); if (request_size < musb_ep->packet_sz) musb_ep->dma->desired_mode = 0; else @@ -373,8 +373,8 @@ static void txstate(struct musb *musb, struct musb_request *req) use_dma = use_dma && c->channel_program( musb_ep->dma, musb_ep->packet_sz, 0, - request->dma, - request->length); + request->dma + request->actual, + request_size); if (!use_dma) { c->channel_release(musb_ep->dma); musb_ep->dma = NULL; @@ -386,8 +386,8 @@ static void txstate(struct musb *musb, struct musb_request *req) use_dma = use_dma && c->channel_program( musb_ep->dma, musb_ep->packet_sz, request->zero, - request->dma, - request->length); + request->dma + request->actual, + request_size); #endif } #endif