Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f347c42 authored by Boris Brezillon's avatar Boris Brezillon
Browse files

mtd: Unconditionally update ->fail_addr and ->addr in part_erase()



->fail_addr and ->addr can be updated no matter the result of
parent->_erase(), we just need to remove the code doing the same thing
in mtd_erase_callback() to avoid adjusting those fields twice.

Note that this can be done because all MTD users have been converted to
not pass an erase_info->callback() and are thus only taking the
->addr_fail and ->addr fields into account after part_erase() has
returned.

While we're at it, get rid of the erase_info->mtd field which was only
needed to let mtd_erase_callback() get the partition device back.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: default avatarRichard Weinberger <richard@nod.at>
parent 884cfd90
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -342,7 +342,6 @@ static int erase_xfer(partition_t *part,
    if (!erase)
            return -ENOMEM;

    erase->mtd = part->mbd.mtd;
    erase->addr = xfer->Offset;
    erase->len = 1 << part->header.EraseUnitSize;

+0 −3
Original line number Diff line number Diff line
@@ -208,8 +208,6 @@ static int find_boot_record(struct INFTLrecord *inftl)
			if (ip->Reserved0 != ip->firstUnit) {
				struct erase_info *instr = &inftl->instr;

				instr->mtd = inftl->mbd.mtd;

				/*
				 * 	Most likely this is using the
				 * 	undocumented qiuck mount feature.
@@ -385,7 +383,6 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block)
	   _first_? */

	/* Use async erase interface, test return code */
	instr->mtd = inftl->mbd.mtd;
	instr->addr = block * inftl->EraseSize;
	instr->len = inftl->mbd.mtd->erasesize;
	/* Erase one physical eraseblock at a time, even though the NAND api
+0 −1
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
	/*
	 * First, let's erase the flash block.
	 */
	erase.mtd = mtd;
	erase.addr = pos;
	erase.len = len;

+0 −1
Original line number Diff line number Diff line
@@ -726,7 +726,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
				erase->addr = einfo32.start;
				erase->len = einfo32.length;
			}
			erase->mtd = mtd;

			ret = mtd_erase(mtd, erase);
			kfree(erase);
+0 −1
Original line number Diff line number Diff line
@@ -427,7 +427,6 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
			erase->len = length;

		length -= erase->len;
		erase->mtd = subdev;
		if ((err = mtd_erase(subdev, erase))) {
			/* sanity check: should never happen since
			 * block alignment has been checked above */
Loading