Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: vf610_adc: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Add mod_devicetable.h include.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220531142353.64925-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
3cc6a67b 3b9b4357

+6 -10
-1
drivers/iio/adc/Kconfig
··· 1257 1257 1258 1258 config VF610_ADC 1259 1259 tristate "Freescale vf610 ADC driver" 1260 - depends on OF 1261 1260 depends on HAS_IOMEM 1262 1261 select IIO_BUFFER 1263 1262 select IIO_TRIGGERED_BUFFER
+6 -9
drivers/iio/adc/vf610_adc.c
··· 5 5 * Copyright 2013 Freescale Semiconductor, Inc. 6 6 */ 7 7 8 + #include <linux/mod_devicetable.h> 8 9 #include <linux/module.h> 10 + #include <linux/property.h> 9 11 #include <linux/platform_device.h> 10 12 #include <linux/interrupt.h> 11 13 #include <linux/delay.h> ··· 16 14 #include <linux/io.h> 17 15 #include <linux/clk.h> 18 16 #include <linux/completion.h> 19 - #include <linux/of.h> 20 - #include <linux/of_irq.h> 21 17 #include <linux/regulator/consumer.h> 22 - #include <linux/of_platform.h> 23 18 #include <linux/err.h> 24 19 25 20 #include <linux/iio/iio.h> ··· 798 799 799 800 static int vf610_adc_probe(struct platform_device *pdev) 800 801 { 802 + struct device *dev = &pdev->dev; 801 803 struct vf610_adc *info; 802 804 struct iio_dev *indio_dev; 803 805 int irq; ··· 846 846 847 847 info->vref_uv = regulator_get_voltage(info->vref); 848 848 849 - of_property_read_u32_array(pdev->dev.of_node, "fsl,adck-max-frequency", 850 - info->max_adck_rate, 3); 849 + device_property_read_u32_array(dev, "fsl,adck-max-frequency", info->max_adck_rate, 3); 851 850 852 - ret = of_property_read_u32(pdev->dev.of_node, "min-sample-time", 853 - &info->adc_feature.default_sample_time); 854 - if (ret) 855 - info->adc_feature.default_sample_time = DEFAULT_SAMPLE_TIME; 851 + info->adc_feature.default_sample_time = DEFAULT_SAMPLE_TIME; 852 + device_property_read_u32(dev, "min-sample-time", &info->adc_feature.default_sample_time); 856 853 857 854 platform_set_drvdata(pdev, indio_dev); 858 855