Commit 324588ec authored by Tina Johnson's avatar Tina Johnson Committed by Greg Kroah-Hartman

staging: lustre: lustre: libcfs: Replaced printk() with pr_err() and pr_cont()

The following checkpatch warning was fixed:

Prefer [subsystem eg: netdev]_err([subsystem]dev

with the help of Coccinelle. pr_cont() was used to replace those printk
statements which followed a printk that did not end with a '\n'. The following
semantic patch was used to replace printk() with pr_err():

@A@
expression e;
@@

printk(e,...);

@script:python b@
e << a.e;
y;
@@

import re
match = re.match('KERN_ERR ', e);
if (match == None):
    cocci.include_match(False)

else:
    m = re.sub('KERN_ERR ', '', e)
    coccinelle.y = m;

@c@
expression a.e;
identifier b.y;
@@

- printk(e,
+ pr_err(y,
  ...);
Signed-off-by: default avatarTina Johnson <tinajohnson.1234@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 85b7a9de
...@@ -224,8 +224,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, ...@@ -224,8 +224,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd,
*/ */
if (len > PAGE_CACHE_SIZE) { if (len > PAGE_CACHE_SIZE) {
printk(KERN_ERR pr_err("cowardly refusing to write %lu bytes in a page\n", len);
"cowardly refusing to write %lu bytes in a page\n", len);
return NULL; return NULL;
} }
...@@ -688,8 +687,8 @@ int cfs_tracefile_dump_all_pages(char *filename) ...@@ -688,8 +687,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
if (IS_ERR(filp)) { if (IS_ERR(filp)) {
rc = PTR_ERR(filp); rc = PTR_ERR(filp);
filp = NULL; filp = NULL;
printk(KERN_ERR "LustreError: can't open %s for dump: rc %d\n", pr_err("LustreError: can't open %s for dump: rc %d\n",
filename, rc); filename, rc);
goto out; goto out;
} }
...@@ -726,7 +725,7 @@ int cfs_tracefile_dump_all_pages(char *filename) ...@@ -726,7 +725,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
MMSPACE_CLOSE; MMSPACE_CLOSE;
rc = vfs_fsync(filp, 1); rc = vfs_fsync(filp, 1);
if (rc) if (rc)
printk(KERN_ERR "sync returns %d\n", rc); pr_err("sync returns %d\n", rc);
close: close:
filp_close(filp, NULL); filp_close(filp, NULL);
out: out:
...@@ -1048,22 +1047,21 @@ static int tracefiled(void *arg) ...@@ -1048,22 +1047,21 @@ static int tracefiled(void *arg)
int i; int i;
printk(KERN_ALERT "Lustre: trace pages aren't empty\n"); printk(KERN_ALERT "Lustre: trace pages aren't empty\n");
printk(KERN_ERR "total cpus(%d): ", pr_err("total cpus(%d): ",
num_possible_cpus()); num_possible_cpus());
for (i = 0; i < num_possible_cpus(); i++) for (i = 0; i < num_possible_cpus(); i++)
if (cpu_online(i)) if (cpu_online(i))
printk(KERN_ERR "%d(on) ", i); pr_cont("%d(on) ", i);
else else
printk(KERN_ERR "%d(off) ", i); pr_cont("%d(off) ", i);
printk(KERN_ERR "\n"); pr_cont("\n");
i = 0; i = 0;
list_for_each_entry_safe(tage, tmp, &pc.pc_pages, list_for_each_entry_safe(tage, tmp, &pc.pc_pages,
linkage) linkage)
printk(KERN_ERR "page %d belongs to cpu %d\n", pr_err("page %d belongs to cpu %d\n",
++i, tage->cpu); ++i, tage->cpu);
printk(KERN_ERR "There are %d pages unwritten\n", pr_err("There are %d pages unwritten\n", i);
i);
} }
__LASSERT(list_empty(&pc.pc_pages)); __LASSERT(list_empty(&pc.pc_pages));
end_loop: end_loop:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment