From patchwork Tue Nov 17 11:37:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 7635601 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34CBA9F2EC for ; Tue, 17 Nov 2015 11:37:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E3BA20511 for ; Tue, 17 Nov 2015 11:37:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91F86204FC for ; Tue, 17 Nov 2015 11:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752373AbbKQLhO (ORCPT ); Tue, 17 Nov 2015 06:37:14 -0500 Received: from mga01.intel.com ([192.55.52.88]:53434 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751330AbbKQLhN (ORCPT ); Tue, 17 Nov 2015 06:37:13 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 17 Nov 2015 03:37:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,307,1444719600"; d="scan'208";a="840480726" Received: from black.fi.intel.com ([10.237.72.93]) by fmsmga001.fm.intel.com with ESMTP; 17 Nov 2015 03:37:12 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 40A9523B; Tue, 17 Nov 2015 13:37:11 +0200 (EET) From: Andy Shevchenko To: dmaengine@vger.kernel.org, vinod.koul@intel.com Cc: Andy Shevchenko Subject: [PATCH v1 4/4] dmaengine: idma64: use local variable to index descriptor Date: Tue, 17 Nov 2015 13:37:10 +0200 Message-Id: <1447760230-98173-5-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1447760230-98173-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1447760230-98173-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Since a local variable contains the number of hardware desriptors at the beginning of idma64_desc_fill() we may use it to index the last descriptor as well. Signed-off-by: Andy Shevchenko --- drivers/dma/idma64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c index b6c13f9..3cb7b2c 100644 --- a/drivers/dma/idma64.c +++ b/drivers/dma/idma64.c @@ -274,10 +274,10 @@ static void idma64_desc_fill(struct idma64_chan *idma64c, struct idma64_desc *desc) { struct dma_slave_config *config = &idma64c->config; - struct idma64_hw_desc *hw = &desc->hw[desc->ndesc - 1]; + unsigned int i = desc->ndesc; + struct idma64_hw_desc *hw = &desc->hw[i - 1]; struct idma64_lli *lli = hw->lli; u64 llp = 0; - unsigned int i = desc->ndesc; /* Fill the hardware descriptors and link them to a list */ do { @@ -287,7 +287,7 @@ static void idma64_desc_fill(struct idma64_chan *idma64c, desc->length += hw->len; } while (i); - /* Trigger interrupt after last block */ + /* Trigger an interrupt after the last block is transfered */ lli->ctllo |= IDMA64C_CTLL_INT_EN; }