mtd: onenand: simplify getting .drvdata
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 19 Apr 2018 14:06:00 +0000 (16:06 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 29 Apr 2018 06:56:42 +0000 (08:56 +0200)
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/nand/onenand/samsung.c

index 2e9d076..4cce4c0 100644 (file)
@@ -958,8 +958,7 @@ static int s3c_onenand_remove(struct platform_device *pdev)
 
 static int s3c_pm_ops_suspend(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct mtd_info *mtd = platform_get_drvdata(pdev);
+       struct mtd_info *mtd = dev_get_drvdata(dev);
        struct onenand_chip *this = mtd->priv;
 
        this->wait(mtd, FL_PM_SUSPENDED);
@@ -968,8 +967,7 @@ static int s3c_pm_ops_suspend(struct device *dev)
 
 static  int s3c_pm_ops_resume(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct mtd_info *mtd = platform_get_drvdata(pdev);
+       struct mtd_info *mtd = dev_get_drvdata(dev);
        struct onenand_chip *this = mtd->priv;
 
        this->unlock_all(mtd);