drivers: sensor: Fix device instance const qualifier loss
It is necessary to wrap the device pointer into data. Which was done already on most of them when global trigger is enabled. Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
162c0bd7fe
commit
d00d86972a
76 changed files with 350 additions and 546 deletions
|
@ -50,9 +50,8 @@ int iis2mdc_trigger_set(const struct device *dev,
|
|||
}
|
||||
|
||||
/* handle the drdy event: read data and call handler if registered any */
|
||||
static void iis2mdc_handle_interrupt(void *arg)
|
||||
static void iis2mdc_handle_interrupt(const struct device *dev)
|
||||
{
|
||||
const struct device *dev = arg;
|
||||
struct iis2mdc_data *iis2mdc = dev->data;
|
||||
const struct iis2mdc_config *const config = dev->config;
|
||||
struct sensor_trigger drdy_trigger = {
|
||||
|
@ -86,16 +85,11 @@ static void iis2mdc_gpio_callback(const struct device *dev,
|
|||
}
|
||||
|
||||
#ifdef CONFIG_IIS2MDC_TRIGGER_OWN_THREAD
|
||||
static void iis2mdc_thread(int dev_ptr, int unused)
|
||||
static void iis2mdc_thread(struct iis2mdc_data *iis2mdc)
|
||||
{
|
||||
const struct device *dev = INT_TO_POINTER(dev_ptr);
|
||||
struct iis2mdc_data *iis2mdc = dev->data;
|
||||
|
||||
ARG_UNUSED(unused);
|
||||
|
||||
while (1) {
|
||||
k_sem_take(&iis2mdc->gpio_sem, K_FOREVER);
|
||||
iis2mdc_handle_interrupt(dev);
|
||||
iis2mdc_handle_interrupt(iis2mdc->dev);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -122,14 +116,13 @@ int iis2mdc_init_interrupt(const struct device *dev)
|
|||
config->drdy_port);
|
||||
return -EINVAL;
|
||||
}
|
||||
iis2mdc->dev = dev;
|
||||
|
||||
#if defined(CONFIG_IIS2MDC_TRIGGER_OWN_THREAD)
|
||||
k_sem_init(&iis2mdc->gpio_sem, 0, UINT_MAX);
|
||||
k_thread_create(&iis2mdc->thread, iis2mdc->thread_stack,
|
||||
CONFIG_IIS2MDC_THREAD_STACK_SIZE,
|
||||
(k_thread_entry_t)iis2mdc_thread, dev,
|
||||
0, NULL, K_PRIO_COOP(CONFIG_IIS2MDC_THREAD_PRIORITY),
|
||||
(k_thread_entry_t)iis2mdc_thread, iis2mdc,
|
||||
NULL, NULL, K_PRIO_COOP(CONFIG_IIS2MDC_THREAD_PRIORITY),
|
||||
0, K_NO_WAIT);
|
||||
#elif defined(CONFIG_IIS2MDC_TRIGGER_GLOBAL_THREAD)
|
||||
iis2mdc->work.handler = iis2mdc_work_cb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue