mtd: nand: remove unused NAND_OWN_BUFFERS flag
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 5 Dec 2017 08:47:15 +0000 (17:47 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 14 Dec 2017 12:34:19 +0000 (13:34 +0100)
The last/only user of NAND_OWN_BUFFERS (cafe_nand.c) has been reworked.
This flag is no longer needed.

Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/nand_base.c
include/linux/mtd/rawnand.h

index 215c52a..b63cc95 100644 (file)
@@ -5319,35 +5319,30 @@ int nand_scan_tail(struct mtd_info *mtd)
                return -EINVAL;
        }
 
-       if (!(chip->options & NAND_OWN_BUFFERS)) {
-               nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL);
-               if (!nbuf)
-                       return -ENOMEM;
-
-               nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL);
-               if (!nbuf->ecccalc) {
-                       ret = -ENOMEM;
-                       goto err_free_nbuf;
-               }
+       nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL);
+       if (!nbuf)
+               return -ENOMEM;
 
-               nbuf->ecccode = kmalloc(mtd->oobsize, GFP_KERNEL);
-               if (!nbuf->ecccode) {
-                       ret = -ENOMEM;
-                       goto err_free_nbuf;
-               }
+       nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL);
+       if (!nbuf->ecccalc) {
+               ret = -ENOMEM;
+               goto err_free_nbuf;
+       }
 
-               nbuf->databuf = kmalloc(mtd->writesize + mtd->oobsize,
-                                       GFP_KERNEL);
-               if (!nbuf->databuf) {
-                       ret = -ENOMEM;
-                       goto err_free_nbuf;
-               }
+       nbuf->ecccode = kmalloc(mtd->oobsize, GFP_KERNEL);
+       if (!nbuf->ecccode) {
+               ret = -ENOMEM;
+               goto err_free_nbuf;
+       }
 
-               chip->buffers = nbuf;
-       } else if (!chip->buffers) {
-               return -ENOMEM;
+       nbuf->databuf = kmalloc(mtd->writesize + mtd->oobsize, GFP_KERNEL);
+       if (!nbuf->databuf) {
+               ret = -ENOMEM;
+               goto err_free_nbuf;
        }
 
+       chip->buffers = nbuf;
+
        /*
         * FIXME: some NAND manufacturer drivers expect the first die to be
         * selected when manufacturer->init() is called. They should be fixed
@@ -5701,7 +5696,7 @@ void nand_cleanup(struct nand_chip *chip)
 
        /* Free bad block table memory */
        kfree(chip->bbt);
-       if (!(chip->options & NAND_OWN_BUFFERS) && chip->buffers) {
+       if (chip->buffers) {
                kfree(chip->buffers->databuf);
                kfree(chip->buffers->ecccode);
                kfree(chip->buffers->ecccalc);
index 2a72eab..fca802e 100644 (file)
@@ -185,11 +185,6 @@ enum nand_ecc_algo {
 /* Non chip related options */
 /* This option skips the bbt scan during initialization. */
 #define NAND_SKIP_BBTSCAN      0x00010000
-/*
- * This option is defined if the board driver allocates its own buffers
- * (e.g. because it needs them DMA-coherent).
- */
-#define NAND_OWN_BUFFERS       0x00020000
 /* Chip may not exist, so silence any errors in scan */
 #define NAND_SCAN_SILENT_NODEV 0x00040000
 /*