iio: trigger: stm32-timer: 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> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Link: https://lore.kernel.org/r/20220202204112.57095-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
b863f2e3a8
commit
150ba97f1c
@@ -38,7 +38,7 @@ config IIO_STM32_LPTIMER_TRIGGER
|
|||||||
|
|
||||||
config IIO_STM32_TIMER_TRIGGER
|
config IIO_STM32_TIMER_TRIGGER
|
||||||
tristate "STM32 Timer Trigger"
|
tristate "STM32 Timer Trigger"
|
||||||
depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
|
depends on (ARCH_STM32 && MFD_STM32_TIMERS) || COMPILE_TEST
|
||||||
help
|
help
|
||||||
Select this option to enable STM32 Timer Trigger
|
Select this option to enable STM32 Timer Trigger
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,10 @@
|
|||||||
#include <linux/iio/timer/stm32-timer-trigger.h>
|
#include <linux/iio/timer/stm32-timer-trigger.h>
|
||||||
#include <linux/iio/trigger.h>
|
#include <linux/iio/trigger.h>
|
||||||
#include <linux/mfd/stm32-timers.h>
|
#include <linux/mfd/stm32-timers.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/property.h>
|
||||||
|
|
||||||
#define MAX_TRIGGERS 7
|
#define MAX_TRIGGERS 7
|
||||||
#define MAX_VALIDS 5
|
#define MAX_VALIDS 5
|
||||||
@@ -771,11 +772,11 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev)
|
|||||||
unsigned int index;
|
unsigned int index;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (of_property_read_u32(dev->of_node, "reg", &index))
|
ret = device_property_read_u32(dev, "reg", &index);
|
||||||
return -EINVAL;
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
cfg = (const struct stm32_timer_trigger_cfg *)
|
cfg = device_get_match_data(dev);
|
||||||
of_match_device(dev->driver->of_match_table, dev)->data;
|
|
||||||
|
|
||||||
if (index >= ARRAY_SIZE(triggers_table) ||
|
if (index >= ARRAY_SIZE(triggers_table) ||
|
||||||
index >= cfg->num_valids_table)
|
index >= cfg->num_valids_table)
|
||||||
|
|||||||
Reference in New Issue
Block a user