提交 3c355863 编写于 作者: J Joe Perches 提交者: Ingo Molnar

testmmiotrace.c: Add and use pr_fmt(fmt)

- Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt.
- Strip MODULE_NAME from pr_<level>s.
- Remove MODULE_NAME definition.
Signed-off-by: NJoe Perches <joe@perches.com>
LKML-Reference: <3bb66cc7f85f77b9416902e1be7076f7e3f4ad48.1254701151.git.joe@perches.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 3bb258bf
/* /*
* Written by Pekka Paalanen, 2008-2009 <pq@iki.fi> * Written by Pekka Paalanen, 2008-2009 <pq@iki.fi>
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/mmiotrace.h> #include <linux/mmiotrace.h>
#define MODULE_NAME "testmmiotrace"
static unsigned long mmio_address; static unsigned long mmio_address;
module_param(mmio_address, ulong, 0); module_param(mmio_address, ulong, 0);
MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB " MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB "
...@@ -30,7 +31,7 @@ static unsigned v32(unsigned i) ...@@ -30,7 +31,7 @@ static unsigned v32(unsigned i)
static void do_write_test(void __iomem *p) static void do_write_test(void __iomem *p)
{ {
unsigned int i; unsigned int i;
pr_info(MODULE_NAME ": write test.\n"); pr_info("write test.\n");
mmiotrace_printk("Write test.\n"); mmiotrace_printk("Write test.\n");
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
...@@ -47,7 +48,7 @@ static void do_read_test(void __iomem *p) ...@@ -47,7 +48,7 @@ static void do_read_test(void __iomem *p)
{ {
unsigned int i; unsigned int i;
unsigned errs[3] = { 0 }; unsigned errs[3] = { 0 };
pr_info(MODULE_NAME ": read test.\n"); pr_info("read test.\n");
mmiotrace_printk("Read test.\n"); mmiotrace_printk("Read test.\n");
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
...@@ -68,7 +69,7 @@ static void do_read_test(void __iomem *p) ...@@ -68,7 +69,7 @@ static void do_read_test(void __iomem *p)
static void do_read_far_test(void __iomem *p) static void do_read_far_test(void __iomem *p)
{ {
pr_info(MODULE_NAME ": read far test.\n"); pr_info("read far test.\n");
mmiotrace_printk("Read far test.\n"); mmiotrace_printk("Read far test.\n");
ioread32(p + read_far); ioread32(p + read_far);
...@@ -78,7 +79,7 @@ static void do_test(unsigned long size) ...@@ -78,7 +79,7 @@ static void do_test(unsigned long size)
{ {
void __iomem *p = ioremap_nocache(mmio_address, size); void __iomem *p = ioremap_nocache(mmio_address, size);
if (!p) { if (!p) {
pr_err(MODULE_NAME ": could not ioremap, aborting.\n"); pr_err("could not ioremap, aborting.\n");
return; return;
} }
mmiotrace_printk("ioremap returned %p.\n", p); mmiotrace_printk("ioremap returned %p.\n", p);
...@@ -94,24 +95,22 @@ static int __init init(void) ...@@ -94,24 +95,22 @@ static int __init init(void)
unsigned long size = (read_far) ? (8 << 20) : (16 << 10); unsigned long size = (read_far) ? (8 << 20) : (16 << 10);
if (mmio_address == 0) { if (mmio_address == 0) {
pr_err(MODULE_NAME ": you have to use the module argument " pr_err("you have to use the module argument mmio_address.\n");
"mmio_address.\n"); pr_err("DO NOT LOAD THIS MODULE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!\n");
pr_err(MODULE_NAME ": DO NOT LOAD THIS MODULE UNLESS"
" YOU REALLY KNOW WHAT YOU ARE DOING!\n");
return -ENXIO; return -ENXIO;
} }
pr_warning(MODULE_NAME ": WARNING: mapping %lu kB @ 0x%08lx in PCI " pr_warning("WARNING: mapping %lu kB @ 0x%08lx in PCI address space, "
"address space, and writing 16 kB of rubbish in there.\n", "and writing 16 kB of rubbish in there.\n",
size >> 10, mmio_address); size >> 10, mmio_address);
do_test(size); do_test(size);
pr_info(MODULE_NAME ": All done.\n"); pr_info("All done.\n");
return 0; return 0;
} }
static void __exit cleanup(void) static void __exit cleanup(void)
{ {
pr_debug(MODULE_NAME ": unloaded.\n"); pr_debug("unloaded.\n");
} }
module_init(init); module_init(init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册