aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/wl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/wl.c')
-rw-r--r--drivers/mtd/ubi/wl.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 655bbbe415d9..b4cf57db2556 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -161,7 +161,7 @@ struct ubi_work {
161 int torture; 161 int torture;
162}; 162};
163 163
164#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID 164#ifdef CONFIG_MTD_UBI_DEBUG
165static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec); 165static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec);
166static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, 166static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e,
167 struct rb_root *root); 167 struct rb_root *root);
@@ -613,7 +613,7 @@ static void schedule_ubi_work(struct ubi_device *ubi, struct ubi_work *wrk)
613 list_add_tail(&wrk->list, &ubi->works); 613 list_add_tail(&wrk->list, &ubi->works);
614 ubi_assert(ubi->works_count >= 0); 614 ubi_assert(ubi->works_count >= 0);
615 ubi->works_count += 1; 615 ubi->works_count += 1;
616 if (ubi->thread_enabled) 616 if (ubi->thread_enabled && !ubi_dbg_is_bgt_disabled())
617 wake_up_process(ubi->bgt_thread); 617 wake_up_process(ubi->bgt_thread);
618 spin_unlock(&ubi->wl_lock); 618 spin_unlock(&ubi->wl_lock);
619} 619}
@@ -1364,7 +1364,7 @@ int ubi_thread(void *u)
1364 1364
1365 spin_lock(&ubi->wl_lock); 1365 spin_lock(&ubi->wl_lock);
1366 if (list_empty(&ubi->works) || ubi->ro_mode || 1366 if (list_empty(&ubi->works) || ubi->ro_mode ||
1367 !ubi->thread_enabled) { 1367 !ubi->thread_enabled || ubi_dbg_is_bgt_disabled()) {
1368 set_current_state(TASK_INTERRUPTIBLE); 1368 set_current_state(TASK_INTERRUPTIBLE);
1369 spin_unlock(&ubi->wl_lock); 1369 spin_unlock(&ubi->wl_lock);
1370 schedule(); 1370 schedule();
@@ -1561,7 +1561,7 @@ void ubi_wl_close(struct ubi_device *ubi)
1561 kfree(ubi->lookuptbl); 1561 kfree(ubi->lookuptbl);
1562} 1562}
1563 1563
1564#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID 1564#ifdef CONFIG_MTD_UBI_DEBUG
1565 1565
1566/** 1566/**
1567 * paranoid_check_ec - make sure that the erase counter of a PEB is correct. 1567 * paranoid_check_ec - make sure that the erase counter of a PEB is correct.
@@ -1578,6 +1578,9 @@ static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec)
1578 long long read_ec; 1578 long long read_ec;
1579 struct ubi_ec_hdr *ec_hdr; 1579 struct ubi_ec_hdr *ec_hdr;
1580 1580
1581 if (!(ubi_chk_flags & UBI_CHK_GEN))
1582 return 0;
1583
1581 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); 1584 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
1582 if (!ec_hdr) 1585 if (!ec_hdr)
1583 return -ENOMEM; 1586 return -ENOMEM;
@@ -1614,6 +1617,9 @@ out_free:
1614static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, 1617static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e,
1615 struct rb_root *root) 1618 struct rb_root *root)
1616{ 1619{
1620 if (!(ubi_chk_flags & UBI_CHK_GEN))
1621 return 0;
1622
1617 if (in_wl_tree(e, root)) 1623 if (in_wl_tree(e, root))
1618 return 0; 1624 return 0;
1619 1625
@@ -1636,6 +1642,9 @@ static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e)
1636 struct ubi_wl_entry *p; 1642 struct ubi_wl_entry *p;
1637 int i; 1643 int i;
1638 1644
1645 if (!(ubi_chk_flags & UBI_CHK_GEN))
1646 return 0;
1647
1639 for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i) 1648 for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i)
1640 list_for_each_entry(p, &ubi->pq[i], u.list) 1649 list_for_each_entry(p, &ubi->pq[i], u.list)
1641 if (p == e) 1650 if (p == e)
@@ -1646,4 +1655,5 @@ static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e)
1646 ubi_dbg_dump_stack(); 1655 ubi_dbg_dump_stack();
1647 return -EINVAL; 1656 return -EINVAL;
1648} 1657}
1649#endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ 1658
1659#endif /* CONFIG_MTD_UBI_DEBUG */