Commit b75e17b0 authored by Miquel Raynal's avatar Miquel Raynal

mtd: rawnand: davinci: Do not use extra dereferencing

When the nand_chip structure is already available, there is no need to
dereference it through the info pointer. Use the chip pointer directly
in this case.
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20201113124045.32743-1-miquel.raynal@bootlin.com
parent d59df005
...@@ -586,10 +586,10 @@ static int davinci_nand_attach_chip(struct nand_chip *chip) ...@@ -586,10 +586,10 @@ static int davinci_nand_attach_chip(struct nand_chip *chip)
return PTR_ERR(pdata); return PTR_ERR(pdata);
/* Use board-specific ECC config */ /* Use board-specific ECC config */
info->chip.ecc.engine_type = pdata->engine_type; chip->ecc.engine_type = pdata->engine_type;
info->chip.ecc.placement = pdata->ecc_placement; chip->ecc.placement = pdata->ecc_placement;
switch (info->chip.ecc.engine_type) { switch (chip->ecc.engine_type) {
case NAND_ECC_ENGINE_TYPE_NONE: case NAND_ECC_ENGINE_TYPE_NONE:
pdata->ecc_bits = 0; pdata->ecc_bits = 0;
break; break;
...@@ -601,7 +601,7 @@ static int davinci_nand_attach_chip(struct nand_chip *chip) ...@@ -601,7 +601,7 @@ static int davinci_nand_attach_chip(struct nand_chip *chip)
* NAND_ECC_ALGO_HAMMING to avoid adding an extra ->ecc_algo * NAND_ECC_ALGO_HAMMING to avoid adding an extra ->ecc_algo
* field to davinci_nand_pdata. * field to davinci_nand_pdata.
*/ */
info->chip.ecc.algo = NAND_ECC_ALGO_HAMMING; chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
break; break;
case NAND_ECC_ENGINE_TYPE_ON_HOST: case NAND_ECC_ENGINE_TYPE_ON_HOST:
if (pdata->ecc_bits == 4) { if (pdata->ecc_bits == 4) {
...@@ -628,12 +628,12 @@ static int davinci_nand_attach_chip(struct nand_chip *chip) ...@@ -628,12 +628,12 @@ static int davinci_nand_attach_chip(struct nand_chip *chip)
if (ret == -EBUSY) if (ret == -EBUSY)
return ret; return ret;
info->chip.ecc.calculate = nand_davinci_calculate_4bit; chip->ecc.calculate = nand_davinci_calculate_4bit;
info->chip.ecc.correct = nand_davinci_correct_4bit; chip->ecc.correct = nand_davinci_correct_4bit;
info->chip.ecc.hwctl = nand_davinci_hwctl_4bit; chip->ecc.hwctl = nand_davinci_hwctl_4bit;
info->chip.ecc.bytes = 10; chip->ecc.bytes = 10;
info->chip.ecc.options = NAND_ECC_GENERIC_ERASED_CHECK; chip->ecc.options = NAND_ECC_GENERIC_ERASED_CHECK;
info->chip.ecc.algo = NAND_ECC_ALGO_BCH; chip->ecc.algo = NAND_ECC_ALGO_BCH;
/* /*
* Update ECC layout if needed ... for 1-bit HW ECC, the * Update ECC layout if needed ... for 1-bit HW ECC, the
...@@ -651,20 +651,20 @@ static int davinci_nand_attach_chip(struct nand_chip *chip) ...@@ -651,20 +651,20 @@ static int davinci_nand_attach_chip(struct nand_chip *chip)
} else if (chunks == 4 || chunks == 8) { } else if (chunks == 4 || chunks == 8) {
mtd_set_ooblayout(mtd, mtd_set_ooblayout(mtd,
nand_get_large_page_ooblayout()); nand_get_large_page_ooblayout());
info->chip.ecc.read_page = nand_davinci_read_page_hwecc_oob_first; chip->ecc.read_page = nand_davinci_read_page_hwecc_oob_first;
} else { } else {
return -EIO; return -EIO;
} }
} else { } else {
/* 1bit ecc hamming */ /* 1bit ecc hamming */
info->chip.ecc.calculate = nand_davinci_calculate_1bit; chip->ecc.calculate = nand_davinci_calculate_1bit;
info->chip.ecc.correct = nand_davinci_correct_1bit; chip->ecc.correct = nand_davinci_correct_1bit;
info->chip.ecc.hwctl = nand_davinci_hwctl_1bit; chip->ecc.hwctl = nand_davinci_hwctl_1bit;
info->chip.ecc.bytes = 3; chip->ecc.bytes = 3;
info->chip.ecc.algo = NAND_ECC_ALGO_HAMMING; chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
} }
info->chip.ecc.size = 512; chip->ecc.size = 512;
info->chip.ecc.strength = pdata->ecc_bits; chip->ecc.strength = pdata->ecc_bits;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -899,7 +899,7 @@ static int nand_davinci_remove(struct platform_device *pdev) ...@@ -899,7 +899,7 @@ static int nand_davinci_remove(struct platform_device *pdev)
int ret; int ret;
spin_lock_irq(&davinci_nand_lock); spin_lock_irq(&davinci_nand_lock);
if (info->chip.ecc.placement == NAND_ECC_PLACEMENT_INTERLEAVED) if (chip->ecc.placement == NAND_ECC_PLACEMENT_INTERLEAVED)
ecc4_busy = false; ecc4_busy = false;
spin_unlock_irq(&davinci_nand_lock); spin_unlock_irq(&davinci_nand_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment