[PATCH 21/27] mtd: nand: fsl_upm: show device structure in sysfs

From: Alexander Holler
Date: Mon May 26 2014 - 18:16:49 EST


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 <holler@xxxxxxxxxxxxx>
---
drivers/mtd/nand/fsl_upm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index 4d203e8..bc2a188 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -175,9 +175,6 @@ static int fun_chip_init(struct fsl_upm_nand *fun,
if (fun->rnb_gpio[0] >= 0)
fun->chip.dev_ready = fun_chip_ready;

- fun->mtd.priv = &fun->chip;
- fun->mtd.owner = THIS_MODULE;
-
flash_np = of_get_next_child(upm_np, NULL);
if (!flash_np)
return -ENODEV;
@@ -300,6 +297,7 @@ static int fun_probe(struct platform_device *ofdev)
fun->dev = &ofdev->dev;
fun->last_ctrl = NAND_CLE;

+ mtd_setup_common_members(&fun->mtd, &fun->chip, ofdev);
ret = fun_chip_init(fun, ofdev->dev.of_node, &io_res);
if (ret)
goto err2;
--
1.8.3.2

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