summaryrefslogtreecommitdiffstats
path: root/commands/drvinfo.c
diff options
context:
space:
mode:
authorHolger Schurig <holgerschurig@gmail.com>2014-05-30 11:07:27 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-06-02 09:06:45 +0200
commitc19c0da71caaeb2dc6f53e7d53d9ebad24e46c09 (patch)
tree98d246535fea8aecddf511b732af485a2733234e /commands/drvinfo.c
parent4d1ebec9dac6b8b6b10fc1b3ce1a899df1fca1a1 (diff)
downloadbarebox-c19c0da71caaeb2dc6f53e7d53d9ebad24e46c09.tar.gz
drvlist: factor the driver list out of 'devinfo'
The command 'devinfo' was first spitting out all devices, and then also all drivers. This patch separates them into two commands, 'devinfo' as before, and also the new command 'drvinfo' Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/drvinfo.c')
-rw-r--r--commands/drvinfo.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/commands/drvinfo.c b/commands/drvinfo.c
new file mode 100644
index 0000000..161118a
--- /dev/null
+++ b/commands/drvinfo.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 Sascha Hauer, Pengutronix
+ * Copyright (C) 2014 Holger Schurig
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <command.h>
+#include <driver.h>
+
+int do_drvinfo(int argc, char *argv[])
+{
+ struct driver_d *drv;
+ struct device_d *dev;
+
+ printf("Driver\tDevice(s)\n");
+ printf("--------------------\n");
+ for_each_driver(drv) {
+ printf("%s\n",drv->name);
+ for_each_device(dev) {
+ if (dev->driver == drv)
+ printf("\t%s\n", dev_name(dev));
+ }
+ }
+
+ if (IS_ENABLED(CONFIG_CMD_DEVINFO))
+ printf("\nUse 'devinfo DEVICE' for more information\n");
+
+ return 0;
+}
+
+
+BAREBOX_CMD_START(drvinfo)
+ .cmd = do_drvinfo,
+ BAREBOX_CMD_DESC("list compiled-in device drivers")
+ BAREBOX_CMD_GROUP(CMD_GRP_INFO)
+BAREBOX_CMD_END