shell: backend: Uninit shell backend if shell is uninit

When shell_uninit is called, the backend
	should also be uninit.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
This commit is contained in:
Philémon Jaermann 2019-08-23 21:40:58 +02:00 committed by Maureen Helm
commit 970a9a02ad
2 changed files with 14 additions and 0 deletions

View file

@ -178,6 +178,16 @@ static int init(const struct shell_transport *transport,
static int uninit(const struct shell_transport *transport)
{
const struct shell_uart *sh_uart = (struct shell_uart *)transport->ctx;
if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN)) {
struct device *dev = sh_uart->ctrl_blk->dev;
uart_irq_rx_disable(dev);
} else {
k_timer_stop(sh_uart->timer);
}
return 0;
}