From patchwork Sat Oct 27 15:49:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 1655941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 720B73FD4E for ; Sat, 27 Oct 2012 15:51:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TS8eH-00040K-O8; Sat, 27 Oct 2012 15:50:09 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TS8eD-000406-2M for linux-arm-kernel@lists.infradead.org; Sat, 27 Oct 2012 15:50:06 +0000 Received: by mail-da0-f49.google.com with SMTP id q27so1595042daj.36 for ; Sat, 27 Oct 2012 08:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=1vbX5n6TFBfeqUc9PDecqBRZT6WwxGXae5sk6lDrQ6M=; b=Mz2QydWOIbPp7y1M90uR2TKNtztegR8LkvBzLY3D8qg6iSnRfZ+F8txkgp470lK5Ah INBlwL/J8szkflcs1Wsj4dmHnWMK/Vi7phLYGcV0W4cFvHClBetJQG4wzr1LDM9aZC66 R+RFONRTwyC3owbTBoPBjIkgBVkgKuq+SwXCZbd68ZCL9D++1gGKOCkxCOWdKX0VxjzC gUPYC1+4Vre0W1plKH15Y17upXem4MPcDTn3d7aBLw/B+jcIz0uoALR69qq70ZNGt39m ZfXuLJ9wFHGNTaPlWuMOT7Ga7zxUt5n0GsDezx42HruBHFhjU0hanpuIXPGkPnCFjtex H5vg== Received: by 10.66.77.168 with SMTP id t8mr70657286paw.28.1351353002255; Sat, 27 Oct 2012 08:50:02 -0700 (PDT) Received: from localhost.localdomain (p1120-ipbf2201hodogaya.kanagawa.ocn.ne.jp. [123.220.186.120]) by mx.google.com with ESMTPS id k4sm2862443pax.7.2012.10.27.08.50.00 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 27 Oct 2012 08:50:01 -0700 (PDT) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH] dma: ste_dma40: use for_each_set_bit Date: Sun, 28 Oct 2012 00:49:30 +0900 Message-Id: <1351352973-3719-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.7.11.7 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (akinobu.mita[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Srinidhi Kasagar , Vinod Koul , Linus Walleij , Akinobu Mita , Dan Williams , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Replace open-coded loop with for_each_set_bit(). Signed-off-by: Akinobu Mita Cc: Srinidhi Kasagar Cc: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org Cc: Vinod Koul Cc: Dan Williams Acked-by: Linus Walleij --- drivers/dma/ste_dma40.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index ae55091..08f5bfe 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -1487,7 +1487,7 @@ static irqreturn_t d40_handle_interrupt(int irq, void *data) u32 regs[ARRAY_SIZE(il)]; u32 idx; u32 row; - long chan = -1; + long chan; struct d40_chan *d40c; unsigned long flags; struct d40_base *base = data; @@ -1498,15 +1498,8 @@ static irqreturn_t d40_handle_interrupt(int irq, void *data) for (i = 0; i < ARRAY_SIZE(il); i++) regs[i] = readl(base->virtbase + il[i].src); - for (;;) { - - chan = find_next_bit((unsigned long *)regs, - BITS_PER_LONG * ARRAY_SIZE(il), chan + 1); - - /* No more set bits found? */ - if (chan == BITS_PER_LONG * ARRAY_SIZE(il)) - break; - + for_each_set_bit(chan, (unsigned long *)regs, + BITS_PER_LONG * ARRAY_SIZE(il)) { row = chan / BITS_PER_LONG; idx = chan & (BITS_PER_LONG - 1);