OSDN Git Service

iio: adc: mt6577_auxdac: use devm_platform_ioremap_resource
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 13 Oct 2019 12:15:38 +0000 (13:15 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 9 Nov 2019 12:14:34 +0000 (12:14 +0000)
Reduces boilerplate.  Identified by coccinelle

CHECK   drivers/iio/adc/mt6577_auxadc.c
drivers/iio/adc/mt6577_auxadc.c:257:1-18: WARNING: Use devm_platform_ioremap_resource for adc_dev -> reg_base

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
drivers/iio/adc/mt6577_auxadc.c

index 7bbb64c..a4776d9 100644 (file)
@@ -237,7 +237,6 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
 {
        struct mt6577_auxadc_device *adc_dev;
        unsigned long adc_clk_rate;
-       struct resource *res;
        struct iio_dev *indio_dev;
        int ret;
 
@@ -253,8 +252,7 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
        indio_dev->channels = mt6577_auxadc_iio_channels;
        indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels);
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       adc_dev->reg_base = devm_ioremap_resource(&pdev->dev, res);
+       adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(adc_dev->reg_base)) {
                dev_err(&pdev->dev, "failed to get auxadc base address\n");
                return PTR_ERR(adc_dev->reg_base);