Fix a common error in nand-drivers which do not set up a parent device for
the mtd-device by using a new inline function.

Signed-off-by: Alexander Holler <hol...@ahsoftware.de>
---
 drivers/mtd/nand/ndfc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 69eaba6..66366e0 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -170,9 +170,6 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
        chip->ecc.strength = 1;
        chip->priv = ndfc;
 
-       ndfc->mtd.priv = chip;
-       ndfc->mtd.owner = THIS_MODULE;
-
        flash_np = of_get_next_child(node, NULL);
        if (!flash_np)
                return -ENODEV;
@@ -248,6 +245,7 @@ static int ndfc_probe(struct platform_device *ofdev)
                out_be32(ndfc->ndfcbase + offset, be32_to_cpup(reg));
        }
 
+       mtd_setup_common_members(&ndfc->mtd, &ndfc->chip, ofdev);
        err = ndfc_chip_init(ndfc, ofdev->dev.of_node);
        if (err) {
                iounmap(ndfc->ndfcbase);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to