[PATCH] mtd: nand: use platform_{get,set}_drvdata()

Jingoo Han jg1.han at samsung.com
Thu May 23 06:31:07 EDT 2013


Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.

Signed-off-by: Jingoo Han <jg1.han at samsung.com>
---
 drivers/mtd/nand/fsl_elbc_nand.c |    2 +-
 drivers/mtd/nand/fsl_ifc_nand.c  |    2 +-
 drivers/mtd/nand/fsl_upm.c       |    4 ++--
 drivers/mtd/nand/ndfc.c          |    4 ++--
 drivers/mtd/nand/socrates_nand.c |    6 ++----
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 2065720..44d2073 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -915,7 +915,7 @@ err:
 static int fsl_elbc_nand_remove(struct platform_device *pdev)
 {
 	struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = fsl_lbc_ctrl_dev->nand;
-	struct fsl_elbc_mtd *priv = dev_get_drvdata(&pdev->dev);
+	struct fsl_elbc_mtd *priv = platform_get_drvdata(pdev);
 
 	fsl_elbc_chip_remove(priv);
 
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 317a771..f20986b 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -1050,7 +1050,7 @@ err:
 
 static int fsl_ifc_nand_remove(struct platform_device *dev)
 {
-	struct fsl_ifc_mtd *priv = dev_get_drvdata(&dev->dev);
+	struct fsl_ifc_mtd *priv = platform_get_drvdata(dev);
 
 	fsl_ifc_chip_remove(priv);
 
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index 04e0725..e5b7597 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -303,7 +303,7 @@ static int fun_probe(struct platform_device *ofdev)
 	if (ret)
 		goto err2;
 
-	dev_set_drvdata(&ofdev->dev, fun);
+	platform_set_drvdata(ofdev, fun);
 
 	return 0;
 err2:
@@ -320,7 +320,7 @@ err1:
 
 static int fun_remove(struct platform_device *ofdev)
 {
-	struct fsl_upm_nand *fun = dev_get_drvdata(&ofdev->dev);
+	struct fsl_upm_nand *fun = platform_get_drvdata(ofdev);
 	int i;
 
 	nand_release(&fun->mtd);
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 8e148f1..fa65c1b 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -223,7 +223,7 @@ static int ndfc_probe(struct platform_device *ofdev)
 	spin_lock_init(&ndfc->ndfc_control.lock);
 	init_waitqueue_head(&ndfc->ndfc_control.wq);
 	ndfc->ofdev = ofdev;
-	dev_set_drvdata(&ofdev->dev, ndfc);
+	platform_set_drvdata(ofdev, ndfc);
 
 	ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0);
 	if (!ndfc->ndfcbase) {
@@ -258,7 +258,7 @@ static int ndfc_probe(struct platform_device *ofdev)
 
 static int ndfc_remove(struct platform_device *ofdev)
 {
-	struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev);
+	struct ndfc_controller *ndfc = platform_get_drvdata(ofdev);
 
 	nand_release(&ndfc->mtd);
 	kfree(ndfc->mtd.name);
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index 09dde7d..5090c8c 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -190,7 +190,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 	/* TODO: I have no idea what real delay is. */
 	nand_chip->chip_delay = 20;		/* 20us command delay time */
 
-	dev_set_drvdata(&ofdev->dev, host);
+	platform_set_drvdata(ofdev, host);
 
 	/* first scan to find the device and get the page size */
 	if (nand_scan_ident(mtd, 1, NULL)) {
@@ -211,7 +211,6 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 	nand_release(mtd);
 
 out:
-	dev_set_drvdata(&ofdev->dev, NULL);
 	iounmap(host->io_base);
 	kfree(host);
 	return res;
@@ -222,12 +221,11 @@ out:
  */
 static int socrates_nand_remove(struct platform_device *ofdev)
 {
-	struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev);
+	struct socrates_nand_host *host = platform_get_drvdata(ofdev);
 	struct mtd_info *mtd = &host->mtd;
 
 	nand_release(mtd);
 
-	dev_set_drvdata(&ofdev->dev, NULL);
 	iounmap(host->io_base);
 	kfree(host);
 
-- 
1.7.10.4





More information about the linux-mtd mailing list