diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-03-18 14:03:19 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-24 08:26:32 +0100 |
commit | 28d032510e6338b93db485e4b514d7bb996b9d33 (patch) | |
tree | 46988d8657df05d645d0699ca49b9d60ff9bf4a1 /drivers/pps | |
parent | pps: clients: gpio: Get rid of legacy platform data (diff) | |
download | linux-28d032510e6338b93db485e4b514d7bb996b9d33.tar.xz linux-28d032510e6338b93db485e4b514d7bb996b9d33.zip |
pps: clients: gpio: Make use of device properties
Device property API allows to gather device resources from different sources,
such as ACPI. Convert the drivers to unleash the power of device property API.
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210318130321.24227-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pps')
-rw-r--r-- | drivers/pps/clients/pps-gpio.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c index 291240dce79e..c6db3a3b257b 100644 --- a/drivers/pps/clients/pps-gpio.c +++ b/drivers/pps/clients/pps-gpio.c @@ -12,14 +12,14 @@ #include <linux/init.h> #include <linux/kernel.h> #include <linux/interrupt.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/pps_kernel.h> #include <linux/gpio/consumer.h> #include <linux/list.h> -#include <linux/of_device.h> -#include <linux/of_gpio.h> +#include <linux/property.h> #include <linux/timer.h> #include <linux/jiffies.h> @@ -102,7 +102,6 @@ static void pps_gpio_echo_timer_callback(struct timer_list *t) static int pps_gpio_setup(struct platform_device *pdev) { struct pps_gpio_device_data *data = platform_get_drvdata(pdev); - struct device_node *np = pdev->dev.of_node; int ret; u32 value; @@ -121,26 +120,24 @@ static int pps_gpio_setup(struct platform_device *pdev) "failed to request ECHO GPIO\n"); if (data->echo_pin) { - ret = of_property_read_u32(np, - "echo-active-ms", - &value); + ret = device_property_read_u32(&pdev->dev, "echo-active-ms", &value); if (ret) { dev_err(&pdev->dev, - "failed to get echo-active-ms from OF\n"); + "failed to get echo-active-ms from FW\n"); return ret; } data->echo_active_ms = value; /* sanity check on echo_active_ms */ if (!data->echo_active_ms || data->echo_active_ms > 999) { dev_err(&pdev->dev, - "echo-active-ms: %u - bad value from OF\n", + "echo-active-ms: %u - bad value from FW\n", data->echo_active_ms); return -EINVAL; } } - if (of_property_read_bool(np, "assert-falling-edge")) - data->assert_falling_edge = true; + data->assert_falling_edge = + device_property_read_bool(&pdev->dev, "assert-falling-edge"); return 0; } |