aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 608f7af679cb..e75ec5fe7760 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -512,14 +512,36 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
512 break; 512 break;
513 } 513 }
514 514
515 /* Legacy interface */
515 case MEMGETOOBSEL: 516 case MEMGETOOBSEL:
516 { 517 {
517 if (copy_to_user(argp, mtd->oobinfo, 518 struct nand_oobinfo oi;
518 sizeof(struct nand_oobinfo))) 519
520 if (!mtd->ecclayout)
521 return -EOPNOTSUPP;
522 if (mtd->ecclayout->eccbytes > ARRAY_SIZE(oi.eccpos))
523 return -EINVAL;
524
525 oi.useecc = MTD_NANDECC_AUTOPLACE;
526 memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos));
527 memcpy(&oi.oobfree, mtd->ecclayout->oobfree,
528 sizeof(oi.oobfree));
529
530 if (copy_to_user(argp, &oi, sizeof(struct nand_oobinfo)))
519 return -EFAULT; 531 return -EFAULT;
520 break; 532 break;
521 } 533 }
522 534
535 case ECCGETLAYOUT:
536
537 if (!mtd->ecclayout)
538 return -EOPNOTSUPP;
539
540 if (copy_to_user(argp, &mtd->ecclayout,
541 sizeof(struct nand_ecclayout)))
542 return -EFAULT;
543 break;
544
523 case MEMGETBADBLOCK: 545 case MEMGETBADBLOCK:
524 { 546 {
525 loff_t offs; 547 loff_t offs;