* Copyright (C) 2011 Bart Van Assche.  All Rights Reserved.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
                        else
                                dp->enabled = 0;
                        if (verbose)
-                               printk(KERN_INFO
-                                       "ddebug: changed %s:%d [%s]%s %s\n",
+                               pr_info("changed %s:%d [%s]%s %s\n",
                                        dp->filename, dp->lineno,
                                        dt->mod_name, dp->function,
                                        ddebug_describe_flags(dp, flagbuf,
        mutex_unlock(&ddebug_lock);
 
        if (!nfound && verbose)
-               printk(KERN_INFO "ddebug: no matches for query\n");
+               pr_info("no matches for query\n");
 }
 
 /*
 
        if (verbose) {
                int i;
-               printk(KERN_INFO "%s: split into words:", __func__);
+               pr_info("split into words:");
                for (i = 0 ; i < nwords ; i++)
-                       printk(" \"%s\"", words[i]);
-               printk("\n");
+                       pr_cont(" \"%s\"", words[i]);
+               pr_cont("\n");
        }
 
        return nwords;
                        }
                } else {
                        if (verbose)
-                               printk(KERN_ERR "%s: unknown keyword \"%s\"\n",
-                                       __func__, words[i]);
+                               pr_err("unknown keyword \"%s\"\n", words[i]);
                        return -EINVAL;
                }
        }
 
        if (verbose)
-               printk(KERN_INFO "%s: q->function=\"%s\" q->filename=\"%s\" "
-                      "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n",
-                       __func__, query->function, query->filename,
+               pr_info("q->function=\"%s\" q->filename=\"%s\" "
+                       "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n",
+                       query->function, query->filename,
                        query->module, query->format, query->first_lineno,
                        query->last_lineno);
 
                return -EINVAL;
        }
        if (verbose)
-               printk(KERN_INFO "%s: op='%c'\n", __func__, op);
+               pr_info("op='%c'\n", op);
 
        for ( ; *str ; ++str) {
                for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
        if (flags == 0)
                return -EINVAL;
        if (verbose)
-               printk(KERN_INFO "%s: flags=0x%x\n", __func__, flags);
+               pr_info("flags=0x%x\n", flags);
 
        /* calculate final *flagsp, *maskp according to mask and op */
        switch (op) {
                break;
        }
        if (verbose)
-               printk(KERN_INFO "%s: *flagsp=0x%x *maskp=0x%x\n",
-                       __func__, *flagsp, *maskp);
+               pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp);
        return 0;
 }
 
 static __init int ddebug_setup_query(char *str)
 {
        if (strlen(str) >= 1024) {
-               pr_warning("ddebug boot param string too large\n");
+               pr_warn("ddebug boot param string too large\n");
                return 0;
        }
        strcpy(ddebug_setup_string, str);
                return -EFAULT;
        tmpbuf[len] = '\0';
        if (verbose)
-               printk(KERN_INFO "%s: read %d bytes from userspace\n",
-                       __func__, (int)len);
+               pr_info("read %d bytes from userspace\n", (int)len);
 
        ret = ddebug_exec_query(tmpbuf);
        if (ret)
        int n = *pos;
 
        if (verbose)
-               printk(KERN_INFO "%s: called m=%p *pos=%lld\n",
-                       __func__, m, (unsigned long long)*pos);
+               pr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos);
 
        mutex_lock(&ddebug_lock);
 
        struct _ddebug *dp;
 
        if (verbose)
-               printk(KERN_INFO "%s: called m=%p p=%p *pos=%lld\n",
-                       __func__, m, p, (unsigned long long)*pos);
+               pr_info("called m=%p p=%p *pos=%lld\n",
+                       m, p, (unsigned long long)*pos);
 
        if (p == SEQ_START_TOKEN)
                dp = ddebug_iter_first(iter);
        char flagsbuf[8];
 
        if (verbose)
-               printk(KERN_INFO "%s: called m=%p p=%p\n",
-                       __func__, m, p);
+               pr_info("called m=%p p=%p\n", m, p);
 
        if (p == SEQ_START_TOKEN) {
                seq_puts(m,
 static void ddebug_proc_stop(struct seq_file *m, void *p)
 {
        if (verbose)
-               printk(KERN_INFO "%s: called m=%p p=%p\n",
-                       __func__, m, p);
+               pr_info("called m=%p p=%p\n", m, p);
        mutex_unlock(&ddebug_lock);
 }
 
        int err;
 
        if (verbose)
-               printk(KERN_INFO "%s: called\n", __func__);
+               pr_info("called\n");
 
        iter = kzalloc(sizeof(*iter), GFP_KERNEL);
        if (iter == NULL)
        mutex_unlock(&ddebug_lock);
 
        if (verbose)
-               printk(KERN_INFO "%u debug prints in module %s\n",
-                                n, dt->mod_name);
+               pr_info("%u debug prints in module %s\n", n, dt->mod_name);
        return 0;
 }
 EXPORT_SYMBOL_GPL(ddebug_add_module);
        int ret = -ENOENT;
 
        if (verbose)
-               printk(KERN_INFO "%s: removing module \"%s\"\n",
-                               __func__, mod_name);
+               pr_info("removing module \"%s\"\n", mod_name);
 
        mutex_lock(&ddebug_lock);
        list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
        if (ddebug_setup_string[0] != '\0') {
                ret = ddebug_exec_query(ddebug_setup_string);
                if (ret)
-                       pr_warning("Invalid ddebug boot param %s",
-                                  ddebug_setup_string);
+                       pr_warn("Invalid ddebug boot param %s",
+                               ddebug_setup_string);
                else
                        pr_info("ddebug initialized with string %s",
                                ddebug_setup_string);