sensor: lm75: Enforce dependency of int-gpios with Trigger feature
As pointed out on #57586: `LM75_TRIGGER_GLOBAL_THREAD` can't be enabled without the int-gpios being present in the DTS node. This commit requires at least one LM75 instance featuring it, otherwise it won't work. Signed-off-by: Luis Ubieda <luisf@croxel.com>
This commit is contained in:
parent
a3835041bd
commit
089eaf93ec
2 changed files with 11 additions and 6 deletions
|
@ -25,6 +25,7 @@ config LM75_TRIGGER_NONE
|
|||
|
||||
config LM75_TRIGGER_GLOBAL_THREAD
|
||||
bool "Use global thread"
|
||||
depends on $(dt_compat_any_has_prop,$(DT_COMPAT_LM75),int-gpios)
|
||||
depends on GPIO
|
||||
select LM75_TRIGGER
|
||||
|
||||
|
|
|
@ -346,13 +346,17 @@ int lm75_init(const struct device *dev)
|
|||
}
|
||||
|
||||
#if LM75_TRIGGER_SUPPORT
|
||||
data->dev = dev;
|
||||
k_work_queue_start(&data->workq, data->stack, K_THREAD_STACK_SIZEOF(data->stack),
|
||||
CONFIG_LM75_TRIGGER_THREAD_PRIO, NULL);
|
||||
k_thread_name_set(&data->workq.thread, "lm75_trigger");
|
||||
k_work_init(&data->work, lm75_trigger_work_handler);
|
||||
|
||||
/** Even if Trigger support is enabled, there may be multiple
|
||||
* instances. This handles those who may not have Trigger support.
|
||||
*/
|
||||
if (cfg->int_gpio.port != NULL) {
|
||||
|
||||
data->dev = dev;
|
||||
k_work_queue_start(&data->workq, data->stack, K_THREAD_STACK_SIZEOF(data->stack),
|
||||
CONFIG_LM75_TRIGGER_THREAD_PRIO, NULL);
|
||||
k_thread_name_set(&data->workq.thread, "lm75_trigger");
|
||||
k_work_init(&data->work, lm75_trigger_work_handler);
|
||||
|
||||
if (!device_is_ready(cfg->int_gpio.port)) {
|
||||
LOG_ERR("INT GPIO not ready");
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue