]> Git Repo - linux.git/blobdiff - lib/dynamic_debug.c
ALSA: uapi: use C90 comment style instead of C99 style
[linux.git] / lib / dynamic_debug.c
index 87b1b0121234f5839988013a2a7fecde25839f13..dd7f56af9aed364b70b16ca51fe9377a229d3dcc 100644 (file)
@@ -71,6 +71,8 @@ static DEFINE_MUTEX(ddebug_lock);
 static LIST_HEAD(ddebug_tables);
 static int verbose;
 module_param(verbose, int, 0644);
+MODULE_PARM_DESC(verbose, " dynamic_debug/control processing "
+                "( 0 = off (default), 1 = module add/rm, 2 = >control summary, 3 = parsing, 4 = per-site changes)");
 
 /* Return the path relative to source root */
 static inline const char *trim_prefix(const char *path)
@@ -118,6 +120,8 @@ do {                                                                \
 
 #define vpr_info(fmt, ...)     vnpr_info(1, fmt, ##__VA_ARGS__)
 #define v2pr_info(fmt, ...)    vnpr_info(2, fmt, ##__VA_ARGS__)
+#define v3pr_info(fmt, ...)    vnpr_info(3, fmt, ##__VA_ARGS__)
+#define v4pr_info(fmt, ...)    vnpr_info(4, fmt, ##__VA_ARGS__)
 
 static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
 {
@@ -130,7 +134,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
                        fmtlen--;
        }
 
-       vpr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n",
+       v3pr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n",
                 msg,
                 query->function ?: "",
                 query->filename ?: "",
@@ -213,7 +217,7 @@ static int ddebug_change(const struct ddebug_query *query,
                                static_branch_enable(&dp->key.dd_key_true);
 #endif
                        dp->flags = newflags;
-                       v2pr_info("changed %s:%d [%s]%s =%s\n",
+                       v4pr_info("changed %s:%d [%s]%s =%s\n",
                                 trim_prefix(dp->filename), dp->lineno,
                                 dt->mod_name, dp->function,
                                 ddebug_describe_flags(dp->flags, &fbuf));
@@ -273,7 +277,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
                buf = end;
        }
 
-       if (verbose) {
+       if (verbose >= 3) {
                int i;
                pr_info("split into words:");
                for (i = 0; i < nwords; i++)
@@ -333,7 +337,7 @@ static int parse_linerange(struct ddebug_query *query, const char *first)
        } else {
                query->last_lineno = query->first_lineno;
        }
-       vpr_info("parsed line %d-%d\n", query->first_lineno,
+       v3pr_info("parsed line %d-%d\n", query->first_lineno,
                 query->last_lineno);
        return 0;
 }
@@ -447,7 +451,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
                pr_err("bad flag-op %c, at start of %s\n", *str, str);
                return -EINVAL;
        }
-       vpr_info("op='%c'\n", op);
+       v3pr_info("op='%c'\n", op);
 
        for (; *str ; ++str) {
                for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
@@ -461,7 +465,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
                        return -EINVAL;
                }
        }
-       vpr_info("flags=0x%x\n", modifiers->flags);
+       v3pr_info("flags=0x%x\n", modifiers->flags);
 
        /* calculate final flags, mask based upon op */
        switch (op) {
@@ -477,7 +481,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
                modifiers->flags = 0;
                break;
        }
-       vpr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask);
+       v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask);
 
        return 0;
 }
@@ -540,9 +544,8 @@ static int ddebug_exec_queries(char *query, const char *modname)
                }
                i++;
        }
-
        if (i)
-               vpr_info("processed %d queries, with %d matches, %d errs\n",
+               v2pr_info("processed %d queries, with %d matches, %d errs\n",
                         i, nfound, errs);
 
        if (exitcode)
@@ -780,7 +783,7 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
        tmpbuf = memdup_user_nul(ubuf, len);
        if (IS_ERR(tmpbuf))
                return PTR_ERR(tmpbuf);
-       vpr_info("read %d bytes from userspace\n", (int)len);
+       v2pr_info("read %zu bytes from userspace\n", len);
 
        ret = ddebug_exec_queries(tmpbuf, NULL);
        kfree(tmpbuf);
@@ -968,7 +971,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
        list_add(&dt->link, &ddebug_tables);
        mutex_unlock(&ddebug_lock);
 
-       v2pr_info("%3u debug prints in module %s\n", n, dt->mod_name);
+       vpr_info("%3u debug prints in module %s\n", n, dt->mod_name);
        return 0;
 }
 
This page took 0.03334 seconds and 4 git commands to generate.