]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/mtdcore.c
sunxi_nand_spl: Remove NAND_SUNXI_SPL_SYNDROME_PARTITIONS_END
[karo-tx-uboot.git] / drivers / mtd / mtdcore.c
index 6ad03575f64e75d281ff258732ea2ca884172d18..2f2172b98781ccbbb047fc68801b65d53c400f59 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#define __UBOOT__
 #ifndef __UBOOT__
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -804,7 +803,7 @@ void mtd_get_len_incl_bad(struct mtd_info *mtd, uint64_t offset,
        *truncated = 0;
        *len_incl_bad = 0;
 
-       if (!mtd->block_isbad) {
+       if (!mtd->_block_isbad) {
                *len_incl_bad = length;
                return;
        }
@@ -820,7 +819,7 @@ void mtd_get_len_incl_bad(struct mtd_info *mtd, uint64_t offset,
 
                block_len = mtd->erasesize - (offset & (mtd->erasesize - 1));
 
-               if (!mtd->block_isbad(mtd, offset & ~(mtd->erasesize - 1)))
+               if (!mtd->_block_isbad(mtd, offset & ~(mtd->erasesize - 1)))
                        len_excl_bad += block_len;
 
                *len_incl_bad += block_len;
@@ -1126,12 +1125,22 @@ int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 }
 EXPORT_SYMBOL_GPL(mtd_is_locked);
 
-int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
+int mtd_block_isreserved(struct mtd_info *mtd, loff_t ofs)
 {
-       if (!mtd->_block_isbad)
+       if (ofs < 0 || ofs > mtd->size)
+               return -EINVAL;
+       if (!mtd->_block_isreserved)
                return 0;
+       return mtd->_block_isreserved(mtd, ofs);
+}
+EXPORT_SYMBOL_GPL(mtd_block_isreserved);
+
+int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
+{
        if (ofs < 0 || ofs > mtd->size)
                return -EINVAL;
+       if (!mtd->_block_isbad)
+               return 0;
        return mtd->_block_isbad(mtd, ofs);
 }
 EXPORT_SYMBOL_GPL(mtd_block_isbad);