From de57d607323630fd6b9c9894ac9ae39d4f849a67 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 28 May 2020 11:25:39 -0400 Subject: [PATCH] pcie: shell: add subcommands pcie has an all in one command for listing pci devices. Make it support additional commands and move lspcie to `pcie ls`. Signed-off-by: Anas Nashif --- drivers/pcie/shell.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pcie/shell.c b/drivers/pcie/shell.c index 1ba3cc92cd2ec5..7b0d4e7cb717b1 100644 --- a/drivers/pcie/shell.c +++ b/drivers/pcie/shell.c @@ -103,7 +103,7 @@ static void show(const struct shell *shell, pcie_bdf_t bdf) } } -static int cmd_lspcie(const struct shell *shell, size_t argc, char **argv) +static int cmd_pcie_ls(const struct shell *shell, size_t argc, char **argv) { int bus; int dev; @@ -119,5 +119,11 @@ static int cmd_lspcie(const struct shell *shell, size_t argc, char **argv) return 0; } +SHELL_STATIC_SUBCMD_SET_CREATE(sub_pcie_cmds, + SHELL_CMD(ls, NULL, + "List PCIE devices", cmd_pcie_ls), + SHELL_SUBCMD_SET_END /* Array terminated. */ + ); -SHELL_CMD_REGISTER(lspcie, NULL, "List PCI(e) devices", cmd_lspcie); + +SHELL_CMD_REGISTER(pcie, &sub_pcie_cmds, "PCI(e) device information", cmd_pcie_ls);