subsys: logging: Fix device instance const qualifier loss

Uart device is unique and thus does not need to be passed through the
logging context. Only the assert() requires a void * cast.

On log_output side, the device usage was removed. It is actually unclear
why it has been set like this since depending on the context, it can be
anything and not specifically a device.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-09 14:54:24 +02:00 committed by Carles Cufí
commit cdf094a479
2 changed files with 11 additions and 12 deletions

View file

@ -658,14 +658,15 @@ void log_output_dropped_process(const struct log_output *log_output, uint32_t cn
static const char postfix[] =
" messages dropped ---\r\n" DROPPED_COLOR_POSTFIX;
log_output_func_t outf = log_output->func;
const struct device *dev = (const struct device *)log_output->control_block->ctx;
cnt = MIN(cnt, 9999);
len = snprintk(buf, sizeof(buf), "%d", cnt);
buffer_write(outf, (uint8_t *)prefix, sizeof(prefix) - 1, dev);
buffer_write(outf, buf, len, dev);
buffer_write(outf, (uint8_t *)postfix, sizeof(postfix) - 1, dev);
buffer_write(outf, (uint8_t *)prefix, sizeof(prefix) - 1,
log_output->control_block->ctx);
buffer_write(outf, buf, len, log_output->control_block->ctx);
buffer_write(outf, (uint8_t *)postfix, sizeof(postfix) - 1,
log_output->control_block->ctx);
}
void log_output_timestamp_freq_set(uint32_t frequency)