Lines Matching refs:nbc
40 struct nand_bch_control *nbc = chip->ecc.priv; in nand_bch_calculate_ecc() local
44 bch_encode(nbc->bch, buf, chip->ecc.size, code); in nand_bch_calculate_ecc()
48 code[i] ^= nbc->eccmask[i]; in nand_bch_calculate_ecc()
66 struct nand_bch_control *nbc = chip->ecc.priv; in nand_bch_correct_data() local
67 unsigned int *errloc = nbc->errloc; in nand_bch_correct_data()
70 count = bch_decode(nbc->bch, NULL, chip->ecc.size, read_ecc, calc_ecc, in nand_bch_correct_data()
110 struct nand_bch_control *nbc = NULL; in nand_bch_init() local
129 nbc = kzalloc(sizeof(*nbc), GFP_KERNEL); in nand_bch_init()
130 if (!nbc) in nand_bch_init()
133 nbc->bch = bch_init(m, t, 0, false); in nand_bch_init()
134 if (!nbc->bch) in nand_bch_init()
138 if (nbc->bch->ecc_bytes != eccbytes) { in nand_bch_init()
140 eccbytes, nbc->bch->ecc_bytes); in nand_bch_init()
174 nbc->eccmask = kzalloc(eccbytes, GFP_KERNEL); in nand_bch_init()
175 nbc->errloc = kmalloc_array(t, sizeof(*nbc->errloc), GFP_KERNEL); in nand_bch_init()
176 if (!nbc->eccmask || !nbc->errloc) in nand_bch_init()
186 bch_encode(nbc->bch, erased_page, eccsize, nbc->eccmask); in nand_bch_init()
190 nbc->eccmask[i] ^= 0xff; in nand_bch_init()
195 return nbc; in nand_bch_init()
197 nand_bch_free(nbc); in nand_bch_init()
206 void nand_bch_free(struct nand_bch_control *nbc) in nand_bch_free() argument
208 if (nbc) { in nand_bch_free()
209 bch_free(nbc->bch); in nand_bch_free()
210 kfree(nbc->errloc); in nand_bch_free()
211 kfree(nbc->eccmask); in nand_bch_free()
212 kfree(nbc); in nand_bch_free()