Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[firefly-linux-kernel-4.4.55.git] / drivers / mtd / nand / nand_base.c
index c54a4cbac6bc036f90496d65364e04e846ec7e18..a46e9bb847bd0ac52743f14ab07133cc9a98b231 100644 (file)
 #include <linux/bitops.h>
 #include <linux/leds.h>
 #include <linux/io.h>
-
-#ifdef CONFIG_MTD_PARTITIONS
 #include <linux/mtd/partitions.h>
-#endif
 
 /* Define default oob placement schemes for large and small page devices */
 static struct nand_ecclayout nand_oob_8 = {
@@ -976,9 +973,6 @@ int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
        ret = __nand_unlock(mtd, ofs, len, 0);
 
 out:
-       /* de-select the NAND device */
-       chip->select_chip(mtd, -1);
-
        nand_release_device(mtd);
 
        return ret;
@@ -1046,9 +1040,6 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
        ret = __nand_unlock(mtd, ofs, len, 0x1);
 
 out:
-       /* de-select the NAND device */
-       chip->select_chip(mtd, -1);
-
        nand_release_device(mtd);
 
        return ret;
@@ -3112,6 +3103,8 @@ ident_done:
                chip->chip_shift += 32 - 1;
        }
 
+       chip->badblockbits = 8;
+
        /* Set the bad block position */
        if (mtd->writesize > 512 || (busw & NAND_BUSWIDTH_16))
                chip->badblockpos = NAND_LARGE_BADBLOCK_POS;
@@ -3539,12 +3532,7 @@ void nand_release(struct mtd_info *mtd)
        if (chip->ecc.mode == NAND_ECC_SOFT_BCH)
                nand_bch_free((struct nand_bch_control *)chip->ecc.priv);
 
-#ifdef CONFIG_MTD_PARTITIONS
-       /* Deregister partitions */
-       del_mtd_partitions(mtd);
-#endif
-       /* Deregister the device */
-       del_mtd_device(mtd);
+       mtd_device_unregister(mtd);
 
        /* Free bad block table memory */
        kfree(chip->bbt);