From d5c773d37340ec7ef2af8d81d2e3987c0ca3bb68 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Sat, 27 Apr 2024 13:38:23 +0100 Subject: [PATCH] pm: shell: filter out non PM enabled devices Add a device lookup filter to only suggest devices that are PM enabled. Signed-off-by: Fabio Baltieri --- subsys/pm/pm_shell.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subsys/pm/pm_shell.c b/subsys/pm/pm_shell.c index e228e0b7e3..f656cf4426 100644 --- a/subsys/pm/pm_shell.c +++ b/subsys/pm/pm_shell.c @@ -9,9 +9,14 @@ #include #include +static bool pm_device_filter(const struct device *dev) +{ + return dev->pm != NULL; +} + static void device_name_get(size_t idx, struct shell_static_entry *entry) { - const struct device *dev = shell_device_lookup(idx, NULL); + const struct device *dev = shell_device_filter(idx, pm_device_filter); entry->syntax = (dev != NULL) ? dev->name : NULL; entry->handler = NULL;