Skip to content

Commit d99383b

Browse files
Artem BityutskiyArtem Bityutskiy
authored andcommitted
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>
1 parent 55922c9 commit d99383b

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

drivers/mtd/ubi/wl.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* @ubi: UBI device description object
23
* Copyright (c) International Business Machines Corp., 2006
34
*
45
* This program is free software; you can redistribute it and/or modify
@@ -163,12 +164,14 @@ struct ubi_work {
163164

164165
#ifdef CONFIG_MTD_UBI_DEBUG
165166
static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec);
166-
static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e,
167+
static int paranoid_check_in_wl_tree(const struct ubi_device *ubi,
168+
struct ubi_wl_entry *e,
167169
struct rb_root *root);
168-
static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e);
170+
static int paranoid_check_in_pq(const struct ubi_device *ubi,
171+
struct ubi_wl_entry *e);
169172
#else
170173
#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)
172175
#define paranoid_check_in_pq(ubi, e) 0
173176
#endif
174177

@@ -449,7 +452,7 @@ int ubi_wl_get_peb(struct ubi_device *ubi, int dtype)
449452
BUG();
450453
}
451454

452-
paranoid_check_in_wl_tree(e, &ubi->free);
455+
paranoid_check_in_wl_tree(ubi, e, &ubi->free);
453456

454457
/*
455458
* 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,
712715
e1->ec, e2->ec);
713716
goto out_cancel;
714717
}
715-
paranoid_check_in_wl_tree(e1, &ubi->used);
718+
paranoid_check_in_wl_tree(ubi, e1, &ubi->used);
716719
rb_erase(&e1->u.rb, &ubi->used);
717720
dbg_wl("move PEB %d EC %d to PEB %d EC %d",
718721
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,
721724
scrubbing = 1;
722725
e1 = rb_entry(rb_first(&ubi->scrub), struct ubi_wl_entry, u.rb);
723726
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);
725728
rb_erase(&e1->u.rb, &ubi->scrub);
726729
dbg_wl("scrub PEB %d to PEB %d", e1->pnum, e2->pnum);
727730
}
728731

729-
paranoid_check_in_wl_tree(e2, &ubi->free);
732+
paranoid_check_in_wl_tree(ubi, e2, &ubi->free);
730733
rb_erase(&e2->u.rb, &ubi->free);
731734
ubi->move_from = e1;
732735
ubi->move_to = e2;
@@ -1169,13 +1172,13 @@ int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture)
11691172
return 0;
11701173
} else {
11711174
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);
11731176
rb_erase(&e->u.rb, &ubi->used);
11741177
} 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);
11761179
rb_erase(&e->u.rb, &ubi->scrub);
11771180
} 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);
11791182
rb_erase(&e->u.rb, &ubi->erroneous);
11801183
ubi->erroneous_peb_count -= 1;
11811184
ubi_assert(ubi->erroneous_peb_count >= 0);
@@ -1242,7 +1245,7 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum)
12421245
}
12431246

12441247
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);
12461249
rb_erase(&e->u.rb, &ubi->used);
12471250
} else {
12481251
int err;
@@ -1609,13 +1612,15 @@ static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec)
16091612

16101613
/**
16111614
* paranoid_check_in_wl_tree - check that wear-leveling entry is in WL RB-tree.
1615+
* @ubi: UBI device description object
16121616
* @e: the wear-leveling entry to check
16131617
* @root: the root of the tree
16141618
*
16151619
* This function returns zero if @e is in the @root RB-tree and %-EINVAL if it
16161620
* is not.
16171621
*/
1618-
static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e,
1622+
static int paranoid_check_in_wl_tree(const struct ubi_device *ubi,
1623+
struct ubi_wl_entry *e,
16191624
struct rb_root *root)
16201625
{
16211626
if (!(ubi_chk_flags & UBI_CHK_GEN))
@@ -1638,7 +1643,8 @@ static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e,
16381643
*
16391644
* This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not.
16401645
*/
1641-
static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e)
1646+
static int paranoid_check_in_pq(const struct ubi_device *ubi,
1647+
struct ubi_wl_entry *e)
16421648
{
16431649
struct ubi_wl_entry *p;
16441650
int i;

0 commit comments

Comments
 (0)