console: remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)

Remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
and use DEVICE_DT_GET(DT_CHOSEN(zephyr_console)) to get
chosen "zephyr,console" node.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2021-07-22 15:57:31 +02:00 committed by Christopher Friedt
parent d6ca3fd4da
commit e78b0785b3
3 changed files with 11 additions and 4 deletions

View file

@ -597,7 +597,10 @@ static int uart_console_init(const struct device *arg)
ARG_UNUSED(arg);
/* Claim console device */
uart_console_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
uart_console_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(uart_console_dev)) {
return -ENODEV;
}
uart_console_hook_install();

View file

@ -52,7 +52,11 @@ int console_init(void)
const struct device *uart_dev;
int ret;
uart_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(uart_dev)) {
return -ENODEV;
}
ret = tty_init(&console_serial, uart_dev);
if (ret) {

View file

@ -75,8 +75,8 @@ static void process(const struct log_backend *const backend,
static void log_backend_uart_init(struct log_backend const *const backend)
{
uart_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
__ASSERT_NO_MSG((void *)uart_dev);
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
__ASSERT_NO_MSG(device_is_ready(uart_dev));
if (IS_ENABLED(CONFIG_LOG_BACKEND_UART_OUTPUT_DICTIONARY_HEX)) {
/* Print a separator so the output can be fed into