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 <fabiobaltieri@google.com>
This commit is contained in:
parent
48e2f67869
commit
d5c773d373
|
@ -9,9 +9,14 @@
|
|||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/pm/device_runtime.h>
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue