mtd: nand: use platform_{get,set}_drvdata()
Subsystems (2)
PATCH 1/1 mtd: nand: use platform_{get,set}_drvdata()
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.
--- 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(-)
drivers/mtd/nand/fsl_elbc_nand.c +1 -1
@@ -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);
drivers/mtd/nand/fsl_ifc_nand.c +1 -1
@@ -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);
drivers/mtd/nand/fsl_upm.c +2 -2
@@ -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);
drivers/mtd/nand/ndfc.c +2 -2
@@ -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);
drivers/mtd/nand/socrates_nand.c +2 -4
@@ -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);
Signature · 1 line
1.7.10.4
Quoted 3 lines · Jingoo Han
Use the wrapper functions for getting and setting the driver data using
platform_deviceinstead of using dev_{get,set}_drvdata() with&pdev->dev, so we can directly pass a structplatform_device.
This patch also removes a "dev_set_drvdata(dev, NULL)". Is this no longer necessary during device removal? Otherwise:
Quoted 122 lines
Signed-off-by Jingoo Han <[email protected]>--- 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(-)drivers/mtd/nand/fsl_elbc_nand.c +1
-1@@ -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);drivers/mtd/nand/fsl_ifc_nand.c +1
-1@@ -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);drivers/mtd/nand/fsl_upm.c +2
-2@@ -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);drivers/mtd/nand/ndfc.c +2
-2@@ -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);drivers/mtd/nand/socrates_nand.c +2
-5@@ -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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 8 lines · Brian Norris
Quoted 3 lines · Jingoo Han
Use the wrapper functions for getting and setting the driver data using
platform_deviceinstead of using dev_{get,set}_drvdata() with&pdev->dev, so we can directly pass a structplatform_device.This patch also removes a "
dev_set_drvdata(dev, NULL)". Is this no longer necessary during device removal? Otherwise:
Hi Brian,
The "dev_set_drvdata(dev, NULL)" is unnecessary, because the driver core clears the driver data to NULL after device_release or on probe failure.
Best regards,
Jingoo Han
Quoted 5 lines
Acked-by Brian Norris <[email protected]>Quoted 2 lines
Signed-off-by Jingoo Han <[email protected]>---