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:
parent
d6ca3fd4da
commit
e78b0785b3
3 changed files with 11 additions and 4 deletions
|
@ -597,7 +597,10 @@ static int uart_console_init(const struct device *arg)
|
||||||
ARG_UNUSED(arg);
|
ARG_UNUSED(arg);
|
||||||
|
|
||||||
/* Claim console device */
|
/* 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();
|
uart_console_hook_install();
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,11 @@ int console_init(void)
|
||||||
const struct device *uart_dev;
|
const struct device *uart_dev;
|
||||||
int ret;
|
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);
|
ret = tty_init(&console_serial, uart_dev);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
@ -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)
|
static void log_backend_uart_init(struct log_backend const *const backend)
|
||||||
{
|
{
|
||||||
uart_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
|
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
|
||||||
__ASSERT_NO_MSG((void *)uart_dev);
|
__ASSERT_NO_MSG(device_is_ready(uart_dev));
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG_BACKEND_UART_OUTPUT_DICTIONARY_HEX)) {
|
if (IS_ENABLED(CONFIG_LOG_BACKEND_UART_OUTPUT_DICTIONARY_HEX)) {
|
||||||
/* Print a separator so the output can be fed into
|
/* Print a separator so the output can be fed into
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue