-static int
-read_bmt(u16 block, unsigned char *dat, unsigned char *fdm, int fdm_len)
-{
- u32 len = bmtd.bmt_pgs << bmtd.pg_shift;
-
- return bbt_nand_read(blk_pg(block), dat, len, fdm, fdm_len);
-}
-
-static struct bbbt *scan_bmt(u16 block)
-{
- u8 fdm[4];
-
- if (block < bmtd.pool_lba)
- return NULL;
-
- if (read_bmt(block, bmtd.bbt_buf, fdm, sizeof(fdm)))
- return scan_bmt(block - 1);
-
- if (is_valid_bmt(bmtd.bbt_buf, fdm)) {
- bmtd.bmt_blk_idx = get_bmt_index(bmt_tbl((struct bbbt *)bmtd.bbt_buf));
- if (bmtd.bmt_blk_idx == 0) {
- pr_info("[BBT] FATAL ERR: bmt block index is wrong!\n");
- return NULL;
- }
- pr_info("[BBT] BMT.v2 is found at 0x%x\n", block);
- return (struct bbbt *)bmtd.bbt_buf;
- } else
- return scan_bmt(block - 1);
-}
-