tree-wide: fix assorted typos all over the place
[safe/jmp/linux-2.6] / drivers / mtd / nand / diskonchip.c
index 82262a4..b126cf8 100644 (file)
@@ -15,8 +15,6 @@
  * converted to the generic Reed-Solomon library by Thomas Gleixner <tglx@linutronix.de>
  *
  * Interface to generic NAND code for M-Systems DiskOnChip devices
- *
- * $Id: diskonchip.c,v 1.55 2005/11/07 11:14:30 gleixner Exp $
  */
 
 #include <linux/kernel.h>
@@ -54,13 +52,6 @@ static unsigned long __initdata doc_locations[] = {
        0xe0000, 0xe2000, 0xe4000, 0xe6000,
        0xe8000, 0xea000, 0xec000, 0xee000,
 #endif /*  CONFIG_MTD_DOCPROBE_HIGH */
-#elif defined(__PPC__)
-       0xe4000000,
-#elif defined(CONFIG_MOMENCO_OCELOT)
-       0x2f000000,
-       0xff000000,
-#elif defined(CONFIG_MOMENCO_OCELOT_G) || defined (CONFIG_MOMENCO_OCELOT_C)
-       0xff000000,
 #else
 #warning Unknown architecture for DiskOnChip. No default probe locations defined
 #endif
@@ -114,7 +105,7 @@ module_param(no_autopart, int, 0);
 static int show_firmware_partition = 0;
 module_param(show_firmware_partition, int, 0);
 
-#ifdef MTD_NAND_DISKONCHIP_BBTWRITE
+#ifdef CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE
 static int inftl_bbt_write = 1;
 #else
 static int inftl_bbt_write = 0;
@@ -225,7 +216,7 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc)
                }
        }
        /* If the parity is wrong, no rescue possible */
-       return parity ? -1 : nerr;
+       return parity ? -EBADMSG : nerr;
 }
 
 static void DoC_Delay(struct doc_priv *doc, unsigned short cycles)
@@ -464,7 +455,7 @@ static void __init doc2000_count_chips(struct mtd_info *mtd)
        printk(KERN_DEBUG "Detected %d chips per floor.\n", i);
 }
 
-static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
+static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this)
 {
        struct doc_priv *doc = this->priv;
 
@@ -1039,7 +1030,7 @@ static int doc200x_correct_data(struct mtd_info *mtd, u_char *dat,
                WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf);
        else
                WriteDOC(DOC_ECC_DIS, docptr, ECCConf);
-       if (no_ecc_failures && (ret == -1)) {
+       if (no_ecc_failures && (ret == -EBADMSG)) {
                printk(KERN_ERR "suppressing ECC failure\n");
                ret = 0;
        }
@@ -1058,15 +1049,14 @@ static int doc200x_correct_data(struct mtd_info *mtd, u_char *dat,
  * safer.  The only problem with it is that any code that parses oobfree must
  * be able to handle out-of-order segments.
  */
-static struct nand_oobinfo doc200x_oobinfo = {
-       .useecc = MTD_NANDECC_AUTOPLACE,
+static struct nand_ecclayout doc200x_oobinfo = {
        .eccbytes = 6,
        .eccpos = {0, 1, 2, 3, 4, 5},
        .oobfree = {{8, 8}, {6, 2}}
 };
 
 /* Find the (I)NFTL Media Header, and optionally also the mirror media header.
-   On sucessful return, buf will contain a copy of the media header for
+   On successful return, buf will contain a copy of the media header for
    further processing.  id is the string to scan for, and will presumably be
    either "ANAND" or "BNAND".  If findmirror=1, also look for the mirror media
    header.  The page #s of the found media headers are placed in mh0_page and
@@ -1135,9 +1125,9 @@ static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partitio
                goto out;
        mh = (struct NFTLMediaHeader *)buf;
 
-       mh->NumEraseUnits = le16_to_cpu(mh->NumEraseUnits);
-       mh->FirstPhysicalEUN = le16_to_cpu(mh->FirstPhysicalEUN);
-       mh->FormattedSize = le32_to_cpu(mh->FormattedSize);
+       le16_to_cpus(&mh->NumEraseUnits);
+       le16_to_cpus(&mh->FirstPhysicalEUN);
+       le32_to_cpus(&mh->FormattedSize);
 
        printk(KERN_INFO "    DataOrgID        = %s\n"
                         "    NumEraseUnits    = %d\n"
@@ -1245,12 +1235,12 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
        doc->mh1_page = doc->mh0_page + (4096 >> this->page_shift);
        mh = (struct INFTLMediaHeader *)buf;
 
-       mh->NoOfBootImageBlocks = le32_to_cpu(mh->NoOfBootImageBlocks);
-       mh->NoOfBinaryPartitions = le32_to_cpu(mh->NoOfBinaryPartitions);
-       mh->NoOfBDTLPartitions = le32_to_cpu(mh->NoOfBDTLPartitions);
-       mh->BlockMultiplierBits = le32_to_cpu(mh->BlockMultiplierBits);
-       mh->FormatFlags = le32_to_cpu(mh->FormatFlags);
-       mh->PercentUsed = le32_to_cpu(mh->PercentUsed);
+       le32_to_cpus(&mh->NoOfBootImageBlocks);
+       le32_to_cpus(&mh->NoOfBinaryPartitions);
+       le32_to_cpus(&mh->NoOfBDTLPartitions);
+       le32_to_cpus(&mh->BlockMultiplierBits);
+       le32_to_cpus(&mh->FormatFlags);
+       le32_to_cpus(&mh->PercentUsed);
 
        printk(KERN_INFO "    bootRecordID          = %s\n"
                         "    NoOfBootImageBlocks   = %d\n"
@@ -1287,12 +1277,12 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
        /* Scan the partitions */
        for (i = 0; (i < 4); i++) {
                ip = &(mh->Partitions[i]);
-               ip->virtualUnits = le32_to_cpu(ip->virtualUnits);
-               ip->firstUnit = le32_to_cpu(ip->firstUnit);
-               ip->lastUnit = le32_to_cpu(ip->lastUnit);
-               ip->flags = le32_to_cpu(ip->flags);
-               ip->spareUnits = le32_to_cpu(ip->spareUnits);
-               ip->Reserved0 = le32_to_cpu(ip->Reserved0);
+               le32_to_cpus(&ip->virtualUnits);
+               le32_to_cpus(&ip->firstUnit);
+               le32_to_cpus(&ip->lastUnit);
+               le32_to_cpus(&ip->flags);
+               le32_to_cpus(&ip->spareUnits);
+               le32_to_cpus(&ip->Reserved0);
 
                printk(KERN_INFO        "    PARTITION[%d] ->\n"
                        "        virtualUnits    = %d\n"
@@ -1636,13 +1626,12 @@ static int __init doc_probe(unsigned long physadr)
 
        len = sizeof(struct mtd_info) +
            sizeof(struct nand_chip) + sizeof(struct doc_priv) + (2 * sizeof(struct nand_bbt_descr));
-       mtd = kmalloc(len, GFP_KERNEL);
+       mtd = kzalloc(len, GFP_KERNEL);
        if (!mtd) {
                printk(KERN_ERR "DiskOnChip kmalloc (%d bytes) failed!\n", len);
                ret = -ENOMEM;
                goto fail;
        }
-       memset(mtd, 0, len);
 
        nand                    = (struct nand_chip *) (mtd + 1);
        doc                     = (struct doc_priv *) (nand + 1);
@@ -1662,7 +1651,7 @@ static int __init doc_probe(unsigned long physadr)
        nand->ecc.calculate     = doc200x_calculate_ecc;
        nand->ecc.correct       = doc200x_correct_data;
 
-       nand->autooob           = &doc200x_oobinfo;
+       nand->ecc.layout        = &doc200x_oobinfo;
        nand->ecc.mode          = NAND_ECC_HW_SYNDROME;
        nand->ecc.size          = 512;
        nand->ecc.bytes         = 6;
@@ -1784,4 +1773,4 @@ module_exit(cleanup_nanddoc);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
-MODULE_DESCRIPTION("M-Systems DiskOnChip 2000, Millennium and Millennium Plus device driver\n");
+MODULE_DESCRIPTION("M-Systems DiskOnChip 2000, Millennium and Millennium Plus device driver");