summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/fastmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/fastmap.c')
-rw-r--r--drivers/mtd/ubi/fastmap.c48
1 files changed, 2 insertions, 46 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index d64bfb986d40..8f6052cb3217 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1390,50 +1390,6 @@ out:
}
/**
- * erase_block - Manually erase a PEB.
- * @ubi: UBI device object
- * @e: the physical eraseblock to erase
- *
- * This function returns zero in case of success and a negative error code in
- * case of failure.
- */
-static int erase_block(struct ubi_device *ubi, struct ubi_wl_entry *e)
-{
- int err;
- struct ubi_ec_hdr *ec_hdr;
- long long ec = e->ec;
-
- ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
- if (!ec_hdr)
- return -ENOMEM;
-
- err = ubi_io_sync_erase(ubi, e->pnum, 0);
- if (err < 0)
- goto out;
-
- ec += err;
- if (ec > UBI_MAX_ERASECOUNTER) {
- err = -EINVAL;
- goto out;
- }
-
- ec_hdr->ec = cpu_to_be64(ec);
- err = ubi_io_write_ec_hdr(ubi, e->pnum, ec_hdr);
- if (err < 0)
- goto out;
-
- e->ec = ec;
- spin_lock(&ubi->wl_lock);
- if (e->ec > ubi->max_ec)
- ubi->max_ec = e->ec;
- spin_unlock(&ubi->wl_lock);
-
-out:
- kfree(ec_hdr);
- return err;
-}
-
-/**
* invalidate_fastmap - destroys a fastmap.
* @ubi: UBI device object
*
@@ -1573,7 +1529,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
if (!tmp_e) {
if (old_fm && old_fm->e[i]) {
- ret = erase_block(ubi, old_fm->e[i]);
+ ret = ubi_sync_erase(ubi, old_fm->e[i], 0);
if (ret < 0) {
ubi_err(ubi, "could not erase old fastmap PEB");
@@ -1625,7 +1581,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
if (old_fm) {
/* no fresh anchor PEB was found, reuse the old one */
if (!tmp_e) {
- ret = erase_block(ubi, old_fm->e[0]);
+ ret = ubi_sync_erase(ubi, old_fm->e[0], 0);
if (ret < 0) {
ubi_err(ubi, "could not erase old anchor PEB");