summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/fastmap.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-09-16 14:59:24 (GMT)
committerRichard Weinberger <richard@nod.at>2016-10-02 20:48:14 (GMT)
commit1f81a5ccaba51c8884db8f060b9f606c29db931d (patch)
tree1406f364990a4022f17c8b65b44141b23e15ab44 /drivers/mtd/ubi/fastmap.c
parent7554769641da272ea8821194c2efda08a11014b0 (diff)
downloadlinux-1f81a5ccaba51c8884db8f060b9f606c29db931d.tar.xz
UBI: provide an helper to query LEB information
This is part of our attempt to hide EBA internals from other part of the implementation in order to easily adapt it to the MLC needs. Here we are creating an ubi_eba_leb_desc struct to hide the way we keep track of the LEB to PEB mapping. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/fastmap.c')
-rw-r--r--drivers/mtd/ubi/fastmap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 25e80a7..27a94f2 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1257,8 +1257,12 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
fm_pos += sizeof(*feba) + (sizeof(__be32) * vol->reserved_pebs);
ubi_assert(fm_pos <= ubi->fm_size);
- for (j = 0; j < vol->reserved_pebs; j++)
- feba->pnum[j] = cpu_to_be32(vol->eba_tbl[j]);
+ for (j = 0; j < vol->reserved_pebs; j++) {
+ struct ubi_eba_leb_desc ldesc;
+
+ ubi_eba_get_ldesc(vol, j, &ldesc);
+ feba->pnum[j] = cpu_to_be32(ldesc.pnum);
+ }
feba->reserved_pebs = cpu_to_be32(j);
feba->magic = cpu_to_be32(UBI_FM_EBA_MAGIC);