Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6:
[JFFS2][XATTR] Fix memory leak in POSIX-ACL support
fs/jffs2/: make 2 functions static
[MTD] NAND: Fix broken sharpsl driver
[JFFS2][XATTR] Fix xd->refcnt race condition
MTD: kernel-doc fixes + additions
MTD: fix all kernel-doc warnings
[MTD] DOC: Fixup read functions and do a little cleanup

+331 -432
+6 -5
Documentation/DocBook/mtdnand.tmpl
··· 109 109 for most of the implementations. These functions can be replaced by the 110 110 board driver if neccecary. Those functions are called via pointers in the 111 111 NAND chip description structure. The board driver can set the functions which 112 - should be replaced by board dependend functions before calling nand_scan(). 112 + should be replaced by board dependent functions before calling nand_scan(). 113 113 If the function pointer is NULL on entry to nand_scan() then the pointer 114 114 is set to the default function which is suitable for the detected chip type. 115 115 </para></listitem> ··· 133 133 [REPLACEABLE]</para><para> 134 134 Replaceable members hold hardware related functions which can be 135 135 provided by the board driver. The board driver can set the functions which 136 - should be replaced by board dependend functions before calling nand_scan(). 136 + should be replaced by board dependent functions before calling nand_scan(). 137 137 If the function pointer is NULL on entry to nand_scan() then the pointer 138 138 is set to the default function which is suitable for the detected chip type. 139 139 </para></listitem> ··· 156 156 <title>Basic board driver</title> 157 157 <para> 158 158 For most boards it will be sufficient to provide just the 159 - basic functions and fill out some really board dependend 159 + basic functions and fill out some really board dependent 160 160 members in the nand chip description structure. 161 - See drivers/mtd/nand/skeleton for reference. 162 161 </para> 163 162 <sect1> 164 163 <title>Basic defines</title> ··· 1294 1295 </para> 1295 1296 !Idrivers/mtd/nand/nand_base.c 1296 1297 !Idrivers/mtd/nand/nand_bbt.c 1297 - !Idrivers/mtd/nand/nand_ecc.c 1298 + <!-- No internal functions for kernel-doc: 1299 + X!Idrivers/mtd/nand/nand_ecc.c 1300 + --> 1298 1301 </chapter> 1299 1302 1300 1303 <chapter id="credits">
+75 -108
drivers/mtd/devices/doc2000.c
··· 55 55 size_t *retlen, u_char *buf); 56 56 static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, 57 57 size_t *retlen, const u_char *buf); 58 - static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, 59 - size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); 60 - static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, 61 - size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); 62 58 static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, 63 59 struct mtd_oob_ops *ops); 64 60 static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, ··· 611 615 static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, 612 616 size_t * retlen, u_char * buf) 613 617 { 614 - /* Just a special case of doc_read_ecc */ 615 - return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL); 616 - } 617 - 618 - static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, 619 - size_t * retlen, u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel) 620 - { 621 618 struct DiskOnChip *this = mtd->priv; 622 619 void __iomem *docptr = this->virtadr; 623 620 struct Nand *mychip; 624 - unsigned char syndrome[6]; 621 + unsigned char syndrome[6], eccbuf[6]; 625 622 volatile char dummy; 626 623 int i, len256 = 0, ret=0; 627 624 size_t left = len; ··· 662 673 DoC_Address(this, ADDR_COLUMN_PAGE, from, CDSN_CTRL_WP, 663 674 CDSN_CTRL_ECC_IO); 664 675 665 - if (eccbuf) { 666 - /* Prime the ECC engine */ 667 - WriteDOC(DOC_ECC_RESET, docptr, ECCConf); 668 - WriteDOC(DOC_ECC_EN, docptr, ECCConf); 669 - } else { 670 - /* disable the ECC engine */ 671 - WriteDOC(DOC_ECC_RESET, docptr, ECCConf); 672 - WriteDOC(DOC_ECC_DIS, docptr, ECCConf); 673 - } 676 + /* Prime the ECC engine */ 677 + WriteDOC(DOC_ECC_RESET, docptr, ECCConf); 678 + WriteDOC(DOC_ECC_EN, docptr, ECCConf); 674 679 675 680 /* treat crossing 256-byte sector for 2M x 8bits devices */ 676 681 if (this->page256 && from + len > (from | 0xff) + 1) { ··· 681 698 /* Let the caller know we completed it */ 682 699 *retlen += len; 683 700 684 - if (eccbuf) { 685 - /* Read the ECC data through the DiskOnChip ECC logic */ 686 - /* Note: this will work even with 2M x 8bit devices as */ 687 - /* they have 8 bytes of OOB per 256 page. mf. */ 688 - DoC_ReadBuf(this, eccbuf, 6); 701 + /* Read the ECC data through the DiskOnChip ECC logic */ 702 + /* Note: this will work even with 2M x 8bit devices as */ 703 + /* they have 8 bytes of OOB per 256 page. mf. */ 704 + DoC_ReadBuf(this, eccbuf, 6); 689 705 690 - /* Flush the pipeline */ 691 - if (DoC_is_Millennium(this)) { 692 - dummy = ReadDOC(docptr, ECCConf); 693 - dummy = ReadDOC(docptr, ECCConf); 694 - i = ReadDOC(docptr, ECCConf); 695 - } else { 696 - dummy = ReadDOC(docptr, 2k_ECCStatus); 697 - dummy = ReadDOC(docptr, 2k_ECCStatus); 698 - i = ReadDOC(docptr, 2k_ECCStatus); 699 - } 706 + /* Flush the pipeline */ 707 + if (DoC_is_Millennium(this)) { 708 + dummy = ReadDOC(docptr, ECCConf); 709 + dummy = ReadDOC(docptr, ECCConf); 710 + i = ReadDOC(docptr, ECCConf); 711 + } else { 712 + dummy = ReadDOC(docptr, 2k_ECCStatus); 713 + dummy = ReadDOC(docptr, 2k_ECCStatus); 714 + i = ReadDOC(docptr, 2k_ECCStatus); 715 + } 700 716 701 - /* Check the ECC Status */ 702 - if (i & 0x80) { 703 - int nb_errors; 704 - /* There was an ECC error */ 717 + /* Check the ECC Status */ 718 + if (i & 0x80) { 719 + int nb_errors; 720 + /* There was an ECC error */ 705 721 #ifdef ECC_DEBUG 706 - printk(KERN_ERR "DiskOnChip ECC Error: Read at %lx\n", (long)from); 722 + printk(KERN_ERR "DiskOnChip ECC Error: Read at %lx\n", (long)from); 707 723 #endif 708 - /* Read the ECC syndrom through the DiskOnChip ECC logic. 709 - These syndrome will be all ZERO when there is no error */ 710 - for (i = 0; i < 6; i++) { 711 - syndrome[i] = 712 - ReadDOC(docptr, ECCSyndrome0 + i); 713 - } 714 - nb_errors = doc_decode_ecc(buf, syndrome); 724 + /* Read the ECC syndrom through the DiskOnChip ECC 725 + logic. These syndrome will be all ZERO when there 726 + is no error */ 727 + for (i = 0; i < 6; i++) { 728 + syndrome[i] = 729 + ReadDOC(docptr, ECCSyndrome0 + i); 730 + } 731 + nb_errors = doc_decode_ecc(buf, syndrome); 715 732 716 733 #ifdef ECC_DEBUG 717 - printk(KERN_ERR "Errors corrected: %x\n", nb_errors); 734 + printk(KERN_ERR "Errors corrected: %x\n", nb_errors); 718 735 #endif 719 - if (nb_errors < 0) { 720 - /* We return error, but have actually done the read. Not that 721 - this can be told to user-space, via sys_read(), but at least 722 - MTD-aware stuff can know about it by checking *retlen */ 723 - ret = -EIO; 724 - } 736 + if (nb_errors < 0) { 737 + /* We return error, but have actually done the 738 + read. Not that this can be told to 739 + user-space, via sys_read(), but at least 740 + MTD-aware stuff can know about it by 741 + checking *retlen */ 742 + ret = -EIO; 725 743 } 744 + } 726 745 727 746 #ifdef PSYCHO_DEBUG 728 - printk(KERN_DEBUG "ECC DATA at %lxB: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 729 - (long)from, eccbuf[0], eccbuf[1], eccbuf[2], 730 - eccbuf[3], eccbuf[4], eccbuf[5]); 747 + printk(KERN_DEBUG "ECC DATA at %lxB: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 748 + (long)from, eccbuf[0], eccbuf[1], eccbuf[2], 749 + eccbuf[3], eccbuf[4], eccbuf[5]); 731 750 #endif 732 751 733 - /* disable the ECC engine */ 734 - WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 735 - } 752 + /* disable the ECC engine */ 753 + WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 736 754 737 755 /* according to 11.4.1, we need to wait for the busy line 738 756 * drop if we read to the end of the page. */ ··· 755 771 static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, 756 772 size_t * retlen, const u_char * buf) 757 773 { 758 - char eccbuf[6]; 759 - return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL); 760 - } 761 - 762 - static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, 763 - size_t * retlen, const u_char * buf, 764 - u_char * eccbuf, struct nand_oobinfo *oobsel) 765 - { 766 774 struct DiskOnChip *this = mtd->priv; 767 775 int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */ 768 776 void __iomem *docptr = this->virtadr; 777 + unsigned char eccbuf[6]; 769 778 volatile char dummy; 770 779 int len256 = 0; 771 780 struct Nand *mychip; ··· 812 835 DoC_Command(this, NAND_CMD_SEQIN, 0); 813 836 DoC_Address(this, ADDR_COLUMN_PAGE, to, 0, CDSN_CTRL_ECC_IO); 814 837 815 - if (eccbuf) { 816 - /* Prime the ECC engine */ 817 - WriteDOC(DOC_ECC_RESET, docptr, ECCConf); 818 - WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); 819 - } else { 820 - /* disable the ECC engine */ 821 - WriteDOC(DOC_ECC_RESET, docptr, ECCConf); 822 - WriteDOC(DOC_ECC_DIS, docptr, ECCConf); 823 - } 838 + /* Prime the ECC engine */ 839 + WriteDOC(DOC_ECC_RESET, docptr, ECCConf); 840 + WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); 824 841 825 842 /* treat crossing 256-byte sector for 2M x 8bits devices */ 826 843 if (this->page256 && to + len > (to | 0xff) + 1) { ··· 844 873 845 874 DoC_WriteBuf(this, &buf[len256], len - len256); 846 875 847 - if (eccbuf) { 848 - WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_CE, docptr, 849 - CDSNControl); 876 + WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_CE, docptr, CDSNControl); 850 877 851 - if (DoC_is_Millennium(this)) { 852 - WriteDOC(0, docptr, NOP); 853 - WriteDOC(0, docptr, NOP); 854 - WriteDOC(0, docptr, NOP); 855 - } else { 856 - WriteDOC_(0, docptr, this->ioreg); 857 - WriteDOC_(0, docptr, this->ioreg); 858 - WriteDOC_(0, docptr, this->ioreg); 859 - } 860 - 861 - WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_FLASH_IO | CDSN_CTRL_CE, docptr, 862 - CDSNControl); 863 - 864 - /* Read the ECC data through the DiskOnChip ECC logic */ 865 - for (di = 0; di < 6; di++) { 866 - eccbuf[di] = ReadDOC(docptr, ECCSyndrome0 + di); 867 - } 868 - 869 - /* Reset the ECC engine */ 870 - WriteDOC(DOC_ECC_DIS, docptr, ECCConf); 871 - 872 - #ifdef PSYCHO_DEBUG 873 - printk 874 - ("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 875 - (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 876 - eccbuf[4], eccbuf[5]); 877 - #endif 878 + if (DoC_is_Millennium(this)) { 879 + WriteDOC(0, docptr, NOP); 880 + WriteDOC(0, docptr, NOP); 881 + WriteDOC(0, docptr, NOP); 882 + } else { 883 + WriteDOC_(0, docptr, this->ioreg); 884 + WriteDOC_(0, docptr, this->ioreg); 885 + WriteDOC_(0, docptr, this->ioreg); 878 886 } 879 887 888 + WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_FLASH_IO | CDSN_CTRL_CE, docptr, 889 + CDSNControl); 890 + 891 + /* Read the ECC data through the DiskOnChip ECC logic */ 892 + for (di = 0; di < 6; di++) { 893 + eccbuf[di] = ReadDOC(docptr, ECCSyndrome0 + di); 894 + } 895 + 896 + /* Reset the ECC engine */ 897 + WriteDOC(DOC_ECC_DIS, docptr, ECCConf); 898 + 899 + #ifdef PSYCHO_DEBUG 900 + printk 901 + ("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 902 + (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 903 + eccbuf[4], eccbuf[5]); 904 + #endif 880 905 DoC_Command(this, NAND_CMD_PAGEPROG, 0); 881 906 882 907 DoC_Command(this, NAND_CMD_STATUS, CDSN_CTRL_WP);
+73 -110
drivers/mtd/devices/doc2001.c
··· 37 37 size_t *retlen, u_char *buf); 38 38 static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, 39 39 size_t *retlen, const u_char *buf); 40 - static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, 41 - size_t *retlen, u_char *buf, u_char *eccbuf, 42 - struct nand_oobinfo *oobsel); 43 - static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, 44 - size_t *retlen, const u_char *buf, u_char *eccbuf, 45 - struct nand_oobinfo *oobsel); 46 40 static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, 47 41 struct mtd_oob_ops *ops); 48 42 static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, ··· 391 397 static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, 392 398 size_t *retlen, u_char *buf) 393 399 { 394 - /* Just a special case of doc_read_ecc */ 395 - return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL); 396 - } 397 - 398 - static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, 399 - size_t *retlen, u_char *buf, u_char *eccbuf, 400 - struct nand_oobinfo *oobsel) 401 - { 402 400 int i, ret; 403 401 volatile char dummy; 404 - unsigned char syndrome[6]; 402 + unsigned char syndrome[6], eccbuf[6]; 405 403 struct DiskOnChip *this = mtd->priv; 406 404 void __iomem *docptr = this->virtadr; 407 405 struct Nand *mychip = &this->chips[from >> (this->chipshift)]; ··· 423 437 DoC_Address(docptr, 3, from, CDSN_CTRL_WP, 0x00); 424 438 DoC_WaitReady(docptr); 425 439 426 - if (eccbuf) { 427 - /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 428 - WriteDOC (DOC_ECC_RESET, docptr, ECCConf); 429 - WriteDOC (DOC_ECC_EN, docptr, ECCConf); 430 - } else { 431 - /* disable the ECC engine */ 432 - WriteDOC (DOC_ECC_RESET, docptr, ECCConf); 433 - WriteDOC (DOC_ECC_DIS, docptr, ECCConf); 434 - } 440 + /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 441 + WriteDOC (DOC_ECC_RESET, docptr, ECCConf); 442 + WriteDOC (DOC_ECC_EN, docptr, ECCConf); 435 443 436 444 /* Read the data via the internal pipeline through CDSN IO register, 437 445 see Pipelined Read Operations 11.3 */ ··· 445 465 *retlen = len; 446 466 ret = 0; 447 467 448 - if (eccbuf) { 449 - /* Read the ECC data from Spare Data Area, 450 - see Reed-Solomon EDC/ECC 11.1 */ 451 - dummy = ReadDOC(docptr, ReadPipeInit); 468 + /* Read the ECC data from Spare Data Area, 469 + see Reed-Solomon EDC/ECC 11.1 */ 470 + dummy = ReadDOC(docptr, ReadPipeInit); 452 471 #ifndef USE_MEMCPY 453 - for (i = 0; i < 5; i++) { 454 - /* N.B. you have to increase the source address in this way or the 455 - ECC logic will not work properly */ 456 - eccbuf[i] = ReadDOC(docptr, Mil_CDSN_IO + i); 457 - } 472 + for (i = 0; i < 5; i++) { 473 + /* N.B. you have to increase the source address in this way or the 474 + ECC logic will not work properly */ 475 + eccbuf[i] = ReadDOC(docptr, Mil_CDSN_IO + i); 476 + } 458 477 #else 459 - memcpy_fromio(eccbuf, docptr + DoC_Mil_CDSN_IO, 5); 478 + memcpy_fromio(eccbuf, docptr + DoC_Mil_CDSN_IO, 5); 460 479 #endif 461 - eccbuf[5] = ReadDOC(docptr, LastDataRead); 480 + eccbuf[5] = ReadDOC(docptr, LastDataRead); 462 481 463 - /* Flush the pipeline */ 464 - dummy = ReadDOC(docptr, ECCConf); 465 - dummy = ReadDOC(docptr, ECCConf); 482 + /* Flush the pipeline */ 483 + dummy = ReadDOC(docptr, ECCConf); 484 + dummy = ReadDOC(docptr, ECCConf); 466 485 467 - /* Check the ECC Status */ 468 - if (ReadDOC(docptr, ECCConf) & 0x80) { 469 - int nb_errors; 470 - /* There was an ECC error */ 486 + /* Check the ECC Status */ 487 + if (ReadDOC(docptr, ECCConf) & 0x80) { 488 + int nb_errors; 489 + /* There was an ECC error */ 471 490 #ifdef ECC_DEBUG 472 - printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); 491 + printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); 473 492 #endif 474 - /* Read the ECC syndrom through the DiskOnChip ECC logic. 475 - These syndrome will be all ZERO when there is no error */ 476 - for (i = 0; i < 6; i++) { 477 - syndrome[i] = ReadDOC(docptr, ECCSyndrome0 + i); 478 - } 479 - nb_errors = doc_decode_ecc(buf, syndrome); 480 - #ifdef ECC_DEBUG 481 - printk("ECC Errors corrected: %x\n", nb_errors); 482 - #endif 483 - if (nb_errors < 0) { 484 - /* We return error, but have actually done the read. Not that 485 - this can be told to user-space, via sys_read(), but at least 486 - MTD-aware stuff can know about it by checking *retlen */ 487 - ret = -EIO; 488 - } 493 + /* Read the ECC syndrom through the DiskOnChip ECC logic. 494 + These syndrome will be all ZERO when there is no error */ 495 + for (i = 0; i < 6; i++) { 496 + syndrome[i] = ReadDOC(docptr, ECCSyndrome0 + i); 489 497 } 498 + nb_errors = doc_decode_ecc(buf, syndrome); 499 + #ifdef ECC_DEBUG 500 + printk("ECC Errors corrected: %x\n", nb_errors); 501 + #endif 502 + if (nb_errors < 0) { 503 + /* We return error, but have actually done the read. Not that 504 + this can be told to user-space, via sys_read(), but at least 505 + MTD-aware stuff can know about it by checking *retlen */ 506 + ret = -EIO; 507 + } 508 + } 490 509 491 510 #ifdef PSYCHO_DEBUG 492 - printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 493 - (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 494 - eccbuf[4], eccbuf[5]); 511 + printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 512 + (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 513 + eccbuf[4], eccbuf[5]); 495 514 #endif 496 515 497 - /* disable the ECC engine */ 498 - WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 499 - } 516 + /* disable the ECC engine */ 517 + WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 500 518 501 519 return ret; 502 520 } ··· 502 524 static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, 503 525 size_t *retlen, const u_char *buf) 504 526 { 505 - char eccbuf[6]; 506 - return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL); 507 - } 508 - 509 - static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, 510 - size_t *retlen, const u_char *buf, u_char *eccbuf, 511 - struct nand_oobinfo *oobsel) 512 - { 513 527 int i,ret = 0; 528 + char eccbuf[6]; 514 529 volatile char dummy; 515 530 struct DiskOnChip *this = mtd->priv; 516 531 void __iomem *docptr = this->virtadr; ··· 544 573 DoC_Address(docptr, 3, to, 0x00, 0x00); 545 574 DoC_WaitReady(docptr); 546 575 547 - if (eccbuf) { 548 - /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 549 - WriteDOC (DOC_ECC_RESET, docptr, ECCConf); 550 - WriteDOC (DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); 551 - } else { 552 - /* disable the ECC engine */ 553 - WriteDOC (DOC_ECC_RESET, docptr, ECCConf); 554 - WriteDOC (DOC_ECC_DIS, docptr, ECCConf); 555 - } 576 + /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 577 + WriteDOC (DOC_ECC_RESET, docptr, ECCConf); 578 + WriteDOC (DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); 556 579 557 580 /* Write the data via the internal pipeline through CDSN IO register, 558 581 see Pipelined Write Operations 11.2 */ ··· 561 596 #endif 562 597 WriteDOC(0x00, docptr, WritePipeTerm); 563 598 564 - if (eccbuf) { 565 - /* Write ECC data to flash, the ECC info is generated by the DiskOnChip ECC logic 566 - see Reed-Solomon EDC/ECC 11.1 */ 567 - WriteDOC(0, docptr, NOP); 568 - WriteDOC(0, docptr, NOP); 569 - WriteDOC(0, docptr, NOP); 599 + /* Write ECC data to flash, the ECC info is generated by the DiskOnChip ECC logic 600 + see Reed-Solomon EDC/ECC 11.1 */ 601 + WriteDOC(0, docptr, NOP); 602 + WriteDOC(0, docptr, NOP); 603 + WriteDOC(0, docptr, NOP); 570 604 571 - /* Read the ECC data through the DiskOnChip ECC logic */ 572 - for (i = 0; i < 6; i++) { 573 - eccbuf[i] = ReadDOC(docptr, ECCSyndrome0 + i); 574 - } 605 + /* Read the ECC data through the DiskOnChip ECC logic */ 606 + for (i = 0; i < 6; i++) { 607 + eccbuf[i] = ReadDOC(docptr, ECCSyndrome0 + i); 608 + } 575 609 576 - /* ignore the ECC engine */ 577 - WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 610 + /* ignore the ECC engine */ 611 + WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 578 612 579 613 #ifndef USE_MEMCPY 580 - /* Write the ECC data to flash */ 581 - for (i = 0; i < 6; i++) { 582 - /* N.B. you have to increase the source address in this way or the 583 - ECC logic will not work properly */ 584 - WriteDOC(eccbuf[i], docptr, Mil_CDSN_IO + i); 585 - } 614 + /* Write the ECC data to flash */ 615 + for (i = 0; i < 6; i++) { 616 + /* N.B. you have to increase the source address in this way or the 617 + ECC logic will not work properly */ 618 + WriteDOC(eccbuf[i], docptr, Mil_CDSN_IO + i); 619 + } 586 620 #else 587 - memcpy_toio(docptr + DoC_Mil_CDSN_IO, eccbuf, 6); 621 + memcpy_toio(docptr + DoC_Mil_CDSN_IO, eccbuf, 6); 588 622 #endif 589 623 590 - /* write the block status BLOCK_USED (0x5555) at the end of ECC data 591 - FIXME: this is only a hack for programming the IPL area for LinuxBIOS 592 - and should be replace with proper codes in user space utilities */ 593 - WriteDOC(0x55, docptr, Mil_CDSN_IO); 594 - WriteDOC(0x55, docptr, Mil_CDSN_IO + 1); 624 + /* write the block status BLOCK_USED (0x5555) at the end of ECC data 625 + FIXME: this is only a hack for programming the IPL area for LinuxBIOS 626 + and should be replace with proper codes in user space utilities */ 627 + WriteDOC(0x55, docptr, Mil_CDSN_IO); 628 + WriteDOC(0x55, docptr, Mil_CDSN_IO + 1); 595 629 596 - WriteDOC(0x00, docptr, WritePipeTerm); 630 + WriteDOC(0x00, docptr, WritePipeTerm); 597 631 598 632 #ifdef PSYCHO_DEBUG 599 - printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 600 - (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 601 - eccbuf[4], eccbuf[5]); 633 + printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 634 + (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 635 + eccbuf[4], eccbuf[5]); 602 636 #endif 603 - } 604 637 605 638 /* Commit the Page Program command and wait for ready 606 639 see Software Requirement 11.4 item 1.*/
+63 -101
drivers/mtd/devices/doc2001plus.c
··· 41 41 size_t *retlen, u_char *buf); 42 42 static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, 43 43 size_t *retlen, const u_char *buf); 44 - static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, 45 - size_t *retlen, u_char *buf, u_char *eccbuf, 46 - struct nand_oobinfo *oobsel); 47 - static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, 48 - size_t *retlen, const u_char *buf, u_char *eccbuf, 49 - struct nand_oobinfo *oobsel); 50 44 static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, 51 45 struct mtd_oob_ops *ops); 52 46 static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, ··· 589 595 static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, 590 596 size_t *retlen, u_char *buf) 591 597 { 592 - /* Just a special case of doc_read_ecc */ 593 - return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL); 594 - } 595 - 596 - static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, 597 - size_t *retlen, u_char *buf, u_char *eccbuf, 598 - struct nand_oobinfo *oobsel) 599 - { 600 598 int ret, i; 601 599 volatile char dummy; 602 600 loff_t fofs; 603 - unsigned char syndrome[6]; 601 + unsigned char syndrome[6], eccbuf[6]; 604 602 struct DiskOnChip *this = mtd->priv; 605 603 void __iomem * docptr = this->virtadr; 606 604 struct Nand *mychip = &this->chips[from >> (this->chipshift)]; ··· 630 644 WriteDOC(0, docptr, Mplus_FlashControl); 631 645 DoC_WaitReady(docptr); 632 646 633 - if (eccbuf) { 634 - /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 635 - WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); 636 - WriteDOC(DOC_ECC_EN, docptr, Mplus_ECCConf); 637 - } else { 638 - /* disable the ECC engine */ 639 - WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); 640 - } 647 + /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 648 + WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); 649 + WriteDOC(DOC_ECC_EN, docptr, Mplus_ECCConf); 641 650 642 651 /* Let the caller know we completed it */ 643 652 *retlen = len; 644 - ret = 0; 653 + ret = 0; 645 654 646 655 ReadDOC(docptr, Mplus_ReadPipeInit); 647 656 ReadDOC(docptr, Mplus_ReadPipeInit); 648 657 649 - if (eccbuf) { 650 - /* Read the data via the internal pipeline through CDSN IO 651 - register, see Pipelined Read Operations 11.3 */ 652 - MemReadDOC(docptr, buf, len); 658 + /* Read the data via the internal pipeline through CDSN IO 659 + register, see Pipelined Read Operations 11.3 */ 660 + MemReadDOC(docptr, buf, len); 653 661 654 - /* Read the ECC data following raw data */ 655 - MemReadDOC(docptr, eccbuf, 4); 656 - eccbuf[4] = ReadDOC(docptr, Mplus_LastDataRead); 657 - eccbuf[5] = ReadDOC(docptr, Mplus_LastDataRead); 662 + /* Read the ECC data following raw data */ 663 + MemReadDOC(docptr, eccbuf, 4); 664 + eccbuf[4] = ReadDOC(docptr, Mplus_LastDataRead); 665 + eccbuf[5] = ReadDOC(docptr, Mplus_LastDataRead); 658 666 659 - /* Flush the pipeline */ 660 - dummy = ReadDOC(docptr, Mplus_ECCConf); 661 - dummy = ReadDOC(docptr, Mplus_ECCConf); 667 + /* Flush the pipeline */ 668 + dummy = ReadDOC(docptr, Mplus_ECCConf); 669 + dummy = ReadDOC(docptr, Mplus_ECCConf); 662 670 663 - /* Check the ECC Status */ 664 - if (ReadDOC(docptr, Mplus_ECCConf) & 0x80) { 665 - int nb_errors; 666 - /* There was an ECC error */ 671 + /* Check the ECC Status */ 672 + if (ReadDOC(docptr, Mplus_ECCConf) & 0x80) { 673 + int nb_errors; 674 + /* There was an ECC error */ 667 675 #ifdef ECC_DEBUG 668 - printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); 676 + printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); 669 677 #endif 670 - /* Read the ECC syndrom through the DiskOnChip ECC logic. 671 - These syndrome will be all ZERO when there is no error */ 672 - for (i = 0; i < 6; i++) 673 - syndrome[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); 678 + /* Read the ECC syndrom through the DiskOnChip ECC logic. 679 + These syndrome will be all ZERO when there is no error */ 680 + for (i = 0; i < 6; i++) 681 + syndrome[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); 674 682 675 - nb_errors = doc_decode_ecc(buf, syndrome); 683 + nb_errors = doc_decode_ecc(buf, syndrome); 676 684 #ifdef ECC_DEBUG 677 - printk("ECC Errors corrected: %x\n", nb_errors); 685 + printk("ECC Errors corrected: %x\n", nb_errors); 678 686 #endif 679 - if (nb_errors < 0) { 680 - /* We return error, but have actually done the read. Not that 681 - this can be told to user-space, via sys_read(), but at least 682 - MTD-aware stuff can know about it by checking *retlen */ 687 + if (nb_errors < 0) { 688 + /* We return error, but have actually done the 689 + read. Not that this can be told to user-space, via 690 + sys_read(), but at least MTD-aware stuff can know 691 + about it by checking *retlen */ 683 692 #ifdef ECC_DEBUG 684 693 printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n", 685 694 __FILE__, __LINE__, (int)from); ··· 688 707 eccbuf[3], eccbuf[4], eccbuf[5]); 689 708 #endif 690 709 ret = -EIO; 691 - } 692 710 } 711 + } 693 712 694 713 #ifdef PSYCHO_DEBUG 695 - printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 696 - (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 697 - eccbuf[4], eccbuf[5]); 714 + printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 715 + (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 716 + eccbuf[4], eccbuf[5]); 698 717 #endif 699 - 700 - /* disable the ECC engine */ 701 - WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf); 702 - } else { 703 - /* Read the data via the internal pipeline through CDSN IO 704 - register, see Pipelined Read Operations 11.3 */ 705 - MemReadDOC(docptr, buf, len-2); 706 - buf[len-2] = ReadDOC(docptr, Mplus_LastDataRead); 707 - buf[len-1] = ReadDOC(docptr, Mplus_LastDataRead); 708 - } 718 + /* disable the ECC engine */ 719 + WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf); 709 720 710 721 /* Disable flash internally */ 711 722 WriteDOC(0, docptr, Mplus_FlashSelect); ··· 708 735 static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, 709 736 size_t *retlen, const u_char *buf) 710 737 { 711 - char eccbuf[6]; 712 - return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL); 713 - } 714 - 715 - static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, 716 - size_t *retlen, const u_char *buf, u_char *eccbuf, 717 - struct nand_oobinfo *oobsel) 718 - { 719 738 int i, before, ret = 0; 720 739 loff_t fto; 721 740 volatile char dummy; 741 + char eccbuf[6]; 722 742 struct DiskOnChip *this = mtd->priv; 723 743 void __iomem * docptr = this->virtadr; 724 744 struct Nand *mychip = &this->chips[to >> (this->chipshift)]; ··· 761 795 /* Disable the ECC engine */ 762 796 WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); 763 797 764 - if (eccbuf) { 765 - if (before) { 766 - /* Write the block status BLOCK_USED (0x5555) */ 767 - WriteDOC(0x55, docptr, Mil_CDSN_IO); 768 - WriteDOC(0x55, docptr, Mil_CDSN_IO); 769 - } 770 - 771 - /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 772 - WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, Mplus_ECCConf); 798 + if (before) { 799 + /* Write the block status BLOCK_USED (0x5555) */ 800 + WriteDOC(0x55, docptr, Mil_CDSN_IO); 801 + WriteDOC(0x55, docptr, Mil_CDSN_IO); 773 802 } 803 + 804 + /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ 805 + WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, Mplus_ECCConf); 774 806 775 807 MemWriteDOC(docptr, (unsigned char *) buf, len); 776 808 777 - if (eccbuf) { 778 - /* Write ECC data to flash, the ECC info is generated by 779 - the DiskOnChip ECC logic see Reed-Solomon EDC/ECC 11.1 */ 780 - DoC_Delay(docptr, 3); 809 + /* Write ECC data to flash, the ECC info is generated by 810 + the DiskOnChip ECC logic see Reed-Solomon EDC/ECC 11.1 */ 811 + DoC_Delay(docptr, 3); 781 812 782 - /* Read the ECC data through the DiskOnChip ECC logic */ 783 - for (i = 0; i < 6; i++) 784 - eccbuf[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); 813 + /* Read the ECC data through the DiskOnChip ECC logic */ 814 + for (i = 0; i < 6; i++) 815 + eccbuf[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); 785 816 786 - /* disable the ECC engine */ 787 - WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf); 817 + /* disable the ECC engine */ 818 + WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf); 788 819 789 - /* Write the ECC data to flash */ 790 - MemWriteDOC(docptr, eccbuf, 6); 820 + /* Write the ECC data to flash */ 821 + MemWriteDOC(docptr, eccbuf, 6); 791 822 792 - if (!before) { 793 - /* Write the block status BLOCK_USED (0x5555) */ 794 - WriteDOC(0x55, docptr, Mil_CDSN_IO+6); 795 - WriteDOC(0x55, docptr, Mil_CDSN_IO+7); 796 - } 823 + if (!before) { 824 + /* Write the block status BLOCK_USED (0x5555) */ 825 + WriteDOC(0x55, docptr, Mil_CDSN_IO+6); 826 + WriteDOC(0x55, docptr, Mil_CDSN_IO+7); 827 + } 797 828 798 829 #ifdef PSYCHO_DEBUG 799 - printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 800 - (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 801 - eccbuf[4], eccbuf[5]); 830 + printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", 831 + (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], 832 + eccbuf[4], eccbuf[5]); 802 833 #endif 803 - } 804 834 805 835 WriteDOC(0x00, docptr, Mplus_WritePipeTerm); 806 836 WriteDOC(0x00, docptr, Mplus_WritePipeTerm);
+8 -8
drivers/mtd/nand/nand_base.c
··· 155 155 /** 156 156 * nand_select_chip - [DEFAULT] control CE line 157 157 * @mtd: MTD device structure 158 - * @chip: chipnumber to select, -1 for deselect 158 + * @chipnr: chipnumber to select, -1 for deselect 159 159 * 160 160 * Default select function for 1 chip devices. 161 161 */ ··· 542 542 * Send command to NAND device. This is the version for the new large page 543 543 * devices We dont have the separate regions as we have in the small page 544 544 * devices. We must emulate NAND_CMD_READOOB to keep the code compatible. 545 - * 546 545 */ 547 546 static void nand_command_lp(struct mtd_info *mtd, unsigned int command, 548 547 int column, int page_addr) ··· 655 656 656 657 /** 657 658 * nand_get_device - [GENERIC] Get chip for selected access 658 - * @this: the nand chip descriptor 659 + * @chip: the nand chip descriptor 659 660 * @mtd: MTD device structure 660 661 * @new_state: the state which is requested 661 662 * ··· 695 696 /** 696 697 * nand_wait - [DEFAULT] wait until the command is done 697 698 * @mtd: MTD device structure 698 - * @this: NAND chip structure 699 + * @chip: NAND chip structure 699 700 * 700 701 * Wait for command done. This applies to erase and program only 701 702 * Erase can take up to 400ms and program up to 20ms according to 702 703 * general NAND and SmartMedia specs 703 - * 704 - */ 704 + */ 705 705 static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) 706 706 { 707 707 ··· 894 896 /** 895 897 * nand_transfer_oob - [Internal] Transfer oob to client buffer 896 898 * @chip: nand chip structure 899 + * @oob: oob destination address 897 900 * @ops: oob ops structure 898 901 */ 899 902 static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob, ··· 945 946 * 946 947 * @mtd: MTD device structure 947 948 * @from: offset to read from 949 + * @ops: oob ops structure 948 950 * 949 951 * Internal function. Called with chip held. 950 952 */ ··· 1760 1760 /** 1761 1761 * nand_write_oob - [MTD Interface] NAND write data and/or out-of-band 1762 1762 * @mtd: MTD device structure 1763 - * @from: offset to read from 1763 + * @to: offset to write to 1764 1764 * @ops: oob operation description structure 1765 1765 */ 1766 1766 static int nand_write_oob(struct mtd_info *mtd, loff_t to, ··· 2055 2055 /** 2056 2056 * nand_block_isbad - [MTD Interface] Check if block at offset is bad 2057 2057 * @mtd: MTD device structure 2058 - * @ofs: offset relative to mtd start 2058 + * @offs: offset relative to mtd start 2059 2059 */ 2060 2060 static int nand_block_isbad(struct mtd_info *mtd, loff_t offs) 2061 2061 {
+1 -2
drivers/mtd/nand/nand_ecc.c
··· 65 65 }; 66 66 67 67 /** 68 - * nand_calculate_ecc - [NAND Interface] Calculate 3 byte ECC code 69 - * for 256 byte block 68 + * nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256-byte block 70 69 * @mtd: MTD block structure 71 70 * @dat: raw data 72 71 * @ecc_code: buffer for ECC
-7
drivers/mtd/nand/sharpsl.c
··· 237 237 } 238 238 } 239 239 240 - if (machine_is_husky() || machine_is_borzoi() || machine_is_akita()) { 241 - /* Need to use small eraseblock size for backward compatibility */ 242 - sharpsl_mtd->flags |= MTD_NO_VIRTBLOCKS; 243 - } 244 - 245 240 add_mtd_partitions(sharpsl_mtd, sharpsl_partition_info, nr_partitions); 246 241 247 242 /* Return happy */ ··· 250 255 */ 251 256 static void __exit sharpsl_nand_cleanup(void) 252 257 { 253 - struct nand_chip *this = (struct nand_chip *)&sharpsl_mtd[1]; 254 - 255 258 /* Release resources, unregister device */ 256 259 nand_release(sharpsl_mtd); 257 260
+1 -3
fs/jffs2/acl.c
··· 345 345 return rc; 346 346 } 347 347 348 - void jffs2_clear_acl(struct inode *inode) 348 + void jffs2_clear_acl(struct jffs2_inode_info *f) 349 349 { 350 - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 351 - 352 350 if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) { 353 351 posix_acl_release(f->i_acl_access); 354 352 f->i_acl_access = JFFS2_ACL_NOT_CACHED;
+2 -2
fs/jffs2/acl.h
··· 30 30 extern int jffs2_permission(struct inode *, int, struct nameidata *); 31 31 extern int jffs2_acl_chmod(struct inode *); 32 32 extern int jffs2_init_acl(struct inode *, struct inode *); 33 - extern void jffs2_clear_acl(struct inode *); 33 + extern void jffs2_clear_acl(struct jffs2_inode_info *); 34 34 35 35 extern struct xattr_handler jffs2_acl_access_xattr_handler; 36 36 extern struct xattr_handler jffs2_acl_default_xattr_handler; ··· 40 40 #define jffs2_permission NULL 41 41 #define jffs2_acl_chmod(inode) (0) 42 42 #define jffs2_init_acl(inode,dir) (0) 43 - #define jffs2_clear_acl(inode) 43 + #define jffs2_clear_acl(f) 44 44 45 45 #endif /* CONFIG_JFFS2_FS_POSIX_ACL */
+1 -1
fs/jffs2/malloc.c
··· 190 190 kmem_cache_free(tmp_dnode_info_slab, x); 191 191 } 192 192 193 - struct jffs2_raw_node_ref *jffs2_alloc_refblock(void) 193 + static struct jffs2_raw_node_ref *jffs2_alloc_refblock(void) 194 194 { 195 195 struct jffs2_raw_node_ref *ret; 196 196
-2
fs/jffs2/nodelist.h
··· 426 426 /* scan.c */ 427 427 int jffs2_scan_medium(struct jffs2_sb_info *c); 428 428 void jffs2_rotate_lists(struct jffs2_sb_info *c); 429 - int jffs2_fill_scan_buf(struct jffs2_sb_info *c, void *buf, 430 - uint32_t ofs, uint32_t len); 431 429 struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uint32_t ino); 432 430 int jffs2_scan_classify_jeb(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); 433 431 int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t size);
+1
fs/jffs2/readinode.c
··· 968 968 struct jffs2_full_dirent *fd, *fds; 969 969 int deleted; 970 970 971 + jffs2_clear_acl(f); 971 972 jffs2_xattr_delete_inode(c, f->inocache); 972 973 down(&f->sem); 973 974 deleted = f->inocache && !f->inocache->nlink;
+2 -2
fs/jffs2/scan.c
··· 274 274 return ret; 275 275 } 276 276 277 - int jffs2_fill_scan_buf (struct jffs2_sb_info *c, void *buf, 278 - uint32_t ofs, uint32_t len) 277 + static int jffs2_fill_scan_buf(struct jffs2_sb_info *c, void *buf, 278 + uint32_t ofs, uint32_t len) 279 279 { 280 280 int ret; 281 281 size_t retlen;
+22 -23
fs/jffs2/xattr.c
··· 50 50 * is used to write xdatum to medium. xd->version will be incremented. 51 51 * create_xattr_datum(c, xprefix, xname, xvalue, xsize) 52 52 * is used to create new xdatum and write to medium. 53 - * delete_xattr_datum(c, xd) 54 - * is used to delete a xdatum. It marks xd JFFS2_XFLAGS_DEAD, and allows 55 - * GC to reclaim those physical nodes. 53 + * unrefer_xattr_datum(c, xd) 54 + * is used to delete a xdatum. When nobody refers this xdatum, JFFS2_XFLAGS_DEAD 55 + * is set on xd->flags and chained xattr_dead_list or release it immediately. 56 + * In the first case, the garbage collector release it later. 56 57 * -------------------------------------------------- */ 57 58 static uint32_t xattr_datum_hashkey(int xprefix, const char *xname, const char *xvalue, int xsize) 58 59 { ··· 395 394 return xd; 396 395 } 397 396 398 - static void delete_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd) 397 + static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd) 399 398 { 400 399 /* must be called under down_write(xattr_sem) */ 401 - BUG_ON(atomic_read(&xd->refcnt)); 400 + if (atomic_dec_and_lock(&xd->refcnt, &c->erase_completion_lock)) { 401 + uint32_t xid = xd->xid, version = xd->version; 402 402 403 - unload_xattr_datum(c, xd); 404 - xd->flags |= JFFS2_XFLAGS_DEAD; 405 - spin_lock(&c->erase_completion_lock); 406 - if (xd->node == (void *)xd) { 407 - BUG_ON(!(xd->flags & JFFS2_XFLAGS_INVALID)); 408 - jffs2_free_xattr_datum(xd); 409 - } else { 410 - list_add(&xd->xindex, &c->xattr_dead_list); 403 + unload_xattr_datum(c, xd); 404 + xd->flags |= JFFS2_XFLAGS_DEAD; 405 + if (xd->node == (void *)xd) { 406 + BUG_ON(!(xd->flags & JFFS2_XFLAGS_INVALID)); 407 + jffs2_free_xattr_datum(xd); 408 + } else { 409 + list_add(&xd->xindex, &c->xattr_dead_list); 410 + } 411 + spin_unlock(&c->erase_completion_lock); 412 + 413 + dbg_xattr("xdatum(xid=%u, version=%u) was removed.\n", xid, version); 411 414 } 412 - spin_unlock(&c->erase_completion_lock); 413 - dbg_xattr("xdatum(xid=%u, version=%u) was removed.\n", xd->xid, xd->version); 414 415 } 415 416 416 417 /* -------- xref related functions ------------------ ··· 583 580 dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) was removed.\n", 584 581 ref->ino, ref->xid, ref->xseqno); 585 582 586 - if (atomic_dec_and_test(&xd->refcnt)) 587 - delete_xattr_datum(c, xd); 583 + unrefer_xattr_datum(c, xd); 588 584 } 589 585 590 586 void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) ··· 1121 1119 ref->next = c->xref_dead_list; 1122 1120 c->xref_dead_list = ref; 1123 1121 spin_unlock(&c->erase_completion_lock); 1124 - if (atomic_dec_and_test(&xd->refcnt)) 1125 - delete_xattr_datum(c, xd); 1122 + unrefer_xattr_datum(c, xd); 1126 1123 } else { 1127 1124 ref->ic = ic; 1128 1125 ref->xd = xd; ··· 1157 1156 down_write(&c->xattr_sem); 1158 1157 if (rc) { 1159 1158 JFFS2_WARNING("jffs2_reserve_space()=%d, request=%u\n", rc, request); 1160 - if (atomic_dec_and_test(&xd->refcnt)) 1161 - delete_xattr_datum(c, xd); 1159 + unrefer_xattr_datum(c, xd); 1162 1160 up_write(&c->xattr_sem); 1163 1161 return rc; 1164 1162 } ··· 1170 1170 ic->xref = ref; 1171 1171 } 1172 1172 rc = PTR_ERR(newref); 1173 - if (atomic_dec_and_test(&xd->refcnt)) 1174 - delete_xattr_datum(c, xd); 1173 + unrefer_xattr_datum(c, xd); 1175 1174 } else if (ref) { 1176 1175 delete_xattr_ref(c, ref); 1177 1176 }
+19 -16
include/linux/mtd/bbm.h
··· 19 19 20 20 /** 21 21 * struct nand_bbt_descr - bad block table descriptor 22 - * @param options options for this descriptor 23 - * @param pages the page(s) where we find the bbt, used with 22 + * @options: options for this descriptor 23 + * @pages: the page(s) where we find the bbt, used with 24 24 * option BBT_ABSPAGE when bbt is searched, 25 25 * then we store the found bbts pages here. 26 26 * Its an array and supports up to 8 chips now 27 - * @param offs offset of the pattern in the oob area of the page 28 - * @param veroffs offset of the bbt version counter in the oob are of the page 29 - * @param version version read from the bbt page during scan 30 - * @param len length of the pattern, if 0 no pattern check is performed 31 - * @param maxblocks maximum number of blocks to search for a bbt. This number of 32 - * blocks is reserved at the end of the device 27 + * @offs: offset of the pattern in the oob area of the page 28 + * @veroffs: offset of the bbt version counter in the oob area of the page 29 + * @version: version read from the bbt page during scan 30 + * @len: length of the pattern, if 0 no pattern check is performed 31 + * @maxblocks: maximum number of blocks to search for a bbt. This 32 + * number of blocks is reserved at the end of the device 33 33 * where the tables are written. 34 - * @param reserved_block_code if non-0, this pattern denotes a reserved 34 + * @reserved_block_code: if non-0, this pattern denotes a reserved 35 35 * (rather than bad) block in the stored bbt 36 - * @param pattern pattern to identify bad block table or factory marked 36 + * @pattern: pattern to identify bad block table or factory marked 37 37 * good / bad blocks, can be NULL, if len = 0 38 38 * 39 39 * Descriptor for the bad block table marker and the descriptor for the ··· 93 93 #define ONENAND_BADBLOCK_POS 0 94 94 95 95 /** 96 - * struct bbt_info - [GENERIC] Bad Block Table data structure 97 - * @param bbt_erase_shift [INTERN] number of address bits in a bbt entry 98 - * @param badblockpos [INTERN] position of the bad block marker in the oob area 99 - * @param bbt [INTERN] bad block table pointer 100 - * @param badblock_pattern [REPLACEABLE] bad block scan pattern used for initial bad block scan 101 - * @param priv [OPTIONAL] pointer to private bbm date 96 + * struct bbm_info - [GENERIC] Bad Block Table data structure 97 + * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 98 + * @badblockpos: [INTERN] position of the bad block marker in the oob area 99 + * @options: options for this descriptor 100 + * @bbt: [INTERN] bad block table pointer 101 + * @isbad_bbt: function to determine if a block is bad 102 + * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for 103 + * initial bad block scan 104 + * @priv: [OPTIONAL] pointer to private bbm date 102 105 */ 103 106 struct bbm_info { 104 107 int bbt_erase_shift;
+2 -2
include/linux/mtd/mtd.h
··· 77 77 * 78 78 * @len: number of bytes to write/read. When a data buffer is given 79 79 * (datbuf != NULL) this is the number of data bytes. When 80 - + no data buffer is available this is the number of oob bytes. 80 + * no data buffer is available this is the number of oob bytes. 81 81 * 82 82 * @retlen: number of bytes written/read. When a data buffer is given 83 83 * (datbuf != NULL) this is the number of data bytes. When 84 - + no data buffer is available this is the number of oob bytes. 84 + * no data buffer is available this is the number of oob bytes. 85 85 * 86 86 * @ooblen: number of oob bytes per page 87 87 * @ooboffs: offset of oob data in the oob area (only relevant when
+10 -6
include/linux/mtd/nand.h
··· 202 202 struct nand_chip; 203 203 204 204 /** 205 - * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices 205 + * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 206 206 * @lock: protection lock 207 207 * @active: the mtd device which holds the controller currently 208 208 * @wq: wait queue to sleep on if a NAND operation is in progress ··· 223 223 * @total: total number of ecc bytes per page 224 224 * @prepad: padding information for syndrome based ecc generators 225 225 * @postpad: padding information for syndrome based ecc generators 226 + * @layout: ECC layout control struct pointer 226 227 * @hwctl: function to control hardware ecc generator. Must only 227 228 * be provided if an hardware ECC is available 228 229 * @calculate: function for ecc calculation or readback from ecc hardware 229 230 * @correct: function for ecc correction, matching to ecc generator (sw/hw) 230 231 * @read_page: function to read a page according to the ecc generator requirements 231 232 * @write_page: function to write a page according to the ecc generator requirements 233 + * @read_oob: function to read chip OOB data 234 + * @write_oob: function to write chip OOB data 232 235 */ 233 236 struct nand_ecc_ctrl { 234 237 nand_ecc_modes_t mode; ··· 303 300 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip 304 301 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready 305 302 * @ecc: [BOARDSPECIFIC] ecc control ctructure 303 + * @buffers: buffer structure for read/write 304 + * @hwcontrol: platform-specific hardware control structure 305 + * @ops: oob operation operands 306 306 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 307 307 * @scan_bbt: [REPLACEABLE] function to scan bad block table 308 308 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 309 309 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress 310 310 * @state: [INTERN] the current state of the NAND device 311 + * @oob_poi: poison value buffer 311 312 * @page_shift: [INTERN] number of address bits in a page (column address bits) 312 313 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 313 314 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry ··· 407 400 408 401 /** 409 402 * struct nand_flash_dev - NAND Flash Device ID Structure 410 - * 411 403 * @name: Identify the device type 412 404 * @id: device ID code 413 405 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 ··· 525 519 526 520 /** 527 521 * struct platform_nand_chip - chip level device structure 528 - * 529 522 * @nr_chips: max. number of chips to scan for 530 - * @chip_offs: chip number offset 523 + * @chip_offset: chip number offset 531 524 * @nr_partitions: number of partitions pointed to by partitions (or zero) 532 525 * @partitions: mtd partition list 533 526 * @chip_delay: R/B delay value in us ··· 547 542 548 543 /** 549 544 * struct platform_nand_ctrl - controller level device structure 550 - * 551 545 * @hwcontrol: platform specific hardware control structure 552 546 * @dev_ready: platform specific function to read ready/busy pin 553 547 * @select_chip: platform specific chip select function 554 - * @priv_data: private data to transport driver specific settings 548 + * @priv: private data to transport driver specific settings 555 549 * 556 550 * All fields are optional and depend on the hardware driver requirements 557 551 */
+44 -33
include/linux/mtd/onenand.h
··· 23 23 /* Free resources held by the OneNAND device */ 24 24 extern void onenand_release(struct mtd_info *mtd); 25 25 26 - /** 26 + /* 27 27 * onenand_state_t - chip states 28 28 * Enumeration for OneNAND flash chip state 29 29 */ ··· 42 42 43 43 /** 44 44 * struct onenand_bufferram - OneNAND BufferRAM Data 45 - * @param block block address in BufferRAM 46 - * @param page page address in BufferRAM 47 - * @param valid valid flag 45 + * @block: block address in BufferRAM 46 + * @page: page address in BufferRAM 47 + * @valid: valid flag 48 48 */ 49 49 struct onenand_bufferram { 50 50 int block; ··· 54 54 55 55 /** 56 56 * struct onenand_chip - OneNAND Private Flash Chip Data 57 - * @param base [BOARDSPECIFIC] address to access OneNAND 58 - * @param chipsize [INTERN] the size of one chip for multichip arrays 59 - * @param device_id [INTERN] device ID 60 - * @param verstion_id [INTERN] version ID 61 - * @param options [BOARDSPECIFIC] various chip options. They can partly be set to inform onenand_scan about 62 - * @param erase_shift [INTERN] number of address bits in a block 63 - * @param page_shift [INTERN] number of address bits in a page 64 - * @param ppb_shift [INTERN] number of address bits in a pages per block 65 - * @param page_mask [INTERN] a page per block mask 66 - * @param bufferam_index [INTERN] BufferRAM index 67 - * @param bufferam [INTERN] BufferRAM info 68 - * @param readw [REPLACEABLE] hardware specific function for read short 69 - * @param writew [REPLACEABLE] hardware specific function for write short 70 - * @param command [REPLACEABLE] hardware specific function for writing commands to the chip 71 - * @param wait [REPLACEABLE] hardware specific function for wait on ready 72 - * @param read_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area 73 - * @param write_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area 74 - * @param read_word [REPLACEABLE] hardware specific function for read register of OneNAND 75 - * @param write_word [REPLACEABLE] hardware specific function for write register of OneNAND 76 - * @param scan_bbt [REPLACEALBE] hardware specific function for scaning Bad block Table 77 - * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip 78 - * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress 79 - * @param state [INTERN] the current state of the OneNAND device 80 - * @param ecclayout [REPLACEABLE] the default ecc placement scheme 81 - * @param bbm [REPLACEABLE] pointer to Bad Block Management 82 - * @param priv [OPTIONAL] pointer to private chip date 57 + * @base: [BOARDSPECIFIC] address to access OneNAND 58 + * @chipsize: [INTERN] the size of one chip for multichip arrays 59 + * @device_id: [INTERN] device ID 60 + * @density_mask: chip density, used for DDP devices 61 + * @verstion_id: [INTERN] version ID 62 + * @options: [BOARDSPECIFIC] various chip options. They can 63 + * partly be set to inform onenand_scan about 64 + * @erase_shift: [INTERN] number of address bits in a block 65 + * @page_shift: [INTERN] number of address bits in a page 66 + * @ppb_shift: [INTERN] number of address bits in a pages per block 67 + * @page_mask: [INTERN] a page per block mask 68 + * @bufferram_index: [INTERN] BufferRAM index 69 + * @bufferram: [INTERN] BufferRAM info 70 + * @readw: [REPLACEABLE] hardware specific function for read short 71 + * @writew: [REPLACEABLE] hardware specific function for write short 72 + * @command: [REPLACEABLE] hardware specific function for writing 73 + * commands to the chip 74 + * @wait: [REPLACEABLE] hardware specific function for wait on ready 75 + * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 76 + * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 77 + * @read_word: [REPLACEABLE] hardware specific function for read 78 + * register of OneNAND 79 + * @write_word: [REPLACEABLE] hardware specific function for write 80 + * register of OneNAND 81 + * @mmcontrol: sync burst read function 82 + * @block_markbad: function to mark a block as bad 83 + * @scan_bbt: [REPLACEALBE] hardware specific function for scanning 84 + * Bad block Table 85 + * @chip_lock: [INTERN] spinlock used to protect access to this 86 + * structure and the chip 87 + * @wq: [INTERN] wait queue to sleep on if a OneNAND 88 + * operation is in progress 89 + * @state: [INTERN] the current state of the OneNAND device 90 + * @page_buf: data buffer 91 + * @ecclayout: [REPLACEABLE] the default ecc placement scheme 92 + * @bbm: [REPLACEABLE] pointer to Bad Block Management 93 + * @priv: [OPTIONAL] pointer to private chip date 83 94 */ 84 95 struct onenand_chip { 85 96 void __iomem *base; ··· 158 147 #define ONENAND_MFR_SAMSUNG 0xec 159 148 160 149 /** 161 - * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 162 - * @param name: Manufacturer name 163 - * @param id: manufacturer ID code of device. 150 + * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure 151 + * @name: Manufacturer name 152 + * @id: manufacturer ID code of device. 164 153 */ 165 154 struct onenand_manufacturers { 166 155 int id;
+1 -1
include/mtd/mtd-abi.h
··· 133 133 }; 134 134 135 135 /** 136 - * struct mtd_ecc_stats - error correction status 136 + * struct mtd_ecc_stats - error correction stats 137 137 * 138 138 * @corrected: number of corrected bits 139 139 * @failed: number of uncorrectable errors