From patchwork Mon Jan 7 11:21:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 13876 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B7FB223EC8 for ; Mon, 7 Jan 2013 11:25:18 +0000 (UTC) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by fiordland.canonical.com (Postfix) with ESMTP id 79FA9A188FA for ; Mon, 7 Jan 2013 11:25:18 +0000 (UTC) Received: by mail-vc0-f176.google.com with SMTP id fo13so19043503vcb.21 for ; Mon, 07 Jan 2013 03:25:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=SRCL6kCveJxQz8CD1+PYjtLHfzGIAqfoLz4k2zxGQq0=; b=LR+k6m9jTwfyGc9DoCjsu+mnQDqrgJr9FaEn1e5IzRtnKaFkAv3fsx33sOUY6l8RwF zC5nXFG1zHB4mIbmj4YSz1bI1zA7GMWsN+8Pb/POcdfto937XNSJZH+VmznXNXr46s2p iZdtFWCbUgCjUYJ/5JvnXG/0DHKMvYiDkg6qf/PwyCuSwChSMFl5XfcPbRi4BnyOFAQN R2RMBuyZC5NCIS57B74jGZbMp8qufNrqOh03NUU2AOMloRs6ZNl8OuLA5uUec3AGHlJN OTSF+2VQc2FTpry/gTm5r99RjShm7fCmFngymu+11Uskuwy+xz1Rm0isL30AK/1POoRU agGQ== X-Received: by 10.52.88.168 with SMTP id bh8mr70338117vdb.51.1357557918011; Mon, 07 Jan 2013 03:25:18 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp56291veb; Mon, 7 Jan 2013 03:25:17 -0800 (PST) X-Received: by 10.180.95.169 with SMTP id dl9mr8540392wib.20.1357557917092; Mon, 07 Jan 2013 03:25:17 -0800 (PST) Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by mx.google.com with ESMTPS id ep18si87365561wjd.60.2013.01.07.03.25.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Jan 2013 03:25:17 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.49 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=74.125.82.49; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.49 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) smtp.mail=fabio.baltieri@linaro.org Received: by mail-wg0-f49.google.com with SMTP id 15so9271786wgd.28 for ; Mon, 07 Jan 2013 03:25:16 -0800 (PST) X-Received: by 10.194.119.5 with SMTP id kq5mr94990036wjb.48.1357557916724; Mon, 07 Jan 2013 03:25:16 -0800 (PST) Received: from localhost ([2a01:2029:1:11e3:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id hu8sm11651586wib.6.2013.01.07.03.25.11 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Jan 2013 03:25:16 -0800 (PST) From: Fabio Baltieri To: Vinod Koul Cc: Dan Williams , Linus Walleij , Srinidhi Kasagar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Fabio Baltieri Subject: [PATCH 13/16] dmaengine: ste_dma40: minor code readability fixes Date: Mon, 7 Jan 2013 12:21:55 +0100 Message-Id: <1357557718-15676-14-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org> References: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQm4g1M2MM2ZeMT+7ap4Ps1j2UfCfF7iQT+wvahf8sZeGwn5YNV7lSb9HreFYeXvGD/5qB7j Use internal variables to the cycles to improve code readability, no functional changes. Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- drivers/dma/ste_dma40.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 623779e..e317deb 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -639,19 +639,18 @@ static int d40_lcla_alloc_one(struct d40_chan *d40c, unsigned long flags; int i; int ret = -EINVAL; - int p; spin_lock_irqsave(&d40c->base->lcla_pool.lock, flags); - p = d40c->phy_chan->num * D40_LCLA_LINK_PER_EVENT_GRP; - /* * Allocate both src and dst at the same time, therefore the half * start on 1 since 0 can't be used since zero is used as end marker. */ for (i = 1 ; i < D40_LCLA_LINK_PER_EVENT_GRP / 2; i++) { - if (!d40c->base->lcla_pool.alloc_map[p + i]) { - d40c->base->lcla_pool.alloc_map[p + i] = d40d; + int idx = d40c->phy_chan->num * D40_LCLA_LINK_PER_EVENT_GRP + i; + + if (!d40c->base->lcla_pool.alloc_map[idx]) { + d40c->base->lcla_pool.alloc_map[idx] = d40d; d40d->lcla_alloc++; ret = i; break; @@ -676,10 +675,10 @@ static int d40_lcla_free_all(struct d40_chan *d40c, spin_lock_irqsave(&d40c->base->lcla_pool.lock, flags); for (i = 1 ; i < D40_LCLA_LINK_PER_EVENT_GRP / 2; i++) { - if (d40c->base->lcla_pool.alloc_map[d40c->phy_chan->num * - D40_LCLA_LINK_PER_EVENT_GRP + i] == d40d) { - d40c->base->lcla_pool.alloc_map[d40c->phy_chan->num * - D40_LCLA_LINK_PER_EVENT_GRP + i] = NULL; + int idx = d40c->phy_chan->num * D40_LCLA_LINK_PER_EVENT_GRP + i; + + if (d40c->base->lcla_pool.alloc_map[idx] == d40d) { + d40c->base->lcla_pool.alloc_map[idx] = NULL; d40d->lcla_alloc--; if (d40d->lcla_alloc == 0) { ret = 0;