x86/topology: Fix function name in documentation
[cris-mirror.git] / include / linux / mtd / nand_bch.h
blob98f20ef05d60723ad10e6e552a506b3a783b4fba
1 /*
2 * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This file is the header for the NAND BCH ECC implementation.
9 */
11 #ifndef __MTD_NAND_BCH_H__
12 #define __MTD_NAND_BCH_H__
14 struct mtd_info;
15 struct nand_bch_control;
17 #if defined(CONFIG_MTD_NAND_ECC_BCH)
19 static inline int mtd_nand_has_bch(void) { return 1; }
22 * Calculate BCH ecc code
24 int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
25 u_char *ecc_code);
28 * Detect and correct bit errors
30 int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,
31 u_char *calc_ecc);
33 * Initialize BCH encoder/decoder
35 struct nand_bch_control *nand_bch_init(struct mtd_info *mtd);
37 * Release BCH encoder/decoder resources
39 void nand_bch_free(struct nand_bch_control *nbc);
41 #else /* !CONFIG_MTD_NAND_ECC_BCH */
43 static inline int mtd_nand_has_bch(void) { return 0; }
45 static inline int
46 nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
47 u_char *ecc_code)
49 return -1;
52 static inline int
53 nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
54 unsigned char *read_ecc, unsigned char *calc_ecc)
56 return -ENOTSUPP;
59 static inline struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
61 return NULL;
64 static inline void nand_bch_free(struct nand_bch_control *nbc) {}
66 #endif /* CONFIG_MTD_NAND_ECC_BCH */
68 #endif /* __MTD_NAND_BCH_H__ */