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

Commit 9223a456 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

[MTD] Remove read/write _ecc variants



MTD clients are agnostic of FLASH which needs ECC suppport.
Remove the functions and fixup the callers.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 2528e8cd
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -584,8 +584,6 @@ void DoC2k_init(struct mtd_info *mtd)
	mtd->unpoint = NULL;
	mtd->unpoint = NULL;
	mtd->read = doc_read;
	mtd->read = doc_read;
	mtd->write = doc_write;
	mtd->write = doc_write;
	mtd->read_ecc = doc_read_ecc;
	mtd->write_ecc = doc_write_ecc;
	mtd->read_oob = doc_read_oob;
	mtd->read_oob = doc_read_oob;
	mtd->write_oob = doc_write_oob;
	mtd->write_oob = doc_write_oob;
	mtd->sync = NULL;
	mtd->sync = NULL;
+0 −2
Original line number Original line Diff line number Diff line
@@ -369,8 +369,6 @@ void DoCMil_init(struct mtd_info *mtd)
	mtd->unpoint = NULL;
	mtd->unpoint = NULL;
	mtd->read = doc_read;
	mtd->read = doc_read;
	mtd->write = doc_write;
	mtd->write = doc_write;
	mtd->read_ecc = doc_read_ecc;
	mtd->write_ecc = doc_write_ecc;
	mtd->read_oob = doc_read_oob;
	mtd->read_oob = doc_read_oob;
	mtd->write_oob = doc_write_oob;
	mtd->write_oob = doc_write_oob;
	mtd->sync = NULL;
	mtd->sync = NULL;
+0 −2
Original line number Original line Diff line number Diff line
@@ -491,8 +491,6 @@ void DoCMilPlus_init(struct mtd_info *mtd)
	mtd->unpoint = NULL;
	mtd->unpoint = NULL;
	mtd->read = doc_read;
	mtd->read = doc_read;
	mtd->write = doc_write;
	mtd->write = doc_write;
	mtd->read_ecc = doc_read_ecc;
	mtd->write_ecc = doc_write_ecc;
	mtd->read_oob = doc_read_oob;
	mtd->read_oob = doc_read_oob;
	mtd->write_oob = doc_write_oob;
	mtd->write_oob = doc_write_oob;
	mtd->sync = NULL;
	mtd->sync = NULL;
+32 −31
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nftl.h>
#include <linux/mtd/nftl.h>
#include <linux/mtd/inftl.h>
#include <linux/mtd/inftl.h>
#include <linux/mtd/nand.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/errno.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <asm/io.h>
@@ -79,8 +80,6 @@ static void inftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
	inftl->mbd.devnum = -1;
	inftl->mbd.devnum = -1;
	inftl->mbd.blksize = 512;
	inftl->mbd.blksize = 512;
	inftl->mbd.tr = tr;
	inftl->mbd.tr = tr;
	memcpy(&inftl->oobinfo, &mtd->oobinfo, sizeof(struct nand_oobinfo));
	inftl->oobinfo.useecc = MTD_NANDECC_PLACEONLY;


	if (INFTL_mount(inftl) < 0) {
	if (INFTL_mount(inftl) < 0) {
		printk(KERN_WARNING "INFTL: could not mount device\n");
		printk(KERN_WARNING "INFTL: could not mount device\n");
@@ -302,9 +301,10 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
		}
		}
		memset(&oob, 0xff, sizeof(struct inftl_oob));
		memset(&oob, 0xff, sizeof(struct inftl_oob));
		oob.b.Status = oob.b.Status1 = SECTOR_USED;
		oob.b.Status = oob.b.Status1 = SECTOR_USED;
                MTD_WRITEECC(inftl->mbd.mtd, (inftl->EraseSize * targetEUN) +

		nand_write_raw(inftl->mbd.mtd, (inftl->EraseSize * targetEUN) +
			       (block * SECTORSIZE), SECTORSIZE, &retlen,
			       (block * SECTORSIZE), SECTORSIZE, &retlen,
			movebuf, (char *)&oob, &inftl->oobinfo);
			       movebuf, (char *)&oob);
	}
	}


	/*
	/*
@@ -784,9 +784,10 @@ static int inftl_writeblock(struct mtd_blktrans_dev *mbd, unsigned long block,


		memset(&oob, 0xff, sizeof(struct inftl_oob));
		memset(&oob, 0xff, sizeof(struct inftl_oob));
		oob.b.Status = oob.b.Status1 = SECTOR_USED;
		oob.b.Status = oob.b.Status1 = SECTOR_USED;
		MTD_WRITEECC(inftl->mbd.mtd, (writeEUN * inftl->EraseSize) +

		nand_write_raw(inftl->mbd.mtd, (writeEUN * inftl->EraseSize) +
			       blockofs, SECTORSIZE, &retlen, (char *)buffer,
			       blockofs, SECTORSIZE, &retlen, (char *)buffer,
			(char *)&oob, &inftl->oobinfo);
			       (char *)&oob);
		/*
		/*
		 * need to write SECTOR_USED flags since they are not written
		 * need to write SECTOR_USED flags since they are not written
		 * in mtd_writeecc
		 * in mtd_writeecc
+6 −6
Original line number Original line Diff line number Diff line
@@ -350,21 +350,21 @@ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
	int len, int check_oob)
	int len, int check_oob)
{
{
	u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
	u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
	struct mtd_info *mtd = inftl->mbd.mtd;
	size_t retlen;
	size_t retlen;
	int i;
	int i;


	DEBUG(MTD_DEBUG_LEVEL3, "INFTL: check_free_sectors(inftl=%p,"
		"address=0x%x,len=%d,check_oob=%d)\n", inftl,
		address, len, check_oob);

	for (i = 0; i < len; i += SECTORSIZE) {
	for (i = 0; i < len; i += SECTORSIZE) {
		if (MTD_READECC(inftl->mbd.mtd, address, SECTORSIZE, &retlen, buf, &buf[SECTORSIZE], &inftl->oobinfo) < 0)
		if (mtd->read(mtd, address, SECTORSIZE, &retlen, buf))
			return -1;
			return -1;
		if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
		if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
			return -1;
			return -1;


		if (check_oob) {
		if (check_oob) {
			if (memcmpb(buf + SECTORSIZE, 0xff, inftl->mbd.mtd->oobsize) != 0)
			if(mtd->read_oob(mtd, address, mtd->oobsize,
					 &retlen, &buf[SECTORSIZE]) < 0)
				return -1;
			if (memcmpb(buf + SECTORSIZE, 0xff, mtd->oobsize) != 0)
				return -1;
				return -1;
		}
		}
		address += SECTORSIZE;
		address += SECTORSIZE;
Loading