Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1468343

[PATCH 6/7] UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb()

From Boris Brezillon <boris.brezillon@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH 6/7] UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb()
Date 2016-08-23 09:40 +0200
Message-ID <s9etr-Qx-1@gated-at.bofh.it> (permalink)
References <s9etr-Qx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use the ubi_rb_for_each_entry() macro instead of open-coding it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/mtd/ubi/fastmap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index bae80699c2f2..1bfb4aeb67d4 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -385,12 +385,8 @@ static void unmap_peb(struct ubi_attach_info *ai, int pnum)
 	struct rb_node *node, *node2;
 	struct ubi_ainf_peb *aeb;
 
-	for (node = rb_first(&ai->volumes); node; node = rb_next(node)) {
-		av = rb_entry(node, struct ubi_ainf_volume, rb);
-
-		for (node2 = rb_first(&av->root); node2;
-		     node2 = rb_next(node2)) {
-			aeb = rb_entry(node2, struct ubi_ainf_peb, u.rb);
+	ubi_rb_for_each_entry(node, av, &ai->volumes, rb) {
+		ubi_rb_for_each_entry(node2, aeb, &av->root, u.rb) {
 			if (aeb->pnum == pnum) {
 				rb_erase(&aeb->u.rb, &av->root);
 				av->leb_count--;
-- 
2.7.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 6/7] UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-08-23 09:40 +0200

csiph-web