mtd: devices: simplify getting .drvdata
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 19 Apr 2018 14:05:59 +0000 (16:05 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 22 Apr 2018 17:10:53 +0000 (19:10 +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>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/devices/docg3.c

index c594fe5eac085c337e3facdeb3306b3e07fef4ba..802d8f159e9020e325c0d61026243a0a8d634e0c 100644 (file)
@@ -1470,8 +1470,7 @@ static struct docg3 *sysfs_dev2docg3(struct device *dev,
                                     struct device_attribute *attr)
 {
        int floor;
-       struct platform_device *pdev = to_platform_device(dev);
-       struct mtd_info **docg3_floors = platform_get_drvdata(pdev);
+       struct mtd_info **docg3_floors = dev_get_drvdata(dev);
 
        floor = attr->attr.name[1] - '0';
        if (floor < 0 || floor >= DOC_MAX_NBFLOORS)