From patchwork Thu Apr 3 03:16:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3931291 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CE1F0BF540 for ; Thu, 3 Apr 2014 03:16:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E5DB3202E9 for ; Thu, 3 Apr 2014 03:16:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDF6B2017E for ; Thu, 3 Apr 2014 03:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758878AbaDCDQx (ORCPT ); Wed, 2 Apr 2014 23:16:53 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:53594 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758822AbaDCDQw (ORCPT ); Wed, 2 Apr 2014 23:16:52 -0400 Received: by mail-pb0-f46.google.com with SMTP id rq2so1145222pbb.5 for ; Wed, 02 Apr 2014 20:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=jruoB03iul5+lDKjGqrarnBjvbo+OjVBMeMln+oEBFE=; b=am8DEikMIaclmUf5p4gJIamw1cqqguBU+IMMX2zerjH8HngIJIlffYqOPeQoj+1afS XDxlfNZCwv3VH2ZvTU17s62j0JRObO533dRcdNUOeciAZ36S1t+wllTDAprDeKFsC6KS 5a0VH4Ij6oYQCyHeRdjtsGtbEPrs0BrkZEUK3kc++KdZXhp2VHtfwo/J5/CShicraY/M eiZJ154nK/ITqM5KJ4ckg1YmhEtxOqtT5mSEmbT0hzRcYI+JsOLnALlGrg6jgpfd96Al 3/eU6pIAVMNP2kBmqs1Iaxk20lRw6AXAWXtOYz/IG5LIHQb15oO+/kV8u+QYFHSPDREh CKFw== X-Received: by 10.68.201.67 with SMTP id jy3mr4428341pbc.20.1396495012255; Wed, 02 Apr 2014 20:16:52 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id st4sm18091494pab.34.2014.04.02.20.16.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 02 Apr 2014 20:16:51 -0700 (PDT) Date: Wed, 02 Apr 2014 20:16:51 -0700 (PDT) Message-ID: <87k3b7rtjw.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 1/2] DMA: shdma: tidyup callback chunk finder User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Vinod Koul Cc: Linux-SH , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org In-Reply-To: <87lhvnrtkw.wl%kuninori.morimoto.gx@gmail.com> References: <87lhvnrtkw.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current shdma is using "last" which indicates last desc which needs to have callback function. but, that desc's chunks is always 1 We can use it as finder Signed-off-by: Kuninori Morimoto --- drivers/dma/sh/shdma-base.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c index 5239677..6786ecb 100644 --- a/drivers/dma/sh/shdma-base.c +++ b/drivers/dma/sh/shdma-base.c @@ -73,8 +73,7 @@ static void shdma_chan_xfer_ld_queue(struct shdma_chan *schan) static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) { struct shdma_desc *chunk, *c, *desc = - container_of(tx, struct shdma_desc, async_tx), - *last = desc; + container_of(tx, struct shdma_desc, async_tx); struct shdma_chan *schan = to_shdma_chan(tx->chan); dma_async_tx_callback callback = tx->callback; dma_cookie_t cookie; @@ -98,19 +97,20 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) &chunk->node == &schan->ld_free)) break; chunk->mark = DESC_SUBMITTED; - /* Callback goes to the last chunk */ - chunk->async_tx.callback = NULL; + if (chunk->chunks == 1) { + chunk->async_tx.callback = callback; + chunk->async_tx.callback_param = tx->callback_param; + } else { + /* Callback goes to the last chunk */ + chunk->async_tx.callback = NULL; + } chunk->cookie = cookie; list_move_tail(&chunk->node, &schan->ld_queue); - last = chunk; dev_dbg(schan->dev, "submit #%d@%p on %d\n", - tx->cookie, &last->async_tx, schan->id); + tx->cookie, &chunk->async_tx, schan->id); } - last->async_tx.callback = callback; - last->async_tx.callback_param = tx->callback_param; - if (power_up) { int ret; schan->pm_state = SHDMA_PM_BUSY;