mtd: mtdswap: use MTDSWAP_ECNT_MIN/MAX
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 13:54:33 +0000 (21:54 +0800)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 19 Apr 2017 20:12:02 +0000 (13:12 -0700)
Since macros MTDSWAP_ECNT_MIN() and MTDSWAP_ECNT_MAX() have been
defined in mtdswap.c, use them instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/mtdswap.c

index c40e2c951758ee0bf880159bfda32f35e67c2253..f12879a3d4ff52bc1ce0e0f794bab4d5a689c25f 100644 (file)
@@ -1235,10 +1235,8 @@ static int mtdswap_show(struct seq_file *s, void *data)
 
                if (root->rb_node) {
                        count[i] = d->trees[i].count;
-                       min[i] = rb_entry(rb_first(root), struct swap_eb,
-                                       rb)->erase_count;
-                       max[i] = rb_entry(rb_last(root), struct swap_eb,
-                                       rb)->erase_count;
+                       min[i] = MTDSWAP_ECNT_MIN(root);
+                       max[i] = MTDSWAP_ECNT_MAX(root);
                } else
                        count[i] = 0;
        }