summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bch.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-10-29 15:26:37 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-06 14:08:10 +0100
commit5f605dc6168c2508e44ce81c7b169095849488ea (patch)
tree58339e4c36848213e0998b9903d676f7c4887d60 /drivers/mtd/nand/nand_bch.c
parent068d7560c79f79674faf0267a319e4dc9b9bce8f (diff)
downloadbarebox-5f605dc6168c2508e44ce81c7b169095849488ea.tar.gz
barebox-5f605dc6168c2508e44ce81c7b169095849488ea.tar.xz
mtd: nand: Pass struct nand_chip around
Traditionally Linux passed a struct mtd_info * around as context between the different functions. This has been changed to a struct nand_chip *. Do the same for barebox as well as another step towards updating the NAND layer to current Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/nand/nand_bch.c')
-rw-r--r--drivers/mtd/nand/nand_bch.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c
index b94ecdf8d9..42ffa1b21a 100644
--- a/drivers/mtd/nand/nand_bch.c
+++ b/drivers/mtd/nand/nand_bch.c
@@ -46,10 +46,9 @@ struct nand_bch_control {
* @buf: input buffer with raw data
* @code: output buffer with ECC
*/
-int nand_bch_calculate_ecc(struct mtd_info *mtd, const unsigned char *buf,
+int nand_bch_calculate_ecc(struct nand_chip *chip, const unsigned char *buf,
unsigned char *code)
{
- const struct nand_chip *chip = mtd_to_nand(mtd);
struct nand_bch_control *nbc = chip->ecc.priv;
unsigned int i;
@@ -73,10 +72,9 @@ EXPORT_SYMBOL(nand_bch_calculate_ecc);
*
* Detect and correct bit errors for a data byte block
*/
-int nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
+int nand_bch_correct_data(struct nand_chip *chip, unsigned char *buf,
unsigned char *read_ecc, unsigned char *calc_ecc)
{
- const struct nand_chip *chip = mtd_to_nand(mtd);
struct nand_bch_control *nbc = chip->ecc.priv;
unsigned int *errloc = nbc->errloc;
int i, count;
@@ -117,9 +115,9 @@ EXPORT_SYMBOL(nand_bch_correct_data);
* @eccsize = 512 (thus, m=13 is the smallest integer such that 2^m-1 > 512*8)
* @eccbytes = 7 (7 bytes are required to store m*t = 13*4 = 52 bits)
*/
-struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
+struct nand_bch_control *nand_bch_init(struct nand_chip *nand)
{
- struct nand_chip *nand = mtd_to_nand(mtd);
+ struct mtd_info *mtd = nand_to_mtd(nand);
unsigned int m, t, eccsteps, i;
struct nand_ecclayout *layout = nand->ecc.layout;
struct nand_bch_control *nbc = NULL;