mtd: Stop updating erase_info->state and calling mtd_erase_callback()
authorBoris Brezillon <boris.brezillon@bootlin.com>
Mon, 12 Feb 2018 21:03:11 +0000 (22:03 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Wed, 21 Mar 2018 08:50:56 +0000 (09:50 +0100)
MTD users are no longer checking erase_info->state to determine if the
erase operation failed or succeeded. Moreover, mtd_erase_callback() is
now a NOP.

We can safely get rid of all mtd_erase_callback() calls and all
erase_info->state assignments. While at it, get rid of the
erase_info->state field, all MTD_ERASE_XXX definitions and the
mtd_erase_callback() function.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Bert Kenward <bkenward@solarflare.com>
---
Changes in v2:
- Address a few coding style issues (reported by Miquel)
- Remove comments that are no longer valid (reported by Miquel)

30 files changed:
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_cmdset_0020.c
drivers/mtd/chips/map_ram.c
drivers/mtd/devices/bcm47xxsflash.c
drivers/mtd/devices/block2mtd.c
drivers/mtd/devices/docg3.c
drivers/mtd/devices/lart.c
drivers/mtd/devices/mtd_dataflash.c
drivers/mtd/devices/mtdram.c
drivers/mtd/devices/phram.c
drivers/mtd/devices/pmc551.c
drivers/mtd/devices/powernv_flash.c
drivers/mtd/devices/slram.c
drivers/mtd/devices/spear_smi.c
drivers/mtd/devices/sst25l.c
drivers/mtd/devices/st_spi_fsm.c
drivers/mtd/lpddr/lpddr2_nvm.c
drivers/mtd/lpddr/lpddr_cmds.c
drivers/mtd/mtdconcat.c
drivers/mtd/mtdcore.c
drivers/mtd/mtdpart.c
drivers/mtd/nand/nand_base.c
drivers/mtd/onenand/onenand_base.c
drivers/mtd/spi-nor/spi-nor.c
drivers/mtd/ubi/gluebi.c
drivers/net/ethernet/sfc/falcon/mtd.c
drivers/net/ethernet/sfc/mtd.c
drivers/staging/goldfish/goldfish_nand.c
include/linux/mtd/mtd.h

index 5e1b68cbcd0acf736a9d28978b6b7ef37055c5cd..d4c07b85f18e598ef8c0f85e8ce6fd70c9709396 100644 (file)
@@ -1993,20 +1993,8 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
 
 static int cfi_intelext_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
 {
-       unsigned long ofs, len;
-       int ret;
-
-       ofs = instr->addr;
-       len = instr->len;
-
-       ret = cfi_varsize_frob(mtd, do_erase_oneblock, ofs, len, NULL);
-       if (ret)
-               return ret;
-
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
-       return 0;
+       return cfi_varsize_frob(mtd, do_erase_oneblock, instr->addr,
+                               instr->len, NULL);
 }
 
 static void cfi_intelext_sync (struct mtd_info *mtd)
index 56aa6b75213d86d0442823e9b4163118231f9f30..668e2cbc155bbe008858ba9a11a5467fb5fc39ba 100644 (file)
@@ -2415,20 +2415,8 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
 
 static int cfi_amdstd_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
 {
-       unsigned long ofs, len;
-       int ret;
-
-       ofs = instr->addr;
-       len = instr->len;
-
-       ret = cfi_varsize_frob(mtd, do_erase_oneblock, ofs, len, NULL);
-       if (ret)
-               return ret;
-
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
-       return 0;
+       return cfi_varsize_frob(mtd, do_erase_oneblock, instr->addr,
+                               instr->len, NULL);
 }
 
 
@@ -2436,7 +2424,6 @@ static int cfi_amdstd_erase_chip(struct mtd_info *mtd, struct erase_info *instr)
 {
        struct map_info *map = mtd->priv;
        struct cfi_private *cfi = map->fldrv_priv;
-       int ret = 0;
 
        if (instr->addr != 0)
                return -EINVAL;
@@ -2444,14 +2431,7 @@ static int cfi_amdstd_erase_chip(struct mtd_info *mtd, struct erase_info *instr)
        if (instr->len != mtd->size)
                return -EINVAL;
 
-       ret = do_erase_chip(map, &cfi->chips[0]);
-       if (ret)
-               return ret;
-
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
-       return 0;
+       return do_erase_chip(map, &cfi->chips[0]);
 }
 
 static int do_atmel_lock(struct map_info *map, struct flchip *chip,
index 7d342965f392232d89919a0182982e7764982b82..7b7658a05036d59c46ea7ca8e5db9322e59792aa 100644 (file)
@@ -965,9 +965,6 @@ static int cfi_staa_erase_varsize(struct mtd_info *mtd,
                }
        }
 
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
        return 0;
 }
 
index 1cd0fff0e9402d9c1ee477674be5b90611dcb561..c37fce92686407bbad54c0c4a8b4d6d78ffd4079 100644 (file)
@@ -131,8 +131,6 @@ static int mapram_erase (struct mtd_info *mtd, struct erase_info *instr)
        allff = map_word_ff(map);
        for (i=0; i<instr->len; i += map_bankwidth(map))
                map_write(map, allff, instr->addr + i);
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
        return 0;
 }
 
index 6b84947cfbea33174db9d09050e80e1c44d8ad20..9baa81b8780cefff65e6fec2fe69d96f1361240f 100644 (file)
@@ -68,7 +68,6 @@ static int bcm47xxsflash_poll(struct bcm47xxsflash *b47s, int timeout)
 static int bcm47xxsflash_erase(struct mtd_info *mtd, struct erase_info *erase)
 {
        struct bcm47xxsflash *b47s = mtd->priv;
-       int err;
 
        switch (b47s->type) {
        case BCM47XXSFLASH_TYPE_ST:
@@ -89,13 +88,7 @@ static int bcm47xxsflash_erase(struct mtd_info *mtd, struct erase_info *erase)
                break;
        }
 
-       err = bcm47xxsflash_poll(b47s, HZ);
-       if (err)
-               erase->state = MTD_ERASE_FAILED;
-       else
-               erase->state = MTD_ERASE_DONE;
-
-       return err;
+       return bcm47xxsflash_poll(b47s, HZ);
 }
 
 static int bcm47xxsflash_read(struct mtd_info *mtd, loff_t from, size_t len,
index bb0734600a07ed82f384b1dbc8569a17bc7ad817..c9e424993e37e1c9708e709a476461878553fe06 100644 (file)
@@ -88,17 +88,12 @@ static int block2mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
        size_t len = instr->len;
        int err;
 
-       instr->state = MTD_ERASING;
        mutex_lock(&dev->write_mutex);
        err = _block2mtd_erase(dev, from, len);
        mutex_unlock(&dev->write_mutex);
-       if (err) {
+       if (err)
                pr_err("erase failed err = %d\n", err);
-               instr->state = MTD_ERASE_FAILED;
-       } else
-               instr->state = MTD_ERASE_DONE;
 
-       mtd_erase_callback(instr);
        return err;
 }
 
index a85af236b44d7ff690e874f5c7f8db5d88ce1ae7..c594fe5eac085c337e3facdeb3306b3e07fef4ba 100644 (file)
@@ -1191,39 +1191,27 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *info)
 {
        struct docg3 *docg3 = mtd->priv;
        uint64_t len;
-       int block0, block1, page, ret, ofs = 0;
+       int block0, block1, page, ret = 0, ofs = 0;
 
        doc_dbg("doc_erase(from=%lld, len=%lld\n", info->addr, info->len);
 
-       info->state = MTD_ERASE_PENDING;
        calc_block_sector(info->addr + info->len, &block0, &block1, &page,
                          &ofs, docg3->reliable);
-       ret = -EINVAL;
        if (info->addr + info->len > mtd->size || page || ofs)
-               goto reset_err;
+               return -EINVAL;
 
-       ret = 0;
        calc_block_sector(info->addr, &block0, &block1, &page, &ofs,
                          docg3->reliable);
        mutex_lock(&docg3->cascade->lock);
        doc_set_device_id(docg3, docg3->device_id);
        doc_set_reliable_mode(docg3);
        for (len = info->len; !ret && len > 0; len -= mtd->erasesize) {
-               info->state = MTD_ERASING;
                ret = doc_erase_block(docg3, block0, block1);
                block0 += 2;
                block1 += 2;
        }
        mutex_unlock(&docg3->cascade->lock);
 
-       if (ret)
-               goto reset_err;
-
-       info->state = MTD_ERASE_DONE;
-       return 0;
-
-reset_err:
-       info->state = MTD_ERASE_FAILED;
        return ret;
 }
 
index 555b94406e0bb31a83c92fd03a70250cce015842..f67b653c17d70bd8d3fc08745f03963d174ea0ff 100644 (file)
@@ -414,10 +414,7 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
    while (len)
         {
                if (!erase_block (addr))
-                 {
-                        instr->state = MTD_ERASE_FAILED;
                         return (-EIO);
-                 }
 
                addr += mtd->eraseregions[i].erasesize;
                len -= mtd->eraseregions[i].erasesize;
@@ -425,9 +422,6 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
                if (addr == mtd->eraseregions[i].offset + (mtd->eraseregions[i].erasesize * mtd->eraseregions[i].numblocks)) i++;
         }
 
-   instr->state = MTD_ERASE_DONE;
-   mtd_erase_callback(instr);
-
    return (0);
 }
 
index 5dc8bd042cc54b2d07407f123d0ee62bce738594..aaaeaae01e1dfea48f57115d7519b27dfcc64fd6 100644 (file)
@@ -220,10 +220,6 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
        }
        mutex_unlock(&priv->lock);
 
-       /* Inform MTD subsystem that erase is complete */
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
        return 0;
 }
 
index 0bf4aeaf0cb8cf14665ee8474c3faeb68479fd88..46238796145ffad93092197b7dc76fa0ae9c91ef 100644 (file)
@@ -60,8 +60,7 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
        if (check_offs_len(mtd, instr->addr, instr->len))
                return -EINVAL;
        memset((char *)mtd->priv + instr->addr, 0xff, instr->len);
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
+
        return 0;
 }
 
index 7287696a21f91df6a875dc32a112e6206c855de1..9ee04b5f931139cbb6d119c6901c39a4a39cda0f 100644 (file)
@@ -39,13 +39,6 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
 
        memset(start + instr->addr, 0xff, instr->len);
 
-       /*
-        * This'll catch a few races. Free the thing before returning :)
-        * I don't feel at all ashamed. This kind of thing is possible anyway
-        * with flash, but unlikely.
-        */
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
        return 0;
 }
 
index cadea0620cd0547f2698fb1eaef880059dfec676..5d842cbca3de9768aa3211ecefef269d16065bae 100644 (file)
@@ -184,12 +184,10 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr)
        }
 
       out:
-       instr->state = MTD_ERASE_DONE;
 #ifdef CONFIG_MTD_PMC551_DEBUG
        printk(KERN_DEBUG "pmc551_erase() done\n");
 #endif
 
-       mtd_erase_callback(instr);
        return 0;
 }
 
index 26f9feaa5d17442a078468ad96af503744ac94c6..c1312b141ae0538cbaeed3b4ccde20109dd01a62 100644 (file)
@@ -175,19 +175,11 @@ static int powernv_flash_erase(struct mtd_info *mtd, struct erase_info *erase)
 {
        int rc;
 
-       erase->state = MTD_ERASING;
-
-       /* todo: register our own notifier to do a true async implementation */
        rc =  powernv_flash_async_op(mtd, FLASH_OP_ERASE, erase->addr,
                        erase->len, NULL, NULL);
-
-       if (rc) {
+       if (rc)
                erase->fail_addr = erase->addr;
-               erase->state = MTD_ERASE_FAILED;
-       } else {
-               erase->state = MTD_ERASE_DONE;
-       }
-       mtd_erase_callback(erase);
+
        return rc;
 }
 
index 0ec85f316d24c04e8503c8ca7625a3c16399a97b..10183ee4e12b283dc87729d9d3e6dd9326ed220a 100644 (file)
@@ -84,12 +84,7 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
        slram_priv_t *priv = mtd->priv;
 
        memset(priv->start + instr->addr, 0xff, instr->len);
-       /* This'll catch a few races. Free the thing before returning :)
-        * I don't feel at all ashamed. This kind of thing is possible anyway
-        * with flash, but unlikely.
-        */
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
+
        return(0);
 }
 
index ddf4789760136ca5770a291a4ef84116ebd0dff5..986f81d2f93e3d8cdceed38250dbdc8d48046663 100644 (file)
@@ -518,7 +518,6 @@ static int spear_mtd_erase(struct mtd_info *mtd, struct erase_info *e_info)
                /* preparing the command for flash */
                ret = spear_smi_erase_sector(dev, bank, command, 4);
                if (ret) {
-                       e_info->state = MTD_ERASE_FAILED;
                        mutex_unlock(&flash->lock);
                        return ret;
                }
@@ -527,8 +526,6 @@ static int spear_mtd_erase(struct mtd_info *mtd, struct erase_info *e_info)
        }
 
        mutex_unlock(&flash->lock);
-       e_info->state = MTD_ERASE_DONE;
-       mtd_erase_callback(e_info);
 
        return 0;
 }
index 5b84d71efb3642f179b5128ae2d4c6c76a4cdc31..1897f33fe3e71dea5c6d75e794f83a7bfe129082 100644 (file)
@@ -195,7 +195,6 @@ static int sst25l_erase(struct mtd_info *mtd, struct erase_info *instr)
                err = sst25l_erase_sector(flash, addr);
                if (err) {
                        mutex_unlock(&flash->lock);
-                       instr->state = MTD_ERASE_FAILED;
                        dev_err(&flash->spi->dev, "Erase failed\n");
                        return err;
                }
@@ -205,8 +204,6 @@ static int sst25l_erase(struct mtd_info *mtd, struct erase_info *instr)
 
        mutex_unlock(&flash->lock);
 
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
        return 0;
 }
 
index a33f5fd6818cb9a87b09a4f0af9b24a823c31d3a..55d4a77f3b7f5732b1db91e2b5910d9488228ee1 100644 (file)
@@ -1825,13 +1825,9 @@ static int stfsm_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
 
        mutex_unlock(&fsm->lock);
 
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
        return 0;
 
 out1:
-       instr->state = MTD_ERASE_FAILED;
        mutex_unlock(&fsm->lock);
 
        return ret;
index 2342277c9bcb063f3c1c4691ecfe467cac04dfa8..5d73db2a496de2693ade04d28bcfb25ce814d7db 100644 (file)
@@ -380,14 +380,8 @@ out:
  */
 static int lpddr2_nvm_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
-       int ret = lpddr2_nvm_do_block_op(mtd, instr->addr, instr->len,
-               LPDDR2_NVM_ERASE);
-       if (!ret) {
-               instr->state = MTD_ERASE_DONE;
-               mtd_erase_callback(instr);
-       }
-
-       return ret;
+       return lpddr2_nvm_do_block_op(mtd, instr->addr, instr->len,
+                                     LPDDR2_NVM_ERASE);
 }
 
 /*
index 018c75faadb3d30c2de119608536b1335d175fa4..5c5ba3c7c79d5ffa8a1d545e68fec32feae291dd 100644 (file)
@@ -693,8 +693,6 @@ static int lpddr_erase(struct mtd_info *mtd, struct erase_info *instr)
                ofs += size;
                len -= size;
        }
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
 
        return 0;
 }
index 93c47e56d9d8fbeddabffe8defe2e50443d336be..6b86d1a73cf2bb73084e4a8def0feb8ae79400e7 100644 (file)
@@ -446,7 +446,6 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
                erase->addr = 0;
                offset += subdev->size;
        }
-       instr->state = erase->state;
        kfree(erase);
 
        return err;
index f92ad02959ebc1bbfbe2e1687f20640c44203f9e..f25d65ea7149d0922797e8427833cfd82783db88 100644 (file)
@@ -961,11 +961,9 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
        if (!(mtd->flags & MTD_WRITEABLE))
                return -EROFS;
 
-       if (!instr->len) {
-               instr->state = MTD_ERASE_DONE;
-               mtd_erase_callback(instr);
+       if (!instr->len)
                return 0;
-       }
+
        ledtrig_mtd_activity();
        return mtd->_erase(mtd, instr);
 }
index 1c07a6f0dfe56aecc07c58326a44e130064efab2..85fea8ea34231972f3ca223ee40ebe71d74f6caa 100644 (file)
@@ -212,11 +212,6 @@ static int part_erase(struct mtd_info *mtd, struct erase_info *instr)
        return ret;
 }
 
-void mtd_erase_callback(struct erase_info *instr)
-{
-}
-EXPORT_SYMBOL_GPL(mtd_erase_callback);
-
 static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
        struct mtd_part *part = mtd_to_part(mtd);
index 16c8bc06975dceb1af34fc191af5f4d6e5b42284..87b72bf626aecf804ff145f041995e8b24710aba 100644 (file)
@@ -4604,22 +4604,20 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
        if (nand_check_wp(mtd)) {
                pr_debug("%s: device is write protected!\n",
                                __func__);
-               instr->state = MTD_ERASE_FAILED;
+               ret = -EIO;
                goto erase_exit;
        }
 
        /* Loop through the pages */
        len = instr->len;
 
-       instr->state = MTD_ERASING;
-
        while (len) {
                /* Check if we have a bad block, we do not erase bad blocks! */
                if (nand_block_checkbad(mtd, ((loff_t) page) <<
                                        chip->page_shift, allowbbt)) {
                        pr_warn("%s: attempt to erase a bad block at page 0x%08x\n",
                                    __func__, page);
-                       instr->state = MTD_ERASE_FAILED;
+                       ret = -EIO;
                        goto erase_exit;
                }
 
@@ -4637,7 +4635,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
                if (status) {
                        pr_debug("%s: failed erase, page 0x%08x\n",
                                        __func__, page);
-                       instr->state = MTD_ERASE_FAILED;
+                       ret = -EIO;
                        instr->fail_addr =
                                ((loff_t)page << chip->page_shift);
                        goto erase_exit;
@@ -4654,20 +4652,14 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
                        chip->select_chip(mtd, chipnr);
                }
        }
-       instr->state = MTD_ERASE_DONE;
 
+       ret = 0;
 erase_exit:
 
-       ret = instr->state == MTD_ERASE_DONE ? 0 : -EIO;
-
        /* Deselect and wake up anyone waiting on the device */
        chip->select_chip(mtd, -1);
        nand_release_device(mtd);
 
-       /* Do call back function */
-       if (!ret)
-               mtd_erase_callback(instr);
-
        /* Return more or less happy */
        return ret;
 }
index 979f4031f23cab8ef5ff87e0318162cdaf688a46..8d19b78777b50bcc88c4178820ef40699c3670dc 100644 (file)
@@ -2143,7 +2143,6 @@ static int onenand_multiblock_erase_verify(struct mtd_info *mtd,
                if (ret) {
                        printk(KERN_ERR "%s: Failed verify, block %d\n",
                               __func__, onenand_block(this, addr));
-                       instr->state = MTD_ERASE_FAILED;
                        instr->fail_addr = addr;
                        return -1;
                }
@@ -2172,8 +2171,6 @@ static int onenand_multiblock_erase(struct mtd_info *mtd,
        int ret = 0;
        int bdry_block = 0;
 
-       instr->state = MTD_ERASING;
-
        if (ONENAND_IS_DDP(this)) {
                loff_t bdry_addr = this->chipsize >> 1;
                if (addr < bdry_addr && (addr + len) > bdry_addr)
@@ -2187,7 +2184,6 @@ static int onenand_multiblock_erase(struct mtd_info *mtd,
                        printk(KERN_WARNING "%s: attempt to erase a bad block "
                               "at addr 0x%012llx\n",
                               __func__, (unsigned long long) addr);
-                       instr->state = MTD_ERASE_FAILED;
                        return -EIO;
                }
                len -= block_size;
@@ -2227,7 +2223,6 @@ static int onenand_multiblock_erase(struct mtd_info *mtd,
                                printk(KERN_ERR "%s: Failed multiblock erase, "
                                       "block %d\n", __func__,
                                       onenand_block(this, addr));
-                               instr->state = MTD_ERASE_FAILED;
                                instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
                                return -EIO;
                        }
@@ -2247,7 +2242,6 @@ static int onenand_multiblock_erase(struct mtd_info *mtd,
                if (ret) {
                        printk(KERN_ERR "%s: Failed erase, block %d\n",
                               __func__, onenand_block(this, addr));
-                       instr->state = MTD_ERASE_FAILED;
                        instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
                        return -EIO;
                }
@@ -2259,7 +2253,6 @@ static int onenand_multiblock_erase(struct mtd_info *mtd,
                /* verify */
                verify_instr.len = eb_count * block_size;
                if (onenand_multiblock_erase_verify(mtd, &verify_instr)) {
-                       instr->state = verify_instr.state;
                        instr->fail_addr = verify_instr.fail_addr;
                        return -EIO;
                }
@@ -2294,8 +2287,6 @@ static int onenand_block_by_block_erase(struct mtd_info *mtd,
                region_end = region->offset + region->erasesize * region->numblocks;
        }
 
-       instr->state = MTD_ERASING;
-
        /* Loop through the blocks */
        while (len) {
                cond_resched();
@@ -2305,7 +2296,6 @@ static int onenand_block_by_block_erase(struct mtd_info *mtd,
                        printk(KERN_WARNING "%s: attempt to erase a bad block "
                                        "at addr 0x%012llx\n",
                                        __func__, (unsigned long long) addr);
-                       instr->state = MTD_ERASE_FAILED;
                        return -EIO;
                }
 
@@ -2318,7 +2308,6 @@ static int onenand_block_by_block_erase(struct mtd_info *mtd,
                if (ret) {
                        printk(KERN_ERR "%s: Failed erase, block %d\n",
                                __func__, onenand_block(this, addr));
-                       instr->state = MTD_ERASE_FAILED;
                        instr->fail_addr = addr;
                        return -EIO;
                }
@@ -2407,12 +2396,6 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
        /* Deselect and wake up anyone waiting on the device */
        onenand_release_device(mtd);
 
-       /* Do call back function */
-       if (!ret) {
-               instr->state = MTD_ERASE_DONE;
-               mtd_erase_callback(instr);
-       }
-
        return ret;
 }
 
index d445a4d3b77077d838233c8a90a876d13650d72d..5bfa36e95f35491a6171ca7bb2b2f0f01b149254 100644 (file)
@@ -560,9 +560,6 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 erase_err:
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
 
-       instr->state = ret ? MTD_ERASE_FAILED : MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
        return ret;
 }
 
index 1cb287ec32adbb486c3289c23a89191e7be48221..6b655a53113b3e4791f4ed51e9abcb6234e525f7 100644 (file)
@@ -272,12 +272,9 @@ static int gluebi_erase(struct mtd_info *mtd, struct erase_info *instr)
        if (err)
                goto out_err;
 
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
        return 0;
 
 out_err:
-       instr->state = MTD_ERASE_FAILED;
        instr->fail_addr = (long long)lnum * mtd->erasesize;
        return err;
 }
index cde593cb1052896f584f4067485be3e5f5defcb4..2d67e4621a3daa26a49d0b57b34b72df89e7bb16 100644 (file)
 static int ef4_mtd_erase(struct mtd_info *mtd, struct erase_info *erase)
 {
        struct ef4_nic *efx = mtd->priv;
-       int rc;
 
-       rc = efx->type->mtd_erase(mtd, erase->addr, erase->len);
-       if (rc == 0) {
-               erase->state = MTD_ERASE_DONE;
-       } else {
-               erase->state = MTD_ERASE_FAILED;
-               erase->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
-       }
-       mtd_erase_callback(erase);
-       return rc;
+       return efx->type->mtd_erase(mtd, erase->addr, erase->len);
 }
 
 static void ef4_mtd_sync(struct mtd_info *mtd)
index a77a8bd2dd70ae3bda3f23333d3cf26b14792573..4ac30b6e5dab2655015fd53d8c426765218ae9d1 100644 (file)
 static int efx_mtd_erase(struct mtd_info *mtd, struct erase_info *erase)
 {
        struct efx_nic *efx = mtd->priv;
-       int rc;
 
-       rc = efx->type->mtd_erase(mtd, erase->addr, erase->len);
-       if (rc == 0) {
-               erase->state = MTD_ERASE_DONE;
-       } else {
-               erase->state = MTD_ERASE_FAILED;
-               erase->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
-       }
-       mtd_erase_callback(erase);
-       return rc;
+       return efx->type->mtd_erase(mtd, erase->addr, erase->len);
 }
 
 static void efx_mtd_sync(struct mtd_info *mtd)
index 52cc1363993eabb5d27f3a7e3d32facee9455511..f5e002ecba750e9d08fa47c956c31109cba20164 100644 (file)
@@ -119,9 +119,6 @@ static int goldfish_nand_erase(struct mtd_info *mtd, struct erase_info *instr)
                return -EIO;
        }
 
-       instr->state = MTD_ERASE_DONE;
-       mtd_erase_callback(instr);
-
        return 0;
 
 invalid_arg:
index 4cbb7f5552448717cb78a66dafbb83b31ab24b9c..a86c4fa93115bebc002b67363cb57def775e7c8b 100644 (file)
 
 #include <asm/div64.h>
 
-#define MTD_ERASE_PENDING      0x01
-#define MTD_ERASING            0x02
-#define MTD_ERASE_SUSPEND      0x04
-#define MTD_ERASE_DONE         0x08
-#define MTD_ERASE_FAILED       0x10
-
 #define MTD_FAIL_ADDR_UNKNOWN -1LL
 
 struct mtd_info;
@@ -49,7 +43,6 @@ struct erase_info {
        uint64_t addr;
        uint64_t len;
        uint64_t fail_addr;
-       u_char state;
 };
 
 struct mtd_erase_region_info {
@@ -589,8 +582,6 @@ extern void register_mtd_user (struct mtd_notifier *new);
 extern int unregister_mtd_user (struct mtd_notifier *old);
 void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
 
-void mtd_erase_callback(struct erase_info *instr);
-
 static inline int mtd_is_bitflip(int err) {
        return err == -EUCLEAN;
 }