]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "dyndbg: fix problem parsing format="foo bar""
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Sep 2020 16:42:38 +0000 (18:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Sep 2020 16:42:38 +0000 (18:42 +0200)
This reverts commit aa191dd35d4699401be794754f5542aeffa98dff as it
still causes problems.  It will be resolved later, let's revert it so we
can also revert the original patch this was supposed to be helping with.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Fixes: aa191dd35d46 ("dyndbg: fix problem parsing format="foo bar"")
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/dynamic_debug.c

index 04f4c80b0d16206a50288e71ac536480245a6f31..08e4b057514c9068342994697c04c88ccb839d5e 100644 (file)
@@ -237,7 +237,6 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
 {
        int nwords = 0;
 
-       vpr_info("entry, buf:'%s'\n", buf);
        while (*buf) {
                char *end;
 
@@ -248,8 +247,6 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
                if (*buf == '#')
                        break;  /* token starts comment, skip rest of line */
 
-               vpr_info("start-of-word:%d '%s'\n", nwords, buf);
-
                /* find `end' of word, whitespace separated or quoted */
                if (*buf == '"' || *buf == '\'') {
                        int quote = *buf++;
@@ -260,9 +257,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
                                return -EINVAL; /* unclosed quote */
                        }
                } else {
-                       for (end = buf;
-                            *end && *end != '=' && !isspace(*end);
-                            end++)
+                       for (end = buf; *end && !isspace(*end); end++)
                                ;
                        BUG_ON(end == buf);
                }
@@ -378,21 +373,30 @@ static int ddebug_parse_query(char *words[], int nwords,
        unsigned int i;
        int rc = 0;
        char *fline;
+       char *keyword, *arg;
 
-       if (nwords % 2 != 0) {
-               pr_err("expecting pairs of match-spec <value>\n");
-               return -EINVAL;
-       }
-       if (modname) {
+       if (modname)
                /* support $modname.dyndbg=<multiple queries> */
-               vpr_info("module:%s queries:'%s'\n", modname);
                query->module = modname;
-       }
-       for (i = 0; i < nwords; i += 2) {
-               char *keyword = words[i];
-               char *arg = words[i+1];
 
-               vpr_info("keyword:'%s' value:'%s'\n", keyword, arg);
+       for (i = 0; i < nwords; i++) {
+               /* accept keyword=arg */
+               vpr_info("%d w:%s\n", i, words[i]);
+
+               keyword = words[i];
+               arg = strchr(keyword, '=');
+               if (arg) {
+                       *arg++ = '\0';
+               } else {
+                       i++; /* next word is arg */
+                       if (!(i < nwords)) {
+                               pr_err("missing arg to keyword: %s\n", keyword);
+                               return -EINVAL;
+                       }
+                       arg = words[i];
+               }
+               vpr_info("%d key:%s arg:%s\n", i, keyword, arg);
+
                if (!strcmp(keyword, "func")) {
                        rc = check_set(&query->function, arg, "func");
                } else if (!strcmp(keyword, "file")) {