summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-06-19 05:45:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-21 08:04:36 +0200
commit67fe96cb1d7b5ff6aa95aa285b822dfc31cc437a (patch)
treef90ab958f86a10810e42e1d53bbb43534adffc74 /drivers
parenta9ae0a6ade712652a6b3ef7e2f5245721b211365 (diff)
downloadbarebox-67fe96cb1d7b5ff6aa95aa285b822dfc31cc437a.tar.gz
barebox-67fe96cb1d7b5ff6aa95aa285b822dfc31cc437a.tar.xz
nvmem: add command to list nvmem devices
When doing development around nvmem devices, it can be useful to list which ones exist. Add a command to facilitate this. It can be extended in future as the need arises (e.g.export cells into the environment?). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvmem/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index c060e627db..ae9c965c25 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -49,6 +49,15 @@ struct nvmem_cell {
static LIST_HEAD(nvmem_cells);
static LIST_HEAD(nvmem_devs);
+void nvmem_devices_print(void)
+{
+ struct nvmem_device *dev;
+
+ list_for_each_entry(dev, &nvmem_devs, node) {
+ printf("%s\n", dev_name(&dev->dev));
+ }
+}
+
static ssize_t nvmem_cdev_read(struct cdev *cdev, void *buf, size_t count,
loff_t offset, unsigned long flags)
{