mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant
[linux-2.6-microblaze.git] / drivers / mtd / nand / raw / sunxi_nand.c
index c78276d..b7b764e 100644 (file)
@@ -1732,6 +1732,8 @@ static void sunxi_nand_ecc_cleanup(struct nand_ecc_ctrl *ecc)
 
 static int sunxi_nand_attach_chip(struct nand_chip *nand)
 {
+       const struct nand_ecc_props *requirements =
+               nanddev_get_ecc_requirements(&nand->base);
        struct nand_ecc_ctrl *ecc = &nand->ecc;
        struct device_node *np = nand_get_flash_node(nand);
        int ret;
@@ -1745,8 +1747,8 @@ static int sunxi_nand_attach_chip(struct nand_chip *nand)
        nand->options |= NAND_SUBPAGE_READ;
 
        if (!ecc->size) {
-               ecc->size = nand->base.eccreq.step_size;
-               ecc->strength = nand->base.eccreq.strength;
+               ecc->size = requirements->step_size;
+               ecc->strength = requirements->strength;
        }
 
        if (!ecc->size || !ecc->strength)