Make function static
Drop ability to by pass bbt
Added mtd_bad_block_count
Fix build warnings
Minor source cleanup