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

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>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
150ba97f b863f2e3

+7 -6
+1 -1
drivers/iio/trigger/Kconfig
··· 38 38 39 39 config IIO_STM32_TIMER_TRIGGER 40 40 tristate "STM32 Timer Trigger" 41 - depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST 41 + depends on (ARCH_STM32 && MFD_STM32_TIMERS) || COMPILE_TEST 42 42 help 43 43 Select this option to enable STM32 Timer Trigger 44 44
+6 -5
drivers/iio/trigger/stm32-timer-trigger.c
··· 11 11 #include <linux/iio/timer/stm32-timer-trigger.h> 12 12 #include <linux/iio/trigger.h> 13 13 #include <linux/mfd/stm32-timers.h> 14 + #include <linux/mod_devicetable.h> 14 15 #include <linux/module.h> 15 16 #include <linux/platform_device.h> 16 - #include <linux/of_device.h> 17 + #include <linux/property.h> 17 18 18 19 #define MAX_TRIGGERS 7 19 20 #define MAX_VALIDS 5 ··· 772 771 unsigned int index; 773 772 int ret; 774 773 775 - if (of_property_read_u32(dev->of_node, "reg", &index)) 776 - return -EINVAL; 774 + ret = device_property_read_u32(dev, "reg", &index); 775 + if (ret) 776 + return ret; 777 777 778 - cfg = (const struct stm32_timer_trigger_cfg *) 779 - of_match_device(dev->driver->of_match_table, dev)->data; 778 + cfg = device_get_match_data(dev); 780 779 781 780 if (index >= ARRAY_SIZE(triggers_table) || 782 781 index >= cfg->num_valids_table)