Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.4-rc6 66 lines 1.5 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com> 4 * 5 * This file is the header for the NAND BCH ECC implementation. 6 */ 7 8#ifndef __MTD_NAND_BCH_H__ 9#define __MTD_NAND_BCH_H__ 10 11struct mtd_info; 12struct nand_chip; 13struct nand_bch_control; 14 15#if IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH) 16 17static inline int mtd_nand_has_bch(void) { return 1; } 18 19/* 20 * Calculate BCH ecc code 21 */ 22int nand_bch_calculate_ecc(struct nand_chip *chip, const u_char *dat, 23 u_char *ecc_code); 24 25/* 26 * Detect and correct bit errors 27 */ 28int nand_bch_correct_data(struct nand_chip *chip, u_char *dat, 29 u_char *read_ecc, u_char *calc_ecc); 30/* 31 * Initialize BCH encoder/decoder 32 */ 33struct nand_bch_control *nand_bch_init(struct mtd_info *mtd); 34/* 35 * Release BCH encoder/decoder resources 36 */ 37void nand_bch_free(struct nand_bch_control *nbc); 38 39#else /* !CONFIG_MTD_NAND_ECC_SW_BCH */ 40 41static inline int mtd_nand_has_bch(void) { return 0; } 42 43static inline int 44nand_bch_calculate_ecc(struct nand_chip *chip, const u_char *dat, 45 u_char *ecc_code) 46{ 47 return -1; 48} 49 50static inline int 51nand_bch_correct_data(struct nand_chip *chip, unsigned char *buf, 52 unsigned char *read_ecc, unsigned char *calc_ecc) 53{ 54 return -ENOTSUPP; 55} 56 57static inline struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) 58{ 59 return NULL; 60} 61 62static inline void nand_bch_free(struct nand_bch_control *nbc) {} 63 64#endif /* CONFIG_MTD_NAND_ECC_SW_BCH */ 65 66#endif /* __MTD_NAND_BCH_H__ */