summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-11-08 18:33:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-11-08 18:34:23 +0100
commitee69c588417972185a1a2d72aa553410493791c2 (patch)
tree5f570ace0546f0302bb63242620544e75f3e28f4 /drivers/clk/clk.c
parent9549b10a7ec8a20ccc0177d7b5c5f03c902793c5 (diff)
downloadbarebox-ee69c588417972185a1a2d72aa553410493791c2.tar.gz
barebox-ee69c588417972185a1a2d72aa553410493791c2.tar.xz
clk: add clock command completion
This adds tab completion for the clk_* commands. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 630a84d585..15e424db1b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -17,6 +17,8 @@
#include <common.h>
#include <errno.h>
#include <malloc.h>
+#include <stringlist.h>
+#include <complete.h>
#include <linux/clk.h>
#include <linux/err.h>
@@ -508,3 +510,23 @@ void clk_dump(int verbose)
dump_one(c, verbose, 0);
}
}
+
+int clk_name_complete(struct string_list *sl, char *instr)
+{
+ struct clk *c;
+ int len;
+
+ if (!instr)
+ instr = "";
+
+ len = strlen(instr);
+
+ list_for_each_entry(c, &clks, list) {
+ if (strncmp(instr, c->name, len))
+ continue;
+
+ string_list_add_asprintf(sl, "%s ", c->name);
+ }
+
+ return COMPLETE_CONTINUE;
+}