aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-18 07:47:34 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-31 09:14:05 -0400
commitd99383b00eba9c6ac3dea462d718b2849012ee03 (patch)
treeb2c5af920980525dfbe5a1f245e07b26933dd51f /drivers/mtd
parent55922c9d1b84b89cb946c777fddccb3247e7df2c (diff)
UBI: change the interface of a debugging check function
This is a minor preparational patch which changes the 'paranoid_check_in_wl_tree()' function interface by adding the 'ubi' parameter which will be needed there in the next patch. And while on it, add "const" qualifier to the 'ubi' parameter of the 'paranoid_check_in_pq()' function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/wl.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index ff2c4956eeff..d5076d2cce39 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * @ubi: UBI device description object
2 * Copyright (c) International Business Machines Corp., 2006 3 * Copyright (c) International Business Machines Corp., 2006
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -163,12 +164,14 @@ struct ubi_work {
163 164
164#ifdef CONFIG_MTD_UBI_DEBUG 165#ifdef CONFIG_MTD_UBI_DEBUG
165static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec); 166static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec);
166static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, 167static int paranoid_check_in_wl_tree(const struct ubi_device *ubi,
168 struct ubi_wl_entry *e,
167 struct rb_root *root); 169 struct rb_root *root);
168static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e); 170static int paranoid_check_in_pq(const struct ubi_device *ubi,
171 struct ubi_wl_entry *e);
169#else 172#else
170#define paranoid_check_ec(ubi, pnum, ec) 0 173#define paranoid_check_ec(ubi, pnum, ec) 0
171#define paranoid_check_in_wl_tree(e, root) 174#define paranoid_check_in_wl_tree(ubi, e, root)
172#define paranoid_check_in_pq(ubi, e) 0 175#define paranoid_check_in_pq(ubi, e) 0
173#endif 176#endif
174 177
@@ -449,7 +452,7 @@ retry:
449 BUG(); 452 BUG();
450 } 453 }
451 454
452 paranoid_check_in_wl_tree(e, &ubi->free); 455 paranoid_check_in_wl_tree(ubi, e, &ubi->free);
453 456
454 /* 457 /*
455 * Move the physical eraseblock to the protection queue where it will 458 * Move the physical eraseblock to the protection queue where it will
@@ -712,7 +715,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
712 e1->ec, e2->ec); 715 e1->ec, e2->ec);
713 goto out_cancel; 716 goto out_cancel;
714 } 717 }
715 paranoid_check_in_wl_tree(e1, &ubi->used); 718 paranoid_check_in_wl_tree(ubi, e1, &ubi->used);
716 rb_erase(&e1->u.rb, &ubi->used); 719 rb_erase(&e1->u.rb, &ubi->used);
717 dbg_wl("move PEB %d EC %d to PEB %d EC %d", 720 dbg_wl("move PEB %d EC %d to PEB %d EC %d",
718 e1->pnum, e1->ec, e2->pnum, e2->ec); 721 e1->pnum, e1->ec, e2->pnum, e2->ec);
@@ -721,12 +724,12 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
721 scrubbing = 1; 724 scrubbing = 1;
722 e1 = rb_entry(rb_first(&ubi->scrub), struct ubi_wl_entry, u.rb); 725 e1 = rb_entry(rb_first(&ubi->scrub), struct ubi_wl_entry, u.rb);
723 e2 = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF); 726 e2 = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF);
724 paranoid_check_in_wl_tree(e1, &ubi->scrub); 727 paranoid_check_in_wl_tree(ubi, e1, &ubi->scrub);
725 rb_erase(&e1->u.rb, &ubi->scrub); 728 rb_erase(&e1->u.rb, &ubi->scrub);
726 dbg_wl("scrub PEB %d to PEB %d", e1->pnum, e2->pnum); 729 dbg_wl("scrub PEB %d to PEB %d", e1->pnum, e2->pnum);
727 } 730 }
728 731
729 paranoid_check_in_wl_tree(e2, &ubi->free); 732 paranoid_check_in_wl_tree(ubi, e2, &ubi->free);
730 rb_erase(&e2->u.rb, &ubi->free); 733 rb_erase(&e2->u.rb, &ubi->free);
731 ubi->move_from = e1; 734 ubi->move_from = e1;
732 ubi->move_to = e2; 735 ubi->move_to = e2;
@@ -1169,13 +1172,13 @@ retry:
1169 return 0; 1172 return 0;
1170 } else { 1173 } else {
1171 if (in_wl_tree(e, &ubi->used)) { 1174 if (in_wl_tree(e, &ubi->used)) {
1172 paranoid_check_in_wl_tree(e, &ubi->used); 1175 paranoid_check_in_wl_tree(ubi, e, &ubi->used);
1173 rb_erase(&e->u.rb, &ubi->used); 1176 rb_erase(&e->u.rb, &ubi->used);
1174 } else if (in_wl_tree(e, &ubi->scrub)) { 1177 } else if (in_wl_tree(e, &ubi->scrub)) {
1175 paranoid_check_in_wl_tree(e, &ubi->scrub); 1178 paranoid_check_in_wl_tree(ubi, e, &ubi->scrub);
1176 rb_erase(&e->u.rb, &ubi->scrub); 1179 rb_erase(&e->u.rb, &ubi->scrub);
1177 } else if (in_wl_tree(e, &ubi->erroneous)) { 1180 } else if (in_wl_tree(e, &ubi->erroneous)) {
1178 paranoid_check_in_wl_tree(e, &ubi->erroneous); 1181 paranoid_check_in_wl_tree(ubi, e, &ubi->erroneous);
1179 rb_erase(&e->u.rb, &ubi->erroneous); 1182 rb_erase(&e->u.rb, &ubi->erroneous);
1180 ubi->erroneous_peb_count -= 1; 1183 ubi->erroneous_peb_count -= 1;
1181 ubi_assert(ubi->erroneous_peb_count >= 0); 1184 ubi_assert(ubi->erroneous_peb_count >= 0);
@@ -1242,7 +1245,7 @@ retry:
1242 } 1245 }
1243 1246
1244 if (in_wl_tree(e, &ubi->used)) { 1247 if (in_wl_tree(e, &ubi->used)) {
1245 paranoid_check_in_wl_tree(e, &ubi->used); 1248 paranoid_check_in_wl_tree(ubi, e, &ubi->used);
1246 rb_erase(&e->u.rb, &ubi->used); 1249 rb_erase(&e->u.rb, &ubi->used);
1247 } else { 1250 } else {
1248 int err; 1251 int err;
@@ -1609,13 +1612,15 @@ out_free:
1609 1612
1610/** 1613/**
1611 * paranoid_check_in_wl_tree - check that wear-leveling entry is in WL RB-tree. 1614 * paranoid_check_in_wl_tree - check that wear-leveling entry is in WL RB-tree.
1615 * @ubi: UBI device description object
1612 * @e: the wear-leveling entry to check 1616 * @e: the wear-leveling entry to check
1613 * @root: the root of the tree 1617 * @root: the root of the tree
1614 * 1618 *
1615 * This function returns zero if @e is in the @root RB-tree and %-EINVAL if it 1619 * This function returns zero if @e is in the @root RB-tree and %-EINVAL if it
1616 * is not. 1620 * is not.
1617 */ 1621 */
1618static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, 1622static int paranoid_check_in_wl_tree(const struct ubi_device *ubi,
1623 struct ubi_wl_entry *e,
1619 struct rb_root *root) 1624 struct rb_root *root)
1620{ 1625{
1621 if (!(ubi_chk_flags & UBI_CHK_GEN)) 1626 if (!(ubi_chk_flags & UBI_CHK_GEN))
@@ -1638,7 +1643,8 @@ static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e,
1638 * 1643 *
1639 * This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not. 1644 * This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not.
1640 */ 1645 */
1641static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e) 1646static int paranoid_check_in_pq(const struct ubi_device *ubi,
1647 struct ubi_wl_entry *e)
1642{ 1648{
1643 struct ubi_wl_entry *p; 1649 struct ubi_wl_entry *p;
1644 int i; 1650 int i;