1
1
/*
2
+ * @ubi: UBI device description object
2
3
* Copyright (c) International Business Machines Corp., 2006
3
4
*
4
5
* This program is free software; you can redistribute it and/or modify
@@ -163,12 +164,14 @@ struct ubi_work {
163
164
164
165
#ifdef CONFIG_MTD_UBI_DEBUG
165
166
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 ,
167
169
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 );
169
172
#else
170
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
175
#define paranoid_check_in_pq (ubi , e ) 0
173
176
#endif
174
177
@@ -449,7 +452,7 @@ int ubi_wl_get_peb(struct ubi_device *ubi, int dtype)
449
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
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
715
e1 -> ec , e2 -> ec );
713
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
719
rb_erase (& e1 -> u .rb , & ubi -> used );
717
720
dbg_wl ("move PEB %d EC %d to PEB %d EC %d" ,
718
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
724
scrubbing = 1 ;
722
725
e1 = rb_entry (rb_first (& ubi -> scrub ), struct ubi_wl_entry , u .rb );
723
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
728
rb_erase (& e1 -> u .rb , & ubi -> scrub );
726
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
733
rb_erase (& e2 -> u .rb , & ubi -> free );
731
734
ubi -> move_from = e1 ;
732
735
ubi -> move_to = e2 ;
@@ -1169,13 +1172,13 @@ int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture)
1169
1172
return 0 ;
1170
1173
} else {
1171
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
1176
rb_erase (& e -> u .rb , & ubi -> used );
1174
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
1179
rb_erase (& e -> u .rb , & ubi -> scrub );
1177
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
1182
rb_erase (& e -> u .rb , & ubi -> erroneous );
1180
1183
ubi -> erroneous_peb_count -= 1 ;
1181
1184
ubi_assert (ubi -> erroneous_peb_count >= 0 );
@@ -1242,7 +1245,7 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum)
1242
1245
}
1243
1246
1244
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
1249
rb_erase (& e -> u .rb , & ubi -> used );
1247
1250
} else {
1248
1251
int err ;
@@ -1609,13 +1612,15 @@ static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec)
1609
1612
1610
1613
/**
1611
1614
* paranoid_check_in_wl_tree - check that wear-leveling entry is in WL RB-tree.
1615
+ * @ubi: UBI device description object
1612
1616
* @e: the wear-leveling entry to check
1613
1617
* @root: the root of the tree
1614
1618
*
1615
1619
* This function returns zero if @e is in the @root RB-tree and %-EINVAL if it
1616
1620
* is not.
1617
1621
*/
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 ,
1619
1624
struct rb_root * root )
1620
1625
{
1621
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
1644
* This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not.
1640
1645
*/
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 )
1642
1648
{
1643
1649
struct ubi_wl_entry * p ;
1644
1650
int i ;
0 commit comments