mtd: rename MTD_OOB_* to MTD_OPS_*

These modes are not necessarily for OOB only. Particularly, MTD_OOB_RAW
affected operations on in-band page data as well. To clarify these
options and to emphasize that their effect is applied per-operation, we
change the primary prefix to MTD_OPS_.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
This commit is contained in:
Brian Norris 2011-08-30 18:45:40 -07:00 committed by Artem Bityutskiy
parent 905c6bcdb4
commit 0612b9ddc2
22 changed files with 99 additions and 97 deletions

View File

@ -927,7 +927,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs,
uint8_t *buf = ops->oobbuf; uint8_t *buf = ops->oobbuf;
size_t len = ops->len; size_t len = ops->len;
BUG_ON(ops->mode != MTD_OOB_PLACE); BUG_ON(ops->mode != MTD_OPS_PLACE_OOB);
ofs += ops->ooboffs; ofs += ops->ooboffs;
@ -1091,7 +1091,7 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
struct DiskOnChip *this = mtd->priv; struct DiskOnChip *this = mtd->priv;
int ret; int ret;
BUG_ON(ops->mode != MTD_OOB_PLACE); BUG_ON(ops->mode != MTD_OPS_PLACE_OOB);
mutex_lock(&this->lock); mutex_lock(&this->lock);
ret = doc_write_oob_nolock(mtd, ofs + ops->ooboffs, ops->len, ret = doc_write_oob_nolock(mtd, ofs + ops->ooboffs, ops->len,

View File

@ -631,7 +631,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs,
uint8_t *buf = ops->oobbuf; uint8_t *buf = ops->oobbuf;
size_t len = ops->len; size_t len = ops->len;
BUG_ON(ops->mode != MTD_OOB_PLACE); BUG_ON(ops->mode != MTD_OPS_PLACE_OOB);
ofs += ops->ooboffs; ofs += ops->ooboffs;
@ -689,7 +689,7 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
uint8_t *buf = ops->oobbuf; uint8_t *buf = ops->oobbuf;
size_t len = ops->len; size_t len = ops->len;
BUG_ON(ops->mode != MTD_OOB_PLACE); BUG_ON(ops->mode != MTD_OPS_PLACE_OOB);
ofs += ops->ooboffs; ofs += ops->ooboffs;

View File

@ -834,7 +834,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs,
uint8_t *buf = ops->oobbuf; uint8_t *buf = ops->oobbuf;
size_t len = ops->len; size_t len = ops->len;
BUG_ON(ops->mode != MTD_OOB_PLACE); BUG_ON(ops->mode != MTD_OPS_PLACE_OOB);
ofs += ops->ooboffs; ofs += ops->ooboffs;
@ -919,7 +919,7 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
uint8_t *buf = ops->oobbuf; uint8_t *buf = ops->oobbuf;
size_t len = ops->len; size_t len = ops->len;
BUG_ON(ops->mode != MTD_OOB_PLACE); BUG_ON(ops->mode != MTD_OPS_PLACE_OOB);
ofs += ops->ooboffs; ofs += ops->ooboffs;

View File

@ -152,7 +152,7 @@ int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = offs & (mtd->writesize - 1); ops.ooboffs = offs & (mtd->writesize - 1);
ops.ooblen = len; ops.ooblen = len;
ops.oobbuf = buf; ops.oobbuf = buf;
@ -172,7 +172,7 @@ int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = offs & (mtd->writesize - 1); ops.ooboffs = offs & (mtd->writesize - 1);
ops.ooblen = len; ops.ooblen = len;
ops.oobbuf = buf; ops.oobbuf = buf;
@ -192,7 +192,7 @@ static int inftl_write(struct mtd_info *mtd, loff_t offs, size_t len,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = offs; ops.ooboffs = offs;
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;
ops.oobbuf = oob; ops.oobbuf = oob;

View File

@ -221,7 +221,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
{ {
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
ops.mode = MTD_OOB_RAW; ops.mode = MTD_OPS_RAW;
ops.datbuf = kbuf; ops.datbuf = kbuf;
ops.oobbuf = NULL; ops.oobbuf = NULL;
ops.len = len; ops.len = len;
@ -317,7 +317,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
{ {
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
ops.mode = MTD_OOB_RAW; ops.mode = MTD_OPS_RAW;
ops.datbuf = kbuf; ops.datbuf = kbuf;
ops.oobbuf = NULL; ops.oobbuf = NULL;
ops.ooboffs = 0; ops.ooboffs = 0;
@ -413,7 +413,8 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd,
ops.ooblen = length; ops.ooblen = length;
ops.ooboffs = start & (mtd->writesize - 1); ops.ooboffs = start & (mtd->writesize - 1);
ops.datbuf = NULL; ops.datbuf = NULL;
ops.mode = (mfi->mode == MTD_MODE_RAW) ? MTD_OOB_RAW : MTD_OOB_PLACE; ops.mode = (mfi->mode == MTD_MODE_RAW) ? MTD_OPS_RAW :
MTD_OPS_PLACE_OOB;
if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs))
return -EINVAL; return -EINVAL;
@ -457,7 +458,8 @@ static int mtd_do_readoob(struct file *file, struct mtd_info *mtd,
ops.ooblen = length; ops.ooblen = length;
ops.ooboffs = start & (mtd->writesize - 1); ops.ooboffs = start & (mtd->writesize - 1);
ops.datbuf = NULL; ops.datbuf = NULL;
ops.mode = (mfi->mode == MTD_MODE_RAW) ? MTD_OOB_RAW : MTD_OOB_PLACE; ops.mode = (mfi->mode == MTD_MODE_RAW) ? MTD_OPS_RAW :
MTD_OPS_PLACE_OOB;
if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs))
return -EINVAL; return -EINVAL;

View File

@ -130,7 +130,7 @@ static int part_read_oob(struct mtd_info *mtd, loff_t from,
if (ops->oobbuf) { if (ops->oobbuf) {
size_t len, pages; size_t len, pages;
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
len = mtd->oobavail; len = mtd->oobavail;
else else
len = mtd->oobsize; len = mtd->oobsize;

View File

@ -350,7 +350,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb)
ops.oobbuf = d->oob_buf; ops.oobbuf = d->oob_buf;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.datbuf = NULL; ops.datbuf = NULL;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ret = mtdswap_read_oob(d, offset, &ops); ret = mtdswap_read_oob(d, offset, &ops);
@ -389,7 +389,7 @@ static int mtdswap_write_marker(struct mtdswap_dev *d, struct swap_eb *eb,
ops.ooboffs = 0; ops.ooboffs = 0;
ops.oobbuf = (uint8_t *)&n; ops.oobbuf = (uint8_t *)&n;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.datbuf = NULL; ops.datbuf = NULL;
if (marker == MTDSWAP_TYPE_CLEAN) { if (marker == MTDSWAP_TYPE_CLEAN) {
@ -931,7 +931,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int ret; int ret;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = mtd->writesize; ops.len = mtd->writesize;
ops.ooblen = mtd->ecclayout->oobavail; ops.ooblen = mtd->ecclayout->oobavail;
ops.ooboffs = 0; ops.ooboffs = 0;

View File

@ -1104,7 +1104,7 @@ gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page)
* The BCH will use all the (page + oob). * The BCH will use all the (page + oob).
* Our gpmi_hw_ecclayout can only prohibit the JFFS2 to write the oob. * Our gpmi_hw_ecclayout can only prohibit the JFFS2 to write the oob.
* But it can not stop some ioctls such MEMWRITEOOB which uses * But it can not stop some ioctls such MEMWRITEOOB which uses
* MTD_OOB_PLACE. So We have to implement this function to prohibit * MTD_OPS_PLACE_OOB. So We have to implement this function to prohibit
* these ioctls too. * these ioctls too.
*/ */
return -EPERM; return -EPERM;

View File

@ -1382,12 +1382,12 @@ static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
{ {
switch (ops->mode) { switch (ops->mode) {
case MTD_OOB_PLACE: case MTD_OPS_PLACE_OOB:
case MTD_OOB_RAW: case MTD_OPS_RAW:
memcpy(oob, chip->oob_poi + ops->ooboffs, len); memcpy(oob, chip->oob_poi + ops->ooboffs, len);
return oob + len; return oob + len;
case MTD_OOB_AUTO: { case MTD_OPS_AUTO_OOB: {
struct nand_oobfree *free = chip->ecc.layout->oobfree; struct nand_oobfree *free = chip->ecc.layout->oobfree;
uint32_t boffs = 0, roffs = ops->ooboffs; uint32_t boffs = 0, roffs = ops->ooboffs;
size_t bytes = 0; size_t bytes = 0;
@ -1437,7 +1437,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
int ret = 0; int ret = 0;
uint32_t readlen = ops->len; uint32_t readlen = ops->len;
uint32_t oobreadlen = ops->ooblen; uint32_t oobreadlen = ops->ooblen;
uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ? uint32_t max_oobsize = ops->mode == MTD_OPS_AUTO_OOB ?
mtd->oobavail : mtd->oobsize; mtd->oobavail : mtd->oobsize;
uint8_t *bufpoi, *oob, *buf; uint8_t *bufpoi, *oob, *buf;
@ -1469,7 +1469,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
} }
/* Now read the page into the buffer */ /* Now read the page into the buffer */
if (unlikely(ops->mode == MTD_OOB_RAW)) if (unlikely(ops->mode == MTD_OPS_RAW))
ret = chip->ecc.read_page_raw(mtd, chip, ret = chip->ecc.read_page_raw(mtd, chip,
bufpoi, page); bufpoi, page);
else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob) else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob)
@ -1759,7 +1759,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
stats = mtd->ecc_stats; stats = mtd->ecc_stats;
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
len = chip->ecc.layout->oobavail; len = chip->ecc.layout->oobavail;
else else
len = mtd->oobsize; len = mtd->oobsize;
@ -1787,7 +1787,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
page = realpage & chip->pagemask; page = realpage & chip->pagemask;
while (1) { while (1) {
if (ops->mode == MTD_OOB_RAW) if (ops->mode == MTD_OPS_RAW)
sndcmd = chip->ecc.read_oob_raw(mtd, chip, page, sndcmd); sndcmd = chip->ecc.read_oob_raw(mtd, chip, page, sndcmd);
else else
sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd); sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
@ -1865,9 +1865,9 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
nand_get_device(chip, mtd, FL_READING); nand_get_device(chip, mtd, FL_READING);
switch (ops->mode) { switch (ops->mode) {
case MTD_OOB_PLACE: case MTD_OPS_PLACE_OOB:
case MTD_OOB_AUTO: case MTD_OPS_AUTO_OOB:
case MTD_OOB_RAW: case MTD_OPS_RAW:
break; break;
default: default:
@ -2113,12 +2113,12 @@ static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
switch (ops->mode) { switch (ops->mode) {
case MTD_OOB_PLACE: case MTD_OPS_PLACE_OOB:
case MTD_OOB_RAW: case MTD_OPS_RAW:
memcpy(chip->oob_poi + ops->ooboffs, oob, len); memcpy(chip->oob_poi + ops->ooboffs, oob, len);
return oob + len; return oob + len;
case MTD_OOB_AUTO: { case MTD_OPS_AUTO_OOB: {
struct nand_oobfree *free = chip->ecc.layout->oobfree; struct nand_oobfree *free = chip->ecc.layout->oobfree;
uint32_t boffs = 0, woffs = ops->ooboffs; uint32_t boffs = 0, woffs = ops->ooboffs;
size_t bytes = 0; size_t bytes = 0;
@ -2167,7 +2167,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
uint32_t writelen = ops->len; uint32_t writelen = ops->len;
uint32_t oobwritelen = ops->ooblen; uint32_t oobwritelen = ops->ooblen;
uint32_t oobmaxlen = ops->mode == MTD_OOB_AUTO ? uint32_t oobmaxlen = ops->mode == MTD_OPS_AUTO_OOB ?
mtd->oobavail : mtd->oobsize; mtd->oobavail : mtd->oobsize;
uint8_t *oob = ops->oobbuf; uint8_t *oob = ops->oobbuf;
@ -2236,7 +2236,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
} }
ret = chip->write_page(mtd, chip, wbuf, page, cached, ret = chip->write_page(mtd, chip, wbuf, page, cached,
(ops->mode == MTD_OOB_RAW)); (ops->mode == MTD_OPS_RAW));
if (ret) if (ret)
break; break;
@ -2356,7 +2356,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
pr_debug("%s: to = 0x%08x, len = %i\n", pr_debug("%s: to = 0x%08x, len = %i\n",
__func__, (unsigned int)to, (int)ops->ooblen); __func__, (unsigned int)to, (int)ops->ooblen);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
len = chip->ecc.layout->oobavail; len = chip->ecc.layout->oobavail;
else else
len = mtd->oobsize; len = mtd->oobsize;
@ -2408,7 +2408,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
nand_fill_oob(mtd, ops->oobbuf, ops->ooblen, ops); nand_fill_oob(mtd, ops->oobbuf, ops->ooblen, ops);
if (ops->mode == MTD_OOB_RAW) if (ops->mode == MTD_OPS_RAW)
status = chip->ecc.write_oob_raw(mtd, chip, page & chip->pagemask); status = chip->ecc.write_oob_raw(mtd, chip, page & chip->pagemask);
else else
status = chip->ecc.write_oob(mtd, chip, page & chip->pagemask); status = chip->ecc.write_oob(mtd, chip, page & chip->pagemask);
@ -2445,9 +2445,9 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
nand_get_device(chip, mtd, FL_WRITING); nand_get_device(chip, mtd, FL_WRITING);
switch (ops->mode) { switch (ops->mode) {
case MTD_OOB_PLACE: case MTD_OPS_PLACE_OOB:
case MTD_OOB_AUTO: case MTD_OPS_AUTO_OOB:
case MTD_OOB_RAW: case MTD_OPS_RAW:
break; break;
default: default:

View File

@ -302,7 +302,7 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_RAW; ops.mode = MTD_OPS_RAW;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;
@ -350,7 +350,7 @@ static int scan_write_bbt(struct mtd_info *mtd, loff_t offs, size_t len,
{ {
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;
ops.datbuf = buf; ops.datbuf = buf;
@ -433,7 +433,7 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
ops.oobbuf = buf; ops.oobbuf = buf;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.datbuf = NULL; ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
for (j = 0; j < len; j++) { for (j = 0; j < len; j++) {
/* /*
@ -672,7 +672,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.datbuf = NULL; ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
if (!rcode) if (!rcode)
rcode = 0xff; rcode = 0xff;

View File

@ -47,7 +47,7 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs)
/* As long as this function is called on erase block boundaries /* As long as this function is called on erase block boundaries
it will work correctly for 256 byte nand */ it will work correctly for 256 byte nand */
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;
ops.oobbuf = (void *)&oob; ops.oobbuf = (void *)&oob;

View File

@ -147,7 +147,7 @@ int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = offs & mask; ops.ooboffs = offs & mask;
ops.ooblen = len; ops.ooblen = len;
ops.oobbuf = buf; ops.oobbuf = buf;
@ -168,7 +168,7 @@ int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = offs & mask; ops.ooboffs = offs & mask;
ops.ooblen = len; ops.ooblen = len;
ops.oobbuf = buf; ops.oobbuf = buf;
@ -191,7 +191,7 @@ static int nftl_write(struct mtd_info *mtd, loff_t offs, size_t len,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int res; int res;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = offs & mask; ops.ooboffs = offs & mask;
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;
ops.oobbuf = oob; ops.oobbuf = oob;

View File

@ -1125,7 +1125,7 @@ static int onenand_mlc_read_ops_nolock(struct mtd_info *mtd, loff_t from,
pr_debug("%s: from = 0x%08x, len = %i\n", __func__, (unsigned int)from, pr_debug("%s: from = 0x%08x, len = %i\n", __func__, (unsigned int)from,
(int)len); (int)len);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
oobsize = this->ecclayout->oobavail; oobsize = this->ecclayout->oobavail;
else else
oobsize = mtd->oobsize; oobsize = mtd->oobsize;
@ -1170,7 +1170,7 @@ static int onenand_mlc_read_ops_nolock(struct mtd_info *mtd, loff_t from,
thisooblen = oobsize - oobcolumn; thisooblen = oobsize - oobcolumn;
thisooblen = min_t(int, thisooblen, ooblen - oobread); thisooblen = min_t(int, thisooblen, ooblen - oobread);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
onenand_transfer_auto_oob(mtd, oobbuf, oobcolumn, thisooblen); onenand_transfer_auto_oob(mtd, oobbuf, oobcolumn, thisooblen);
else else
this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, oobcolumn, thisooblen); this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, oobcolumn, thisooblen);
@ -1229,7 +1229,7 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from,
pr_debug("%s: from = 0x%08x, len = %i\n", __func__, (unsigned int)from, pr_debug("%s: from = 0x%08x, len = %i\n", __func__, (unsigned int)from,
(int)len); (int)len);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
oobsize = this->ecclayout->oobavail; oobsize = this->ecclayout->oobavail;
else else
oobsize = mtd->oobsize; oobsize = mtd->oobsize;
@ -1291,7 +1291,7 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from,
thisooblen = oobsize - oobcolumn; thisooblen = oobsize - oobcolumn;
thisooblen = min_t(int, thisooblen, ooblen - oobread); thisooblen = min_t(int, thisooblen, ooblen - oobread);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
onenand_transfer_auto_oob(mtd, oobbuf, oobcolumn, thisooblen); onenand_transfer_auto_oob(mtd, oobbuf, oobcolumn, thisooblen);
else else
this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, oobcolumn, thisooblen); this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, oobcolumn, thisooblen);
@ -1363,7 +1363,7 @@ static int onenand_read_oob_nolock(struct mtd_info *mtd, loff_t from,
/* Initialize return length value */ /* Initialize return length value */
ops->oobretlen = 0; ops->oobretlen = 0;
if (mode == MTD_OOB_AUTO) if (mode == MTD_OPS_AUTO_OOB)
oobsize = this->ecclayout->oobavail; oobsize = this->ecclayout->oobavail;
else else
oobsize = mtd->oobsize; oobsize = mtd->oobsize;
@ -1409,7 +1409,7 @@ static int onenand_read_oob_nolock(struct mtd_info *mtd, loff_t from,
break; break;
} }
if (mode == MTD_OOB_AUTO) if (mode == MTD_OPS_AUTO_OOB)
onenand_transfer_auto_oob(mtd, buf, column, thislen); onenand_transfer_auto_oob(mtd, buf, column, thislen);
else else
this->read_bufferram(mtd, ONENAND_SPARERAM, buf, column, thislen); this->read_bufferram(mtd, ONENAND_SPARERAM, buf, column, thislen);
@ -1487,10 +1487,10 @@ static int onenand_read_oob(struct mtd_info *mtd, loff_t from,
int ret; int ret;
switch (ops->mode) { switch (ops->mode) {
case MTD_OOB_PLACE: case MTD_OPS_PLACE_OOB:
case MTD_OOB_AUTO: case MTD_OPS_AUTO_OOB:
break; break;
case MTD_OOB_RAW: case MTD_OPS_RAW:
/* Not implemented yet */ /* Not implemented yet */
default: default:
return -EINVAL; return -EINVAL;
@ -1908,7 +1908,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
if (!len) if (!len)
return 0; return 0;
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
oobsize = this->ecclayout->oobavail; oobsize = this->ecclayout->oobavail;
else else
oobsize = mtd->oobsize; oobsize = mtd->oobsize;
@ -1945,7 +1945,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
/* We send data to spare ram with oobsize /* We send data to spare ram with oobsize
* to prevent byte access */ * to prevent byte access */
memset(oobbuf, 0xff, mtd->oobsize); memset(oobbuf, 0xff, mtd->oobsize);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OPS_AUTO_OOB)
onenand_fill_auto_oob(mtd, oobbuf, oob, oobcolumn, thisooblen); onenand_fill_auto_oob(mtd, oobbuf, oob, oobcolumn, thisooblen);
else else
memcpy(oobbuf + oobcolumn, oob, thisooblen); memcpy(oobbuf + oobcolumn, oob, thisooblen);
@ -2084,7 +2084,7 @@ static int onenand_write_oob_nolock(struct mtd_info *mtd, loff_t to,
/* Initialize retlen, in case of early exit */ /* Initialize retlen, in case of early exit */
ops->oobretlen = 0; ops->oobretlen = 0;
if (mode == MTD_OOB_AUTO) if (mode == MTD_OPS_AUTO_OOB)
oobsize = this->ecclayout->oobavail; oobsize = this->ecclayout->oobavail;
else else
oobsize = mtd->oobsize; oobsize = mtd->oobsize;
@ -2128,7 +2128,7 @@ static int onenand_write_oob_nolock(struct mtd_info *mtd, loff_t to,
/* We send data to spare ram with oobsize /* We send data to spare ram with oobsize
* to prevent byte access */ * to prevent byte access */
memset(oobbuf, 0xff, mtd->oobsize); memset(oobbuf, 0xff, mtd->oobsize);
if (mode == MTD_OOB_AUTO) if (mode == MTD_OPS_AUTO_OOB)
onenand_fill_auto_oob(mtd, oobbuf, buf, column, thislen); onenand_fill_auto_oob(mtd, oobbuf, buf, column, thislen);
else else
memcpy(oobbuf + column, buf, thislen); memcpy(oobbuf + column, buf, thislen);
@ -2217,10 +2217,10 @@ static int onenand_write_oob(struct mtd_info *mtd, loff_t to,
int ret; int ret;
switch (ops->mode) { switch (ops->mode) {
case MTD_OOB_PLACE: case MTD_OPS_PLACE_OOB:
case MTD_OOB_AUTO: case MTD_OPS_AUTO_OOB:
break; break;
case MTD_OOB_RAW: case MTD_OPS_RAW:
/* Not implemented yet */ /* Not implemented yet */
default: default:
return -EINVAL; return -EINVAL;
@ -2603,7 +2603,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
struct bbm_info *bbm = this->bbm; struct bbm_info *bbm = this->bbm;
u_char buf[2] = {0, 0}; u_char buf[2] = {0, 0};
struct mtd_oob_ops ops = { struct mtd_oob_ops ops = {
.mode = MTD_OOB_PLACE, .mode = MTD_OPS_PLACE_OOB,
.ooblen = 2, .ooblen = 2,
.oobbuf = buf, .oobbuf = buf,
.ooboffs = 0, .ooboffs = 0,
@ -3171,7 +3171,7 @@ static int do_otp_lock(struct mtd_info *mtd, loff_t from, size_t len,
this->command(mtd, ONENAND_CMD_RESET, 0, 0); this->command(mtd, ONENAND_CMD_RESET, 0, 0);
this->wait(mtd, FL_RESETING); this->wait(mtd, FL_RESETING);
} else { } else {
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooblen = len; ops.ooblen = len;
ops.oobbuf = buf; ops.oobbuf = buf;
ops.ooboffs = 0; ops.ooboffs = 0;
@ -3677,7 +3677,7 @@ static int flexonenand_check_blocks_erased(struct mtd_info *mtd, int start, int
int i, ret; int i, ret;
int block; int block;
struct mtd_oob_ops ops = { struct mtd_oob_ops ops = {
.mode = MTD_OOB_PLACE, .mode = MTD_OPS_PLACE_OOB,
.ooboffs = 0, .ooboffs = 0,
.ooblen = mtd->oobsize, .ooblen = mtd->oobsize,
.datbuf = NULL, .datbuf = NULL,

View File

@ -80,7 +80,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
startblock = 0; startblock = 0;
from = 0; from = 0;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.ooblen = readlen; ops.ooblen = readlen;
ops.oobbuf = buf; ops.oobbuf = buf;
ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0; ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0;

View File

@ -256,7 +256,7 @@ static int sm_read_sector(struct sm_ftl *ftl,
if (!oob) if (!oob)
oob = &tmp_oob; oob = &tmp_oob;
ops.mode = ftl->smallpagenand ? MTD_OOB_RAW : MTD_OOB_PLACE; ops.mode = ftl->smallpagenand ? MTD_OPS_RAW : MTD_OPS_PLACE_OOB;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.ooblen = SM_OOB_SIZE; ops.ooblen = SM_OOB_SIZE;
ops.oobbuf = (void *)oob; ops.oobbuf = (void *)oob;
@ -336,7 +336,7 @@ static int sm_write_sector(struct sm_ftl *ftl,
if (ftl->unstable) if (ftl->unstable)
return -EIO; return -EIO;
ops.mode = ftl->smallpagenand ? MTD_OOB_RAW : MTD_OOB_PLACE; ops.mode = ftl->smallpagenand ? MTD_OPS_RAW : MTD_OPS_PLACE_OOB;
ops.len = SM_SECTOR_SIZE; ops.len = SM_SECTOR_SIZE;
ops.datbuf = buffer; ops.datbuf = buffer;
ops.ooboffs = 0; ops.ooboffs = 0;

View File

@ -169,7 +169,7 @@ static int read_raw_oob(struct mtd_info *mtd, loff_t offs, uint8_t *buf)
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int ret; int ret;
ops.mode = MTD_OOB_RAW; ops.mode = MTD_OPS_RAW;
ops.ooboffs = 0; ops.ooboffs = 0;
ops.ooblen = OOB_SIZE; ops.ooblen = OOB_SIZE;
ops.oobbuf = buf; ops.oobbuf = buf;

View File

@ -131,7 +131,7 @@ static int write_eraseblock(int ebnum)
for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) {
set_random_data(writebuf, use_len); set_random_data(writebuf, use_len);
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = use_len; ops.ooblen = use_len;
@ -184,7 +184,7 @@ static int verify_eraseblock(int ebnum)
for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) {
set_random_data(writebuf, use_len); set_random_data(writebuf, use_len);
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = use_len; ops.ooblen = use_len;
@ -211,7 +211,7 @@ static int verify_eraseblock(int ebnum)
if (use_offset != 0 || use_len < mtd->ecclayout->oobavail) { if (use_offset != 0 || use_len < mtd->ecclayout->oobavail) {
int k; int k;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->ecclayout->oobavail; ops.ooblen = mtd->ecclayout->oobavail;
@ -276,7 +276,7 @@ static int verify_eraseblock_in_one_go(int ebnum)
size_t len = mtd->ecclayout->oobavail * pgcnt; size_t len = mtd->ecclayout->oobavail * pgcnt;
set_random_data(writebuf, len); set_random_data(writebuf, len);
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = len; ops.ooblen = len;
@ -507,7 +507,7 @@ static int __init mtd_oobtest_init(void)
addr0 += mtd->erasesize; addr0 += mtd->erasesize;
/* Attempt to write off end of OOB */ /* Attempt to write off end of OOB */
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = 1; ops.ooblen = 1;
@ -527,7 +527,7 @@ static int __init mtd_oobtest_init(void)
} }
/* Attempt to read off end of OOB */ /* Attempt to read off end of OOB */
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = 1; ops.ooblen = 1;
@ -551,7 +551,7 @@ static int __init mtd_oobtest_init(void)
"block is bad\n"); "block is bad\n");
else { else {
/* Attempt to write off end of device */ /* Attempt to write off end of device */
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->ecclayout->oobavail + 1; ops.ooblen = mtd->ecclayout->oobavail + 1;
@ -571,7 +571,7 @@ static int __init mtd_oobtest_init(void)
} }
/* Attempt to read off end of device */ /* Attempt to read off end of device */
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->ecclayout->oobavail + 1; ops.ooblen = mtd->ecclayout->oobavail + 1;
@ -595,7 +595,7 @@ static int __init mtd_oobtest_init(void)
goto out; goto out;
/* Attempt to write off end of device */ /* Attempt to write off end of device */
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->ecclayout->oobavail; ops.ooblen = mtd->ecclayout->oobavail;
@ -615,7 +615,7 @@ static int __init mtd_oobtest_init(void)
} }
/* Attempt to read off end of device */ /* Attempt to read off end of device */
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->ecclayout->oobavail; ops.ooblen = mtd->ecclayout->oobavail;
@ -655,7 +655,7 @@ static int __init mtd_oobtest_init(void)
addr = (i + 1) * mtd->erasesize - mtd->writesize; addr = (i + 1) * mtd->erasesize - mtd->writesize;
for (pg = 0; pg < cnt; ++pg) { for (pg = 0; pg < cnt; ++pg) {
set_random_data(writebuf, sz); set_random_data(writebuf, sz);
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = sz; ops.ooblen = sz;
@ -683,7 +683,7 @@ static int __init mtd_oobtest_init(void)
continue; continue;
set_random_data(writebuf, mtd->ecclayout->oobavail * 2); set_random_data(writebuf, mtd->ecclayout->oobavail * 2);
addr = (i + 1) * mtd->erasesize - mtd->writesize; addr = (i + 1) * mtd->erasesize - mtd->writesize;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->ecclayout->oobavail * 2; ops.ooblen = mtd->ecclayout->oobavail * 2;

View File

@ -66,7 +66,7 @@ static int read_eraseblock_by_page(int ebnum)
if (mtd->oobsize) { if (mtd->oobsize) {
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
ops.mode = MTD_OOB_PLACE; ops.mode = MTD_OPS_PLACE_OOB;
ops.len = 0; ops.len = 0;
ops.retlen = 0; ops.retlen = 0;
ops.ooblen = mtd->oobsize; ops.ooblen = mtd->oobsize;

View File

@ -340,7 +340,7 @@ u16 mtd_Read_Page_Main_Spare(u8 *read_data, u32 Block,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int ret; int ret;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.datbuf = read_data; ops.datbuf = read_data;
ops.len = DeviceInfo.wPageDataSize; ops.len = DeviceInfo.wPageDataSize;
ops.oobbuf = read_data + DeviceInfo.wPageDataSize + BTSIG_OFFSET; ops.oobbuf = read_data + DeviceInfo.wPageDataSize + BTSIG_OFFSET;
@ -400,7 +400,7 @@ u16 mtd_Write_Page_Main_Spare(u8 *write_data, u32 Block,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int ret; int ret;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.datbuf = write_data; ops.datbuf = write_data;
ops.len = DeviceInfo.wPageDataSize; ops.len = DeviceInfo.wPageDataSize;
ops.oobbuf = write_data + DeviceInfo.wPageDataSize + BTSIG_OFFSET; ops.oobbuf = write_data + DeviceInfo.wPageDataSize + BTSIG_OFFSET;
@ -473,7 +473,7 @@ u16 mtd_Read_Page_Spare(u8 *read_data, u32 Block,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int ret; int ret;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.datbuf = NULL; ops.datbuf = NULL;
ops.len = 0; ops.len = 0;
ops.oobbuf = read_data; ops.oobbuf = read_data;

View File

@ -1025,7 +1025,7 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
int cmlen = min_t(int, c->oobavail, OOB_CM_SIZE); int cmlen = min_t(int, c->oobavail, OOB_CM_SIZE);
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.ooblen = NR_OOB_SCAN_PAGES * c->oobavail; ops.ooblen = NR_OOB_SCAN_PAGES * c->oobavail;
ops.oobbuf = c->oobbuf; ops.oobbuf = c->oobbuf;
ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0; ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0;
@ -1068,7 +1068,7 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int ret, cmlen = min_t(int, c->oobavail, OOB_CM_SIZE); int ret, cmlen = min_t(int, c->oobavail, OOB_CM_SIZE);
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.ooblen = cmlen; ops.ooblen = cmlen;
ops.oobbuf = c->oobbuf; ops.oobbuf = c->oobbuf;
ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0; ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0;
@ -1094,7 +1094,7 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c,
struct mtd_oob_ops ops; struct mtd_oob_ops ops;
int cmlen = min_t(int, c->oobavail, OOB_CM_SIZE); int cmlen = min_t(int, c->oobavail, OOB_CM_SIZE);
ops.mode = MTD_OOB_AUTO; ops.mode = MTD_OPS_AUTO_OOB;
ops.ooblen = cmlen; ops.ooblen = cmlen;
ops.oobbuf = (uint8_t *)&oob_cleanmarker; ops.oobbuf = (uint8_t *)&oob_cleanmarker;
ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0; ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0;

View File

@ -79,7 +79,7 @@ struct mtd_erase_region_info {
* @ooblen: number of oob bytes to write/read * @ooblen: number of oob bytes to write/read
* @oobretlen: number of oob bytes written/read * @oobretlen: number of oob bytes written/read
* @ooboffs: offset of oob data in the oob area (only relevant when * @ooboffs: offset of oob data in the oob area (only relevant when
* mode = MTD_OOB_PLACE) * mode = MTD_OPS_PLACE_OOB)
* @datbuf: data buffer - if NULL only oob data are read/written * @datbuf: data buffer - if NULL only oob data are read/written
* @oobbuf: oob data buffer * @oobbuf: oob data buffer
* *

View File

@ -46,18 +46,18 @@ struct mtd_oob_buf64 {
}; };
/* /*
* oob operation modes * MTD operation modes
* *
* MTD_OOB_PLACE: oob data are placed at the given offset (default) * MTD_OPS_PLACE_OOB: oob data are placed at the given offset (default)
* MTD_OOB_AUTO: oob data are automatically placed at the free areas * MTD_OPS_AUTO_OOB: oob data are automatically placed at the free areas
* which are defined by the internal ecclayout * which are defined by the internal ecclayout
* MTD_OOB_RAW: mode to read or write oob and data without doing ECC * MTD_OPS_RAW: mode to read or write oob and data without doing ECC
* checking * checking
*/ */
enum { enum {
MTD_OOB_PLACE = 0, MTD_OPS_PLACE_OOB = 0,
MTD_OOB_AUTO = 1, MTD_OPS_AUTO_OOB = 1,
MTD_OOB_RAW = 2, MTD_OPS_RAW = 2,
}; };
#define MTD_ABSENT 0 #define MTD_ABSENT 0