staging: iio: adc: simplify getting .drvdata
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 19 Apr 2018 14:06:18 +0000 (16:06 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 28 Apr 2018 15:17:59 +0000 (16:17 +0100)
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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/adc/ad7606_par.c

index 3eb6f8f312dd9f4e64e658777326a1eb8e4791fc..a34c2a1d537326d4a5054a2b85a1414eea15c2f1 100644 (file)
@@ -18,8 +18,7 @@
 static int ad7606_par16_read_block(struct device *dev,
                                   int count, void *buf)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+       struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct ad7606_state *st = iio_priv(indio_dev);
 
        insw((unsigned long)st->base_address, buf, count);
@@ -34,8 +33,7 @@ static const struct ad7606_bus_ops ad7606_par16_bops = {
 static int ad7606_par8_read_block(struct device *dev,
                                  int count, void *buf)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+       struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct ad7606_state *st = iio_priv(indio_dev);
 
        insb((unsigned long)st->base_address, buf, count * 2);