From: Wolfram Sang Date: Thu, 19 Apr 2018 14:05:59 +0000 (+0200) Subject: mtd: devices: simplify getting .drvdata X-Git-Tag: rel_imx_4.19.35_1.1.0~9946^2~19 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=0e210b542cdb34637b849e181178c2d27fcf0d28;p=linux.git mtd: devices: simplify getting .drvdata We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang Acked-by: Robert Jarzmik Signed-off-by: Boris Brezillon --- diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index c594fe5eac08..802d8f159e90 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -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)