shell: device_service: fix MISRA 5.7 violation

Changes in device_service have triggered MISRA 5.7 violation CI error
(Tag name should be unique). Renamed shell to sh, same as some other
modules.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-10-04 15:05:12 +02:00 committed by Stephanos Ioannidis
commit e5eade32e2

View file

@ -60,7 +60,7 @@ static const char *get_device_name(const struct device *dev,
return name;
}
static bool device_get_config_level(const struct shell *shell,
static bool device_get_config_level(const struct shell *sh,
enum init_level level)
{
const struct device *dev;
@ -71,49 +71,49 @@ static bool device_get_config_level(const struct shell *shell,
if (device_is_ready(dev)) {
devices = true;
shell_fprintf(shell, SHELL_NORMAL, "- %s\n",
shell_fprintf(sh, SHELL_NORMAL, "- %s\n",
get_device_name(dev, buf, sizeof(buf)));
}
}
return devices;
}
static int cmd_device_levels(const struct shell *shell,
static int cmd_device_levels(const struct shell *sh,
size_t argc, char **argv)
{
ARG_UNUSED(argc);
ARG_UNUSED(argv);
bool ret;
shell_fprintf(shell, SHELL_NORMAL, "PRE KERNEL 1:\n");
ret = device_get_config_level(shell, INIT_LEVEL_PRE_KERNEL_1);
shell_fprintf(sh, SHELL_NORMAL, "PRE KERNEL 1:\n");
ret = device_get_config_level(sh, INIT_LEVEL_PRE_KERNEL_1);
if (ret == false) {
shell_fprintf(shell, SHELL_NORMAL, "- None\n");
shell_fprintf(sh, SHELL_NORMAL, "- None\n");
}
shell_fprintf(shell, SHELL_NORMAL, "PRE KERNEL 2:\n");
ret = device_get_config_level(shell, INIT_LEVEL_PRE_KERNEL_2);
shell_fprintf(sh, SHELL_NORMAL, "PRE KERNEL 2:\n");
ret = device_get_config_level(sh, INIT_LEVEL_PRE_KERNEL_2);
if (ret == false) {
shell_fprintf(shell, SHELL_NORMAL, "- None\n");
shell_fprintf(sh, SHELL_NORMAL, "- None\n");
}
shell_fprintf(shell, SHELL_NORMAL, "POST_KERNEL:\n");
ret = device_get_config_level(shell, INIT_LEVEL_POST_KERNEL);
shell_fprintf(sh, SHELL_NORMAL, "POST_KERNEL:\n");
ret = device_get_config_level(sh, INIT_LEVEL_POST_KERNEL);
if (ret == false) {
shell_fprintf(shell, SHELL_NORMAL, "- None\n");
shell_fprintf(sh, SHELL_NORMAL, "- None\n");
}
shell_fprintf(shell, SHELL_NORMAL, "APPLICATION:\n");
ret = device_get_config_level(shell, INIT_LEVEL_APPLICATION);
shell_fprintf(sh, SHELL_NORMAL, "APPLICATION:\n");
ret = device_get_config_level(sh, INIT_LEVEL_APPLICATION);
if (ret == false) {
shell_fprintf(shell, SHELL_NORMAL, "- None\n");
shell_fprintf(sh, SHELL_NORMAL, "- None\n");
}
#ifdef CONFIG_SMP
shell_fprintf(shell, SHELL_NORMAL, "SMP:\n");
ret = device_get_config_level(shell, INIT_LEVEL_SMP);
shell_fprintf(sh, SHELL_NORMAL, "SMP:\n");
ret = device_get_config_level(sh, INIT_LEVEL_SMP);
if (ret == false) {
shell_fprintf(shell, SHELL_NORMAL, "- None\n");
shell_fprintf(sh, SHELL_NORMAL, "- None\n");
}
#endif /* CONFIG_SMP */
@ -137,7 +137,7 @@ static int cmd_device_list_visitor(const struct device *dev,
return 0;
}
static int cmd_device_list(const struct shell *shell,
static int cmd_device_list(const struct shell *sh,
size_t argc, char **argv)
{
const struct device *devlist;
@ -147,14 +147,14 @@ static int cmd_device_list(const struct shell *shell,
ARG_UNUSED(argc);
ARG_UNUSED(argv);
shell_fprintf(shell, SHELL_NORMAL, "devices:\n");
shell_fprintf(sh, SHELL_NORMAL, "devices:\n");
for (dev = devlist; dev < devlist_end; dev++) {
char buf[20];
const char *name = get_device_name(dev, buf, sizeof(buf));
const char *state = "READY";
shell_fprintf(shell, SHELL_NORMAL, "- %s", name);
shell_fprintf(sh, SHELL_NORMAL, "- %s", name);
if (!device_is_ready(dev)) {
state = "DISABLED";
} else {
@ -168,10 +168,10 @@ static int cmd_device_list(const struct shell *shell,
#endif /* CONFIG_PM_DEVICE */
}
shell_fprintf(shell, SHELL_NORMAL, " (%s)\n", state);
shell_fprintf(sh, SHELL_NORMAL, " (%s)\n", state);
if (!k_is_user_context()) {
struct cmd_device_list_visitor_context ctx = {
.shell = shell,
.shell = sh,
.buf = buf,
.buf_size = sizeof(buf),
};