Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753795AbdDNOga (ORCPT ); Fri, 14 Apr 2017 10:36:30 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:34381 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328AbdDNOfq (ORCPT ); Fri, 14 Apr 2017 10:35:46 -0400 From: Alexander Kochetkov To: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, hhb@rock-chips.com, shawn.lin@rock-chips.com, caesar.wang@rock-chips.com, sugar.zhang@rock-chips.com, ulysses.huang@rock-chips.com Cc: Alexander Kochetkov Subject: [PATCH 2/2] dmaengine: pl330: don't emit code for one iteration loop Date: Fri, 14 Apr 2017 17:35:30 +0300 Message-Id: <1492180531-1780-3-git-send-email-al.kochet@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1492180531-1780-1-git-send-email-al.kochet@gmail.com> References: <1492180531-1780-1-git-send-email-al.kochet@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1458 Lines: 56 The patch remove one iteration outer loop in the _loop(). Removing loop saves 4 bytes of MicroCode buffer. This savings make sense for free-running cyclic transfer implementation. DMALP_0 0 ... DMALPENDA_0 bjmpto_9 Signed-off-by: Alexander Kochetkov --- drivers/dma/pl330.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 56a2377..6126dde 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1268,7 +1268,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], lpend.bjump = 0; szlpend = _emit_LPEND(1, buf, &lpend); - if (lcnt0) { + if (lcnt0 > 1) { szlp *= 2; szlpend *= 2; } @@ -1284,7 +1284,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], off = 0; - if (lcnt0) { + if (lcnt0 > 1) { off += _emit_LP(dry_run, &buf[off], 0, lcnt0); ljmp0 = off; } @@ -1300,7 +1300,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], lpend.bjump = off - ljmp1; off += _emit_LPEND(dry_run, &buf[off], &lpend); - if (lcnt0) { + if (lcnt0 > 1) { lpend.cond = ALWAYS; lpend.forever = false; lpend.loop = 0; @@ -1309,7 +1309,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], } *bursts = lcnt1 * cyc; - if (lcnt0) + if (lcnt0 > 1) *bursts *= lcnt0; return off; -- 1.7.9.5