diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-05-04 14:35:57 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-06-11 14:35:25 +0100 |
commit | cffc293dd92e429a9857cb5565cdfc526e25fb08 (patch) | |
tree | a047da30f3c06dd4b61e878b865855265fd491a9 /drivers/iio/proximity | |
parent | bf5ff730dcc2540d39ed572f551f79524c4d7eb8 (diff) |
iio: proximity: srf04: Make use of device properties
Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220504113557.59048-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/proximity')
-rw-r--r-- | drivers/iio/proximity/srf04.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c index 4e6286765f01..05015351a34a 100644 --- a/drivers/iio/proximity/srf04.c +++ b/drivers/iio/proximity/srf04.c @@ -37,9 +37,8 @@ #include <linux/err.h> #include <linux/gpio/consumer.h> #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> -#include <linux/of.h> -#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/property.h> #include <linux/sched.h> @@ -261,7 +260,7 @@ static int srf04_probe(struct platform_device *pdev) data = iio_priv(indio_dev); data->dev = dev; - data->cfg = of_match_device(of_srf04_match, dev)->data; + data->cfg = device_get_match_data(dev); mutex_init(&data->lock); init_completion(&data->rising); @@ -289,10 +288,8 @@ static int srf04_probe(struct platform_device *pdev) return PTR_ERR(data->gpiod_power); } if (data->gpiod_power) { - - if (of_property_read_u32(dev->of_node, "startup-time-ms", - &data->startup_time_ms)) - data->startup_time_ms = 100; + data->startup_time_ms = 100; + device_property_read_u32(dev, "startup-time-ms", &data->startup_time_ms); dev_dbg(dev, "using power gpio: startup-time-ms=%d\n", data->startup_time_ms); } |