diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-08-27 11:52:02 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-09-28 16:59:48 +0300 |
commit | 53576c7bfc3589fc7cd58cc952168db0449886a7 (patch) | |
tree | ac40227c3cb2678579f7788fdea63fe1bf886b2c /drivers/mtd/nand/raw/tegra_nand.c | |
parent | 3316c8e3ad1fcaeefd4ffa93587dd78fb24e8afa (diff) | |
download | linux-53576c7bfc3589fc7cd58cc952168db0449886a7.tar.xz |
mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant
Instead of accessing ->strength/step_size directly.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-15-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd/nand/raw/tegra_nand.c')
-rw-r--r-- | drivers/mtd/nand/raw/tegra_nand.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index cc72a2de8891..100c18ef8fe8 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -840,6 +840,8 @@ static int tegra_nand_get_strength(struct nand_chip *chip, const int *strength, int strength_len, int bits_per_step, int oobsize) { + const struct nand_ecc_props *requirements = + nanddev_get_ecc_requirements(&chip->base); bool maximize = chip->ecc.options & NAND_ECC_MAXIMIZE; int i; @@ -855,7 +857,7 @@ static int tegra_nand_get_strength(struct nand_chip *chip, const int *strength, } else { strength_sel = strength[i]; - if (strength_sel < chip->base.eccreq.strength) + if (strength_sel < requirements->strength) continue; } @@ -908,6 +910,8 @@ static int tegra_nand_select_strength(struct nand_chip *chip, int oobsize) static int tegra_nand_attach_chip(struct nand_chip *chip) { struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller); + const struct nand_ecc_props *requirements = + nanddev_get_ecc_requirements(&chip->base); struct tegra_nand_chip *nand = to_tegra_chip(chip); struct mtd_info *mtd = nand_to_mtd(chip); int bits_per_step; @@ -919,9 +923,9 @@ static int tegra_nand_attach_chip(struct nand_chip *chip) chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; chip->ecc.size = 512; chip->ecc.steps = mtd->writesize / chip->ecc.size; - if (chip->base.eccreq.step_size != 512) { + if (requirements->step_size != 512) { dev_err(ctrl->dev, "Unsupported step size %d\n", - chip->base.eccreq.step_size); + requirements->step_size); return -EINVAL; } @@ -952,7 +956,7 @@ static int tegra_nand_attach_chip(struct nand_chip *chip) if (ret < 0) { dev_err(ctrl->dev, "No valid strength found, minimum %d\n", - chip->base.eccreq.strength); + requirements->strength); return ret; } |