Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c355863 authored by Joe Perches's avatar Joe Perches Committed by Ingo Molnar
Browse files

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: default avatarJoe Perches <joe@perches.com>
LKML-Reference: <3bb66cc7f85f77b9416902e1be7076f7e3f4ad48.1254701151.git.joe@perches.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3bb258bf
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
/*
 * Written by Pekka Paalanen, 2008-2009 <pq@iki.fi>
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/io.h>
#include <linux/mmiotrace.h>

#define MODULE_NAME "testmmiotrace"

static unsigned long mmio_address;
module_param(mmio_address, ulong, 0);
MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB "
@@ -30,7 +31,7 @@ static unsigned v32(unsigned i)
static void do_write_test(void __iomem *p)
{
	unsigned int i;
	pr_info(MODULE_NAME ": write test.\n");
	pr_info("write test.\n");
	mmiotrace_printk("Write test.\n");

	for (i = 0; i < 256; i++)
@@ -47,7 +48,7 @@ static void do_read_test(void __iomem *p)
{
	unsigned int i;
	unsigned errs[3] = { 0 };
	pr_info(MODULE_NAME ": read test.\n");
	pr_info("read test.\n");
	mmiotrace_printk("Read test.\n");

	for (i = 0; i < 256; i++)
@@ -68,7 +69,7 @@ static void do_read_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");

	ioread32(p + read_far);
@@ -78,7 +79,7 @@ static void do_test(unsigned long size)
{
	void __iomem *p = ioremap_nocache(mmio_address, size);
	if (!p) {
		pr_err(MODULE_NAME ": could not ioremap, aborting.\n");
		pr_err("could not ioremap, aborting.\n");
		return;
	}
	mmiotrace_printk("ioremap returned %p.\n", p);
@@ -94,24 +95,22 @@ static int __init init(void)
	unsigned long size = (read_far) ? (8 << 20) : (16 << 10);

	if (mmio_address == 0) {
		pr_err(MODULE_NAME ": you have to use the module argument "
							"mmio_address.\n");
		pr_err(MODULE_NAME ": DO NOT LOAD THIS MODULE UNLESS"
				" YOU REALLY KNOW WHAT YOU ARE DOING!\n");
		pr_err("you have to use the module argument mmio_address.\n");
		pr_err("DO NOT LOAD THIS MODULE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!\n");
		return -ENXIO;
	}

	pr_warning(MODULE_NAME ": WARNING: mapping %lu kB @ 0x%08lx in PCI "
		"address space, and writing 16 kB of rubbish in there.\n",
	pr_warning("WARNING: mapping %lu kB @ 0x%08lx in PCI address space, "
		   "and writing 16 kB of rubbish in there.\n",
		   size >> 10, mmio_address);
	do_test(size);
	pr_info(MODULE_NAME ": All done.\n");
	pr_info("All done.\n");
	return 0;
}

static void __exit cleanup(void)
{
	pr_debug(MODULE_NAME ": unloaded.\n");
	pr_debug("unloaded.\n");
}

module_init(init);