Skip to content

Commit 741ae93

Browse files
jfischer-nonashif
authored andcommitted
shell: remove Kconfig option CONFIG_UART_SHELL_ON_DEV_NAME
Follow up on commit bfd45e5 ("drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME") Now we can also remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME since all UART drivers are converted to devicetree and we can just use DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart)). Signed-off-by: Johann Fischer <[email protected]>
1 parent 893bfc0 commit 741ae93

File tree

6 files changed

+11
-26
lines changed

6 files changed

+11
-26
lines changed

doc/reference/devicetree/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ device.
342342
* - zephyr,ot-uart
343343
- Used by the OpenThread to specify UART device for Spinel protocol
344344
* - zephyr,shell-uart
345-
- Sets default :kconfig:`CONFIG_UART_SHELL_ON_DEV_NAME`
345+
- Sets UART device used by serial shell backend
346346
* - zephyr,sram
347347
- A node whose ``reg`` sets the base address and size of SRAM memory
348348
available to the Zephyr image, used during linking

doc/releases/release-notes-2.7.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Removed APIs in this release
5454
in favor of direct use of chosen node ``zephyr,uart-mcumgr``.
5555
* Removed ``CONFIG_UART_CONSOLE_ON_DEV_NAME`` Kconfig option
5656
in favor of direct use of chosen node ``zephyr,console``.
57+
* Removed ``CONFIG_UART_SHELL_ON_DEV_NAME`` Kconfig option
58+
in favor of direct use of chosen node ``zephyr,shell-uart``.
5759

5860
============================
5961

samples/subsys/shell/shell_module/sample.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ common:
55
- native_posix
66
tests:
77
sample.shell.shell_module:
8-
filter: ( CONFIG_SERIAL and CONFIG_UART_SHELL_ON_DEV_NAME )
8+
filter: CONFIG_SERIAL and dt_chosen_enabled("zephyr,shell-uart")
99
tags: shell
1010
harness: keyboard
1111
min_ram: 40
@@ -17,12 +17,12 @@ tests:
1717
extra_args: OVERLAY_CONFIG="overlay-usb.conf"
1818
DTC_OVERLAY_FILE="usb.overlay"
1919
sample.shell.shell_module.minimal:
20-
filter: ( CONFIG_SERIAL and CONFIG_UART_SHELL_ON_DEV_NAME )
20+
filter: CONFIG_SERIAL and dt_chosen_enabled("zephyr,shell-uart")
2121
tags: shell
2222
harness: keyboard
2323
extra_args: CONF_FILE="prj_minimal.conf"
2424
sample.shell.shell_module.getopt:
25-
filter: ( CONFIG_SERIAL and CONFIG_UART_SHELL_ON_DEV_NAME )
25+
filter: CONFIG_SERIAL and dt_chosen_enabled("zephyr,shell-uart")
2626
tags: shell
2727
harness: keyboard
2828
min_ram: 40
@@ -33,7 +33,7 @@ tests:
3333
harness: keyboard
3434
extra_args: CONF_FILE="prj_minimal_rtt.conf"
3535
sample.shell.shell_module.login:
36-
filter: ( CONFIG_SERIAL and CONFIG_UART_SHELL_ON_DEV_NAME )
36+
filter: CONFIG_SERIAL and dt_chosen_enabled("zephyr,shell-uart")
3737
tags: shell
3838
harness: keyboard
3939
min_ram: 40

samples/subsys/shell/shell_module/src/uart_reinit.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
void shell_init_from_work(struct k_work *work)
1212
{
13-
const struct device *dev =
14-
device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
13+
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
1514
bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0;
1615
uint32_t level =
1716
(CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > LOG_LEVEL_DBG) ?
@@ -86,8 +85,7 @@ K_TIMER_DEFINE(uart_poll_timer, uart_poll_timeout, uart_poll_timer_stopped);
8685
static void shell_uninit_cb(const struct shell *shell, int res)
8786
{
8887
__ASSERT_NO_MSG(res >= 0);
89-
const struct device *dev =
90-
device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
88+
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
9189

9290
if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN)) {
9391
/* connect uart to my handler */

subsys/shell/Kconfig.backends

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@ config SHELL_PROMPT_UART
3535
help
3636
Displayed prompt name for UART backend.
3737

38-
# Workaround for not being able to have commas in macro arguments
39-
DT_CHOSEN_Z_SHELL_UART := zephyr,shell-uart
40-
41-
config UART_SHELL_ON_DEV_NAME
42-
string "Device Name of UART Device for SHELL_BACKEND_SERIAL"
43-
default "$(dt_chosen_label,$(DT_CHOSEN_Z_SHELL_UART))" if HAS_DTS
44-
default "UART_0"
45-
help
46-
This option specifies the name of UART device to be used for the
47-
SHELL UART backend.
48-
In case when DTS is enabled (HAS_DTS), the default value is
49-
set from DTS chosen node 'zephyr,shell-uart' but can be overridden
50-
here.
51-
5238
# Internal config to enable UART interrupts if supported.
5339
config SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
5440
bool "Interrupt driven"

subsys/shell/shell_uart.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,13 @@ const struct shell_transport_api shell_uart_transport_api = {
293293
static int enable_shell_uart(const struct device *arg)
294294
{
295295
ARG_UNUSED(arg);
296-
const struct device *dev =
297-
device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
296+
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
298297
bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0;
299298
uint32_t level =
300299
(CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > LOG_LEVEL_DBG) ?
301300
CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL;
302301

303-
if (dev == NULL) {
302+
if (!device_is_ready(dev)) {
304303
return -ENODEV;
305304
}
306305

0 commit comments

Comments
 (0)