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>
---
 Changes to v1: add owner to module
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c 
b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index bb77f75..8ca225c 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1682,11 +1682,6 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
        /* init current chip */
        this->current_chip      = -1;
 
-       /* init the MTD data structures */
-       mtd->priv               = chip;
-       mtd->name               = "gpmi-nand";
-       mtd->owner              = THIS_MODULE;
-
        /* init the nand_chip{}, we don't support a 16-bit NAND Flash bus. */
        chip->priv              = this;
        chip->select_chip       = gpmi_select_chip;
@@ -1791,6 +1786,7 @@ static int gpmi_nand_probe(struct platform_device *pdev)
        if (ret)
                goto exit_nfc_init;
 
+       mtd_setup_common_members(&this->mtd, &this->nand, pdev);
        ret = gpmi_nand_init(this);
        if (ret)
                goto exit_nfc_init;
@@ -1819,6 +1815,7 @@ static int gpmi_nand_remove(struct platform_device *pdev)
 static struct platform_driver gpmi_nand_driver = {
        .driver = {
                .name = "gpmi-nand",
+               .owner = THIS_MODULE,
                .of_match_table = gpmi_nand_id_table,
        },
        .probe   = gpmi_nand_probe,
-- 
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