aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-23 11:29:55 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:25:24 -0500
commita2cc5ba075f9bc837d0b4d4ec7328dcefc11859d (patch)
treea5f2c88ddd21028247bfaf02ca336dd501ed3a5f /drivers
parentfd2819bbc92fc98bed5d612e4acbe16b6326f6bf (diff)
mtd: introduce mtd_write_oob interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/inftlcore.c4
-rw-r--r--drivers/mtd/mtdchar.c6
-rw-r--r--drivers/mtd/mtdconcat.c2
-rw-r--r--drivers/mtd/mtdpart.c2
-rw-r--r--drivers/mtd/mtdswap.c4
-rw-r--r--drivers/mtd/nand/nand_bbt.c2
-rw-r--r--drivers/mtd/nand/sm_common.c2
-rw-r--r--drivers/mtd/nftlcore.c4
-rw-r--r--drivers/mtd/sm_ftl.c2
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c10
-rw-r--r--drivers/staging/spectra/lld_mtd.c6
11 files changed, 22 insertions, 22 deletions
diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c
index 07646e1273e2..28646c95cfb8 100644
--- a/drivers/mtd/inftlcore.c
+++ b/drivers/mtd/inftlcore.c
@@ -178,7 +178,7 @@ int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
178 ops.oobbuf = buf; 178 ops.oobbuf = buf;
179 ops.datbuf = NULL; 179 ops.datbuf = NULL;
180 180
181 res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); 181 res = mtd_write_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
182 *retlen = ops.oobretlen; 182 *retlen = ops.oobretlen;
183 return res; 183 return res;
184} 184}
@@ -199,7 +199,7 @@ static int inftl_write(struct mtd_info *mtd, loff_t offs, size_t len,
199 ops.datbuf = buf; 199 ops.datbuf = buf;
200 ops.len = len; 200 ops.len = len;
201 201
202 res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); 202 res = mtd_write_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
203 *retlen = ops.retlen; 203 *retlen = ops.retlen;
204 return res; 204 return res;
205} 205}
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index e74f570a7b93..234e3d27143c 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -325,7 +325,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c
325 ops.ooboffs = 0; 325 ops.ooboffs = 0;
326 ops.len = len; 326 ops.len = len;
327 327
328 ret = mtd->write_oob(mtd, *ppos, &ops); 328 ret = mtd_write_oob(mtd, *ppos, &ops);
329 retlen = ops.retlen; 329 retlen = ops.retlen;
330 break; 330 break;
331 } 331 }
@@ -426,7 +426,7 @@ static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd,
426 return PTR_ERR(ops.oobbuf); 426 return PTR_ERR(ops.oobbuf);
427 427
428 start &= ~((uint64_t)mtd->writesize - 1); 428 start &= ~((uint64_t)mtd->writesize - 1);
429 ret = mtd->write_oob(mtd, start, &ops); 429 ret = mtd_write_oob(mtd, start, &ops);
430 430
431 if (ops.oobretlen > 0xFFFFFFFFU) 431 if (ops.oobretlen > 0xFFFFFFFFU)
432 ret = -EOVERFLOW; 432 ret = -EOVERFLOW;
@@ -609,7 +609,7 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd,
609 ops.oobbuf = NULL; 609 ops.oobbuf = NULL;
610 } 610 }
611 611
612 ret = mtd->write_oob(mtd, (loff_t)req.start, &ops); 612 ret = mtd_write_oob(mtd, (loff_t)req.start, &ops);
613 613
614 kfree(ops.datbuf); 614 kfree(ops.datbuf);
615 kfree(ops.oobbuf); 615 kfree(ops.oobbuf);
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index cf35642e5f49..3d9c1ffdbbbf 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -333,7 +333,7 @@ concat_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
333 if (to + devops.len > subdev->size) 333 if (to + devops.len > subdev->size)
334 devops.len = subdev->size - to; 334 devops.len = subdev->size - to;
335 335
336 err = subdev->write_oob(subdev, to, &devops); 336 err = mtd_write_oob(subdev, to, &devops);
337 ops->retlen += devops.oobretlen; 337 ops->retlen += devops.oobretlen;
338 if (err) 338 if (err)
339 return err; 339 return err;
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 6fdc74ef19c1..8a46cd2bb78f 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -217,7 +217,7 @@ static int part_write_oob(struct mtd_info *mtd, loff_t to,
217 return -EINVAL; 217 return -EINVAL;
218 if (ops->datbuf && to + ops->len > mtd->size) 218 if (ops->datbuf && to + ops->len > mtd->size)
219 return -EINVAL; 219 return -EINVAL;
220 return part->master->write_oob(part->master, to + part->offset, ops); 220 return mtd_write_oob(part->master, to + part->offset, ops);
221} 221}
222 222
223static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from, 223static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from,
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index 0f0ab18d4405..85797390e3dd 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -403,7 +403,7 @@ static int mtdswap_write_marker(struct mtdswap_dev *d, struct swap_eb *eb,
403 offset = mtdswap_eb_offset(d, eb) + d->mtd->writesize; 403 offset = mtdswap_eb_offset(d, eb) + d->mtd->writesize;
404 } 404 }
405 405
406 ret = d->mtd->write_oob(d->mtd, offset , &ops); 406 ret = mtd_write_oob(d->mtd, offset, &ops);
407 407
408 if (ret) { 408 if (ret) {
409 dev_warn(d->dev, "Write OOB failed for block at %08llx " 409 dev_warn(d->dev, "Write OOB failed for block at %08llx "
@@ -946,7 +946,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d,
946 patt = mtdswap_test_patt(test + i); 946 patt = mtdswap_test_patt(test + i);
947 memset(d->page_buf, patt, mtd->writesize); 947 memset(d->page_buf, patt, mtd->writesize);
948 memset(d->oob_buf, patt, mtd->ecclayout->oobavail); 948 memset(d->oob_buf, patt, mtd->ecclayout->oobavail);
949 ret = mtd->write_oob(mtd, pos, &ops); 949 ret = mtd_write_oob(mtd, pos, &ops);
950 if (ret) 950 if (ret)
951 goto error; 951 goto error;
952 952
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index fcab50e80b90..20a112f591fe 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -350,7 +350,7 @@ static int scan_write_bbt(struct mtd_info *mtd, loff_t offs, size_t len,
350 ops.oobbuf = oob; 350 ops.oobbuf = oob;
351 ops.len = len; 351 ops.len = len;
352 352
353 return mtd->write_oob(mtd, offs, &ops); 353 return mtd_write_oob(mtd, offs, &ops);
354} 354}
355 355
356static u32 bbt_get_ver_offs(struct mtd_info *mtd, struct nand_bbt_descr *td) 356static u32 bbt_get_ver_offs(struct mtd_info *mtd, struct nand_bbt_descr *td)
diff --git a/drivers/mtd/nand/sm_common.c b/drivers/mtd/nand/sm_common.c
index 32ae5af7444f..774c3c266713 100644
--- a/drivers/mtd/nand/sm_common.c
+++ b/drivers/mtd/nand/sm_common.c
@@ -55,7 +55,7 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs)
55 ops.datbuf = NULL; 55 ops.datbuf = NULL;
56 56
57 57
58 ret = mtd->write_oob(mtd, ofs, &ops); 58 ret = mtd_write_oob(mtd, ofs, &ops);
59 if (ret < 0 || ops.oobretlen != SM_OOB_SIZE) { 59 if (ret < 0 || ops.oobretlen != SM_OOB_SIZE) {
60 printk(KERN_NOTICE 60 printk(KERN_NOTICE
61 "sm_common: can't mark sector at %i as bad\n", 61 "sm_common: can't mark sector at %i as bad\n",
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
index 7497f5efc26b..8847e60ad167 100644
--- a/drivers/mtd/nftlcore.c
+++ b/drivers/mtd/nftlcore.c
@@ -174,7 +174,7 @@ int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
174 ops.oobbuf = buf; 174 ops.oobbuf = buf;
175 ops.datbuf = NULL; 175 ops.datbuf = NULL;
176 176
177 res = mtd->write_oob(mtd, offs & ~mask, &ops); 177 res = mtd_write_oob(mtd, offs & ~mask, &ops);
178 *retlen = ops.oobretlen; 178 *retlen = ops.oobretlen;
179 return res; 179 return res;
180} 180}
@@ -198,7 +198,7 @@ static int nftl_write(struct mtd_info *mtd, loff_t offs, size_t len,
198 ops.datbuf = buf; 198 ops.datbuf = buf;
199 ops.len = len; 199 ops.len = len;
200 200
201 res = mtd->write_oob(mtd, offs & ~mask, &ops); 201 res = mtd_write_oob(mtd, offs & ~mask, &ops);
202 *retlen = ops.retlen; 202 *retlen = ops.retlen;
203 return res; 203 return res;
204} 204}
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index 748aa4416691..4ec2af7fb845 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -343,7 +343,7 @@ static int sm_write_sector(struct sm_ftl *ftl,
343 ops.ooblen = SM_OOB_SIZE; 343 ops.ooblen = SM_OOB_SIZE;
344 ops.oobbuf = (void *)oob; 344 ops.oobbuf = (void *)oob;
345 345
346 ret = mtd->write_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops); 346 ret = mtd_write_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops);
347 347
348 /* Now we assume that hardware will catch write bitflip errors */ 348 /* Now we assume that hardware will catch write bitflip errors */
349 /* If you are paranoid, use CONFIG_MTD_NAND_VERIFY_WRITE */ 349 /* If you are paranoid, use CONFIG_MTD_NAND_VERIFY_WRITE */
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index 962d27a64e64..81113885e086 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -139,7 +139,7 @@ static int write_eraseblock(int ebnum)
139 ops.ooboffs = use_offset; 139 ops.ooboffs = use_offset;
140 ops.datbuf = NULL; 140 ops.datbuf = NULL;
141 ops.oobbuf = writebuf; 141 ops.oobbuf = writebuf;
142 err = mtd->write_oob(mtd, addr, &ops); 142 err = mtd_write_oob(mtd, addr, &ops);
143 if (err || ops.oobretlen != use_len) { 143 if (err || ops.oobretlen != use_len) {
144 printk(PRINT_PREF "error: writeoob failed at %#llx\n", 144 printk(PRINT_PREF "error: writeoob failed at %#llx\n",
145 (long long)addr); 145 (long long)addr);
@@ -524,7 +524,7 @@ static int __init mtd_oobtest_init(void)
524 ops.oobbuf = writebuf; 524 ops.oobbuf = writebuf;
525 printk(PRINT_PREF "attempting to start write past end of OOB\n"); 525 printk(PRINT_PREF "attempting to start write past end of OOB\n");
526 printk(PRINT_PREF "an error is expected...\n"); 526 printk(PRINT_PREF "an error is expected...\n");
527 err = mtd->write_oob(mtd, addr0, &ops); 527 err = mtd_write_oob(mtd, addr0, &ops);
528 if (err) { 528 if (err) {
529 printk(PRINT_PREF "error occurred as expected\n"); 529 printk(PRINT_PREF "error occurred as expected\n");
530 err = 0; 530 err = 0;
@@ -568,7 +568,7 @@ static int __init mtd_oobtest_init(void)
568 ops.oobbuf = writebuf; 568 ops.oobbuf = writebuf;
569 printk(PRINT_PREF "attempting to write past end of device\n"); 569 printk(PRINT_PREF "attempting to write past end of device\n");
570 printk(PRINT_PREF "an error is expected...\n"); 570 printk(PRINT_PREF "an error is expected...\n");
571 err = mtd->write_oob(mtd, mtd->size - mtd->writesize, &ops); 571 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops);
572 if (err) { 572 if (err) {
573 printk(PRINT_PREF "error occurred as expected\n"); 573 printk(PRINT_PREF "error occurred as expected\n");
574 err = 0; 574 err = 0;
@@ -612,7 +612,7 @@ static int __init mtd_oobtest_init(void)
612 ops.oobbuf = writebuf; 612 ops.oobbuf = writebuf;
613 printk(PRINT_PREF "attempting to write past end of device\n"); 613 printk(PRINT_PREF "attempting to write past end of device\n");
614 printk(PRINT_PREF "an error is expected...\n"); 614 printk(PRINT_PREF "an error is expected...\n");
615 err = mtd->write_oob(mtd, mtd->size - mtd->writesize, &ops); 615 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops);
616 if (err) { 616 if (err) {
617 printk(PRINT_PREF "error occurred as expected\n"); 617 printk(PRINT_PREF "error occurred as expected\n");
618 err = 0; 618 err = 0;
@@ -670,7 +670,7 @@ static int __init mtd_oobtest_init(void)
670 ops.ooboffs = 0; 670 ops.ooboffs = 0;
671 ops.datbuf = NULL; 671 ops.datbuf = NULL;
672 ops.oobbuf = writebuf; 672 ops.oobbuf = writebuf;
673 err = mtd->write_oob(mtd, addr, &ops); 673 err = mtd_write_oob(mtd, addr, &ops);
674 if (err) 674 if (err)
675 goto out; 675 goto out;
676 if (i % 256 == 0) 676 if (i % 256 == 0)
diff --git a/drivers/staging/spectra/lld_mtd.c b/drivers/staging/spectra/lld_mtd.c
index ed8e5f067087..4aa48ddf979c 100644
--- a/drivers/staging/spectra/lld_mtd.c
+++ b/drivers/staging/spectra/lld_mtd.c
@@ -411,9 +411,9 @@ u16 mtd_Write_Page_Main_Spare(u8 *write_data, u32 Block,
411 ops.ooblen = BTSIG_BYTES; 411 ops.ooblen = BTSIG_BYTES;
412 ops.ooboffs = 0; 412 ops.ooboffs = 0;
413 413
414 ret = spectra_mtd->write_oob(spectra_mtd, 414 ret = mtd_write_oob(spectra_mtd,
415 (Block * spectra_mtd->erasesize) + (Page * spectra_mtd->writesize), 415 (Block * spectra_mtd->erasesize) + (Page * spectra_mtd->writesize),
416 &ops); 416 &ops);
417 if (ret) { 417 if (ret) {
418 printk(KERN_ERR "%s failed %d\n", __func__, ret); 418 printk(KERN_ERR "%s failed %d\n", __func__, ret);
419 return FAIL; 419 return FAIL;