Commit cffc293d authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220504113557.59048-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent bf5ff730
...@@ -37,9 +37,8 @@ ...@@ -37,9 +37,8 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -261,7 +260,7 @@ static int srf04_probe(struct platform_device *pdev) ...@@ -261,7 +260,7 @@ static int srf04_probe(struct platform_device *pdev)
data = iio_priv(indio_dev); data = iio_priv(indio_dev);
data->dev = 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); mutex_init(&data->lock);
init_completion(&data->rising); init_completion(&data->rising);
...@@ -289,10 +288,8 @@ static int srf04_probe(struct platform_device *pdev) ...@@ -289,10 +288,8 @@ static int srf04_probe(struct platform_device *pdev)
return PTR_ERR(data->gpiod_power); return PTR_ERR(data->gpiod_power);
} }
if (data->gpiod_power) { if (data->gpiod_power) {
data->startup_time_ms = 100;
if (of_property_read_u32(dev->of_node, "startup-time-ms", device_property_read_u32(dev, "startup-time-ms", &data->startup_time_ms);
&data->startup_time_ms))
data->startup_time_ms = 100;
dev_dbg(dev, "using power gpio: startup-time-ms=%d\n", dev_dbg(dev, "using power gpio: startup-time-ms=%d\n",
data->startup_time_ms); data->startup_time_ms);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment