mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-mtd@lists.infradead.org
Subject: [PATCH 4/7] mtd: use for_each_clear_bit
Date: Sat, 14 Jan 2012 00:53:21 +0900	[thread overview]
Message-ID: <1326470004-10096-5-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1326470004-10096-1-git-send-email-akinobu.mita@gmail.com>

Use for_each_clear_bit() to iterate over all the cleared bit in a
memory region.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
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);
 		}
 	}
 }
-- 
1.7.4.4


  parent reply	other threads:[~2012-01-13 15:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 15:53 [PATCH 0/7] bitops: introduce for_each_clear_bit() Akinobu Mita
2012-01-13 15:53 ` [PATCH 1/7] bitops: rename for_each_set_bit_cont in favor of anologous to list.h function Akinobu Mita
2012-01-13 15:53 ` [PATCH 2/7] bitops: remove for_each_set_bit_cont Akinobu Mita
2012-01-13 15:53 ` [PATCH 3/7] bitops: introduce list_for_each_clear_bit Akinobu Mita
2012-01-13 17:16   ` Sergei Shtylyov
2012-01-13 23:36     ` Akinobu Mita
2012-01-13 15:53 ` Akinobu Mita [this message]
2012-01-13 15:53 ` [PATCH 5/7] s390/char: use for_each_clear_bit Akinobu Mita
2012-01-13 15:53 ` [PATCH 6/7] uwb: " Akinobu Mita
2012-01-13 15:53 ` [PATCH 7/7] x86: use for_each_clear_bit_from Akinobu Mita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326470004-10096-5-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome