From patchwork Fri Jan 13 15:53:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 135911 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0AFE5B6F6F for ; Sat, 14 Jan 2012 02:55:12 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RljS0-0001AT-Op; Fri, 13 Jan 2012 15:53:56 +0000 Received: from mail-gx0-f177.google.com ([209.85.161.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RljRt-00012k-Rf for linux-mtd@lists.infradead.org; Fri, 13 Jan 2012 15:53:50 +0000 Received: by mail-gx0-f177.google.com with SMTP id l1so1983965ggn.36 for ; Fri, 13 Jan 2012 07:53:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=3IXhb41taQj5RnYS2HNu2PeRnfP1uad/l5Wi2dLud5Q=; b=e77Dk9t85Lctot1CDcBQ0j8v2YOzz/aRZo79sbVZqRO6sGW07m9kUnvh39nvjZEWN3 EysbwZHpYVH6iI+6aFsjkwisjXPVR7IhOj3m5JdLudnFSbKD/x+RDkD+aLPumr8aUtEk jI2s1jD+MMY/vwOhmX1qvvqBj6Ss6+lKx6Kzg= Received: by 10.50.95.200 with SMTP id dm8mr291787igb.27.1326470029483; Fri, 13 Jan 2012 07:53:49 -0800 (PST) Received: from localhost.localdomain (p11175-adsau04yokonib2-acca.kanagawa.ocn.ne.jp. [220.104.206.175]) by mx.google.com with ESMTPS id py4sm7330114igc.2.2012.01.13.07.53.46 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 07:53:48 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH 4/7] mtd: use for_each_clear_bit Date: Sat, 14 Jan 2012 00:53:21 +0900 Message-Id: <1326470004-10096-5-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1326470004-10096-1-git-send-email-akinobu.mita@gmail.com> References: <1326470004-10096-1-git-send-email-akinobu.mita@gmail.com> 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.161.177 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: linux-mtd@lists.infradead.org, David Woodhouse , Akinobu Mita X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Use for_each_clear_bit() to iterate over all the cleared bit in a memory region. Signed-off-by: Akinobu Mita Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org --- drivers/mtd/chips/cfi_cmdset_0001.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e1e122f..9bcd1f4 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -2526,12 +2526,10 @@ static void cfi_intelext_restore_locks(struct mtd_info *mtd) if (!region->lockmap) continue; - for (block = 0; block < region->numblocks; block++) { + for_each_clear_bit(block, region->lockmap, region->numblocks) { len = region->erasesize; adr = region->offset + block * len; - - if (!test_bit(block, region->lockmap)) - cfi_intelext_unlock(mtd, adr, len); + cfi_intelext_unlock(mtd, adr, len); } } }