drivers: can: shell: print current operation mode in show subcommand

Print the current operation mode in the "can show" shell subcommand.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
diff --git a/doc/hardware/peripherals/can/shell.rst b/doc/hardware/peripherals/can/shell.rst
index cfd0168..bb164de 100644
--- a/doc/hardware/peripherals/can/shell.rst
+++ b/doc/hardware/peripherals/can/shell.rst
@@ -62,7 +62,8 @@
 
 The properties of a given CAN controller can be inspected using the ``can show`` subcommand as shown
 below. The properties include the core CAN clock rate, the maximum supported bitrate, the number of
-RX filters supported, capabilities, current state, error counters, timing limits, and more:
+RX filters supported, capabilities, current mode, current state, error counters, timing limits, and
+more:
 
 .. code-block:: console
 
@@ -72,6 +73,7 @@
    max std filters: 15
    max ext filters: 15
    capabilities:    normal loopback listen-only fd
+   mode:            normal
    state:           stopped
    rx errors:       0
    tx errors:       0
diff --git a/drivers/can/can_shell.c b/drivers/can/can_shell.c
index 3f193ae..c739786 100644
--- a/drivers/can/can_shell.c
+++ b/drivers/can/can_shell.c
@@ -202,7 +202,7 @@
 	}
 }
 
-static void can_shell_print_capabilities(const struct shell *sh, can_mode_t cap)
+static void can_shell_print_extended_modes(const struct shell *sh, can_mode_t cap)
 {
 	int bit;
 	int i;
@@ -331,7 +331,11 @@
 	shell_print(sh, "max ext filters: %d", max_ext_filters);
 
 	shell_fprintf(sh, SHELL_NORMAL, "capabilities:    normal ");
-	can_shell_print_capabilities(sh, cap);
+	can_shell_print_extended_modes(sh, cap);
+	shell_fprintf(sh, SHELL_NORMAL, "\n");
+
+	shell_fprintf(sh, SHELL_NORMAL, "mode:            normal ");
+	can_shell_print_extended_modes(sh, can_get_mode(dev));
 	shell_fprintf(sh, SHELL_NORMAL, "\n");
 
 	shell_print(sh, "state:           %s", can_shell_state_to_string(state));