diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-27 16:16:10 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 09:06:50 -0400 |
commit | 5bd34c091a044d130601370c370f84b1c59f1627 (patch) | |
tree | 8b08012a9a30186a8805d506f8438e2944f5f31b /drivers/mtd/mtdchar.c | |
parent | ff268fb8791cf18df536113355d7184007c269d9 (diff) |
[MTD] NAND Replace oobinfo by ecclayout
The nand_oobinfo structure is not fitting the newer error correction
demands anymore. Replace it by struct nand_ecclayout and fixup the users
all over the place. Keep the nand_oobinfo based ioctl for user space
compability reasons.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r-- | drivers/mtd/mtdchar.c | 26 |
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; |