drivers: console: Fix device instance const qualifier loss in IPM driver

Passing the device's data and config is sufficient for the thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-08 13:09:17 +02:00 committed by Carles Cufí
parent 7d8be66eba
commit d1c68de67e

View file

@ -21,15 +21,13 @@ static void ipm_console_thread(void *arg1, void *arg2, void *arg3)
uint8_t size32;
uint16_t type;
int ret, key;
const struct device *d;
const struct ipm_console_receiver_config_info *config_info;
struct ipm_console_receiver_runtime_data *driver_data;
int pos;
d = (const struct device *)arg1;
driver_data = d->data;
config_info = d->config;
ARG_UNUSED(arg2);
driver_data = (struct ipm_console_receiver_runtime_data *)arg1;
config_info = (const struct ipm_console_receiver_config_info *)arg2;
ARG_UNUSED(arg3);
size32 = 0U;
pos = 0;
@ -54,11 +52,11 @@ static void ipm_console_thread(void *arg1, void *arg2, void *arg3)
config_info->line_buf[pos + 1] = '\0';
}
if (config_info->flags & IPM_CONSOLE_PRINTK) {
printk("%s: '%s'\n", d->name,
printk("ipm_console: '%s'\n",
config_info->line_buf);
}
if (config_info->flags & IPM_CONSOLE_STDOUT) {
printf("%s: '%s'\n", d->name,
printf("ipm_console: '%s'\n",
config_info->line_buf);
}
pos = 0;
@ -85,16 +83,13 @@ static void ipm_console_thread(void *arg1, void *arg2, void *arg3)
}
static void ipm_console_receive_callback(const struct device *ipm_dev,
void *context,
void *user_data,
uint32_t id, volatile void *data)
{
const struct device *d;
struct ipm_console_receiver_runtime_data *driver_data;
struct ipm_console_receiver_runtime_data *driver_data = user_data;
int ret;
ARG_UNUSED(data);
d = context;
driver_data = d->data;
/* Should always be at least one free buffer slot */
ret = ring_buf_item_put(&driver_data->rb, 0, id, NULL, 0);
@ -143,11 +138,12 @@ int ipm_console_receiver_init(const struct device *d)
ring_buf_init(&driver_data->rb, config_info->rb_size32,
config_info->ring_buf_data);
ipm_register_callback(ipm, ipm_console_receive_callback, d);
ipm_register_callback(ipm, ipm_console_receive_callback, driver_data);
k_thread_create(&driver_data->rx_thread, config_info->thread_stack,
CONFIG_IPM_CONSOLE_STACK_SIZE, ipm_console_thread, d,
NULL, NULL, K_PRIO_COOP(IPM_CONSOLE_PRI), 0, K_NO_WAIT);
CONFIG_IPM_CONSOLE_STACK_SIZE, ipm_console_thread,
driver_data, (void *)config_info, NULL,
K_PRIO_COOP(IPM_CONSOLE_PRI), 0, K_NO_WAIT);
ipm_set_enabled(ipm, 1);
return 0;