]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
mtd: rawnand: remove ->legacy.erase and single_erase()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 21 Jan 2019 06:32:07 +0000 (15:32 +0900)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 5 Feb 2019 15:56:11 +0000 (16:56 +0100)
Now that the last user of this hook, denali.c, stopped using it,
we can remove the erase hook from nand_legacy.

I squashed single_erase() because only the difference between
single_erase() and nand_erase_op() is the number of bit shifts.

The status/ret conversion in nand_erase_nand() is unneeded since
commit eb94555e9e97 ("mtd: nand: use usual return values for the
->erase() hook"). Cleaned it up now.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Boris Brezillon <bbrezillon@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/nand_base.c
include/linux/mtd/rawnand.h

index e05ecf2e426968d640838c3d0555737f800b35b0..cf207d6e7a81f06f869291caeae8d61b384e9e19 100644 (file)
@@ -4121,23 +4121,6 @@ out:
        return ret;
 }
 
-/**
- * single_erase - [GENERIC] NAND standard block erase command function
- * @chip: NAND chip object
- * @page: the page address of the block which will be erased
- *
- * Standard erase command for NAND chips. Returns NAND status.
- */
-static int single_erase(struct nand_chip *chip, int page)
-{
-       unsigned int eraseblock;
-
-       /* Send commands to erase a block */
-       eraseblock = page >> (chip->phys_erase_shift - chip->page_shift);
-
-       return nand_erase_op(chip, eraseblock);
-}
-
 /**
  * nand_erase - [MTD Interface] erase block(s)
  * @mtd: MTD device structure
@@ -4161,7 +4144,7 @@ static int nand_erase(struct mtd_info *mtd, struct erase_info *instr)
 int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr,
                    int allowbbt)
 {
-       int page, status, pages_per_block, ret, chipnr;
+       int page, pages_per_block, ret, chipnr;
        loff_t len;
 
        pr_debug("%s: start = 0x%012llx, len = %llu\n",
@@ -4215,17 +4198,11 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr,
                    (page + pages_per_block))
                        chip->pagebuf = -1;
 
-               if (chip->legacy.erase)
-                       status = chip->legacy.erase(chip,
-                                                   page & chip->pagemask);
-               else
-                       status = single_erase(chip, page & chip->pagemask);
-
-               /* See if block erase succeeded */
-               if (status) {
+               ret = nand_erase_op(chip, (page & chip->pagemask) >>
+                                   (chip->phys_erase_shift - chip->page_shift));
+               if (ret) {
                        pr_debug("%s: failed erase, page 0x%08x\n",
                                        __func__, page);
-                       ret = -EIO;
                        instr->fail_addr =
                                ((loff_t)page << chip->page_shift);
                        goto erase_exit;
index 17d2d9ae33bfc69b455cf457b763c170624b76a0..b7445a44a814f67a62692e47886d74d76e3a3b07 100644 (file)
@@ -927,7 +927,6 @@ static inline void nand_controller_init(struct nand_controller *nfc)
  * @waitfunc: hardware specific function for wait on ready.
  * @block_bad: check if a block is bad, using OOB markers
  * @block_markbad: mark a block bad
- * @erase: erase function
  * @set_features: set the NAND chip features
  * @get_features: get the NAND chip features
  * @chip_delay: chip dependent delay for transferring data from array to read
@@ -953,7 +952,6 @@ struct nand_legacy {
        int (*waitfunc)(struct nand_chip *chip);
        int (*block_bad)(struct nand_chip *chip, loff_t ofs);
        int (*block_markbad)(struct nand_chip *chip, loff_t ofs);
-       int (*erase)(struct nand_chip *chip, int page);
        int (*set_features)(struct nand_chip *chip, int feature_addr,
                            u8 *subfeature_para);
        int (*get_features)(struct nand_chip *chip, int feature_addr,