tree-wide: fix assorted typos all over the place
[safe/jmp/linux-2.6] / drivers / mtd / nand / nand_ecc.c
index 868147a..92320a6 100644 (file)
@@ -417,22 +417,22 @@ int nand_calculate_ecc(struct mtd_info *mtd, const unsigned char *buf,
 EXPORT_SYMBOL(nand_calculate_ecc);
 
 /**
- * nand_correct_data - [NAND Interface] Detect and correct bit error(s)
- * @mtd:       MTD block structure
+ * __nand_correct_data - [NAND Interface] Detect and correct bit error(s)
  * @buf:       raw data read from the chip
  * @read_ecc:  ECC from the chip
  * @calc_ecc:  the ECC calculated from raw data
+ * @eccsize:   data bytes per ecc step (256 or 512)
  *
- * Detect and correct a 1 bit error for 256/512 byte block
+ * Detect and correct a 1 bit error for eccsize byte block
  */
-int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
-                     unsigned char *read_ecc, unsigned char *calc_ecc)
+int __nand_correct_data(unsigned char *buf,
+                       unsigned char *read_ecc, unsigned char *calc_ecc,
+                       unsigned int eccsize)
 {
-       unsigned char b0, b1, b2;
-       unsigned char byte_addr, bit_addr;
+       unsigned char b0, b1, b2, bit_addr;
+       unsigned int byte_addr;
        /* 256 or 512 bytes/ecc  */
-       const uint32_t eccsize_mult =
-                       (((struct nand_chip *)mtd->priv)->ecc.size) >> 8;
+       const uint32_t eccsize_mult = eccsize >> 8;
 
        /*
         * b0 to b2 indicate which bit is faulty (if any)
@@ -475,7 +475,7 @@ int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
                 *
                 * The b2 shift is there to get rid of the lowest two bits.
                 * We could also do addressbits[b2] >> 1 but for the
-                * performace it does not make any difference
+                * performance it does not make any difference
                 */
                if (eccsize_mult == 1)
                        byte_addr = (addressbits[b1] << 4) + addressbits[b0];
@@ -495,6 +495,23 @@ int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
        printk(KERN_ERR "uncorrectable error : ");
        return -1;
 }
+EXPORT_SYMBOL(__nand_correct_data);
+
+/**
+ * nand_correct_data - [NAND Interface] Detect and correct bit error(s)
+ * @mtd:       MTD block structure
+ * @buf:       raw data read from the chip
+ * @read_ecc:  ECC from the chip
+ * @calc_ecc:  the ECC calculated from raw data
+ *
+ * Detect and correct a 1 bit error for 256/512 byte block
+ */
+int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
+                     unsigned char *read_ecc, unsigned char *calc_ecc)
+{
+       return __nand_correct_data(buf, read_ecc, calc_ecc,
+                                  ((struct nand_chip *)mtd->priv)->ecc.size);
+}
 EXPORT_SYMBOL(nand_correct_data);
 
 MODULE_LICENSE("GPL");