From patchwork Tue Oct 2 14:32:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikram Narayanan X-Patchwork-Id: 188534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (unknown [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 91C312C00AB for ; Wed, 3 Oct 2012 00:37:38 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJ3WD-0001Xe-PT; Tue, 02 Oct 2012 14:32:17 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TJ3W9-0001Rz-OO for linux-mtd@lists.infradead.org; Tue, 02 Oct 2012 14:32:14 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so5717913pad.36 for ; Tue, 02 Oct 2012 07:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=8+7rSOLX9jcNpN9oOMA4Yuj2AEEWuqJv0Lo0lb+/paM=; b=RxKz0yvK5bMC2NfQf857/OdJf1FJZxWx0PcNn+a0xnBGvJKUZUx1ANvsdXB4FgidUZ WpoMz0kgbLRMfs0qZ71xrA71GJvXwRUV54IxDTQSVZf1tdKdoVSrLnIagU37ccae0LTS kD67hn7zpLg6wpK1v5uGYRxqte/DiohueneRPvKGC+TEbWumnpDHy60pdPfY9YquqvV8 P5kJ+N/xsOJG6UfdsF+Dja2ihfhAOTthXFwtzwXfnTDszzr4QVOC/Pi3jgZeFtRrNkXI 5edpGnoIQYuIJqhxVhOebbeUneFHuDCJXzvnwLRQYxGtxA2YsSJudOXYJ5fIAwryTk3c 6AhA== Received: by 10.66.84.229 with SMTP id c5mr15736983paz.76.1349188333412; Tue, 02 Oct 2012 07:32:13 -0700 (PDT) Received: from [115.242.227.86] ([115.242.227.86]) by mx.google.com with ESMTPS id ka4sm979832pbc.61.2012.10.02.07.32.07 (version=SSLv3 cipher=OTHER); Tue, 02 Oct 2012 07:32:12 -0700 (PDT) Message-ID: <506AFAE1.40809@gmail.com> Date: Tue, 02 Oct 2012 20:02:01 +0530 From: Vikram Narayanan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: linux-mtd@lists.infradead.org Subject: [PATCH 6/8] mtd_speedtest: Replace printk with pr_{info,crit} References: <506AF985.30104@gmail.com> In-Reply-To: <506AF985.30104@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (vikram186[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (vikram186[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Brian Norris , Adrian Hunter , Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Remove PRINT_PREF macro and use pr_fmt to add the prefix Signed-off-by: Vikram Narayanan --- drivers/mtd/tests/mtd_speedtest.c | 80 ++++++++++++++++++------------------ 1 files changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c index e3518b4..0ffa026 100644 --- a/drivers/mtd/tests/mtd_speedtest.c +++ b/drivers/mtd/tests/mtd_speedtest.c @@ -19,6 +19,8 @@ * Author: Adrian Hunter */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -29,8 +31,6 @@ #include #include "mtd_tests.h" -#define PRINT_PREF KERN_INFO "mtd_speedtest: " - static int dev = -EINVAL; module_param(dev, int, S_IRUGO); MODULE_PARM_DESC(dev, "MTD device number to use"); @@ -82,7 +82,7 @@ static int write_eraseblock(int ebnum) err = mtd_write(mtd, addr, mtd->erasesize, &written, iobuf); if (err || written != mtd->erasesize) { - printk(PRINT_PREF "error: write failed at %#llx\n", addr); + pr_info("error: write failed at %#llx\n", addr); if (!err) err = -EINVAL; } @@ -100,7 +100,7 @@ static int write_eraseblock_by_page(int ebnum) for (i = 0; i < pgcnt; i++) { err = mtd_write(mtd, addr, pgsize, &written, buf); if (err || written != pgsize) { - printk(PRINT_PREF "error: write failed at %#llx\n", + pr_info("error: write failed at %#llx\n", addr); if (!err) err = -EINVAL; @@ -123,7 +123,7 @@ static int write_eraseblock_by_2pages(int ebnum) for (i = 0; i < n; i++) { err = mtd_write(mtd, addr, sz, &written, buf); if (err || written != sz) { - printk(PRINT_PREF "error: write failed at %#llx\n", + pr_info("error: write failed at %#llx\n", addr); if (!err) err = -EINVAL; @@ -135,7 +135,7 @@ static int write_eraseblock_by_2pages(int ebnum) if (pgcnt % 2) { err = mtd_write(mtd, addr, pgsize, &written, buf); if (err || written != pgsize) { - printk(PRINT_PREF "error: write failed at %#llx\n", + pr_info("error: write failed at %#llx\n", addr); if (!err) err = -EINVAL; @@ -156,7 +156,7 @@ static int read_eraseblock(int ebnum) if (mtd_is_bitflip(err)) err = 0; if (err || read != mtd->erasesize) { - printk(PRINT_PREF "error: read failed at %#llx\n", addr); + pr_info("error: read failed at %#llx\n", addr); if (!err) err = -EINVAL; } @@ -177,7 +177,7 @@ static int read_eraseblock_by_page(int ebnum) if (mtd_is_bitflip(err)) err = 0; if (err || read != pgsize) { - printk(PRINT_PREF "error: read failed at %#llx\n", + pr_info("error: read failed at %#llx\n", addr); if (!err) err = -EINVAL; @@ -203,7 +203,7 @@ static int read_eraseblock_by_2pages(int ebnum) if (mtd_is_bitflip(err)) err = 0; if (err || read != sz) { - printk(PRINT_PREF "error: read failed at %#llx\n", + pr_info("error: read failed at %#llx\n", addr); if (!err) err = -EINVAL; @@ -218,7 +218,7 @@ static int read_eraseblock_by_2pages(int ebnum) if (mtd_is_bitflip(err)) err = 0; if (err || read != pgsize) { - printk(PRINT_PREF "error: read failed at %#llx\n", + pr_info("error: read failed at %#llx\n", addr); if (!err) err = -EINVAL; @@ -235,7 +235,7 @@ static int is_block_bad(int ebnum) ret = mtd_block_isbad(mtd, addr); if (ret) - printk(PRINT_PREF "block %d is bad\n", ebnum); + pr_info("block %d is bad\n", ebnum); return ret; } @@ -269,21 +269,21 @@ static int scan_for_bad_eraseblocks(void) bbt = kzalloc(ebcnt, GFP_KERNEL); if (!bbt) { - printk(PRINT_PREF "error: cannot allocate memory\n"); + pr_info("error: cannot allocate memory\n"); return -ENOMEM; } if (!mtd_can_have_bb(mtd)) goto out; - printk(PRINT_PREF "scanning for bad eraseblocks\n"); + pr_info("scanning for bad eraseblocks\n"); for (i = 0; i < ebcnt; ++i) { bbt[i] = is_block_bad(i) ? 1 : 0; if (bbt[i]) bad += 1; cond_resched(); } - printk(PRINT_PREF "scanned %d eraseblocks, %d are bad\n", i, bad); + pr_info("scanned %d eraseblocks, %d are bad\n", i, bad); out: goodebcnt = ebcnt - bad; return 0; @@ -299,25 +299,25 @@ static int __init mtd_speedtest_init(void) printk(KERN_INFO "=================================================\n"); if (dev < 0) { - printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n"); - printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n"); + pr_info("Please specify a valid mtd-device via module paramter\n"); + pr_crit("CAREFUL: This test wipes all data on the specified MTD device!\n"); return -EINVAL; } if (count) - printk(PRINT_PREF "MTD device: %d count: %d\n", dev, count); + pr_info("MTD device: %d count: %d\n", dev, count); else - printk(PRINT_PREF "MTD device: %d\n", dev); + pr_info("MTD device: %d\n", dev); mtd = get_mtd_device(NULL, dev); if (IS_ERR(mtd)) { err = PTR_ERR(mtd); - printk(PRINT_PREF "error: cannot get MTD device\n"); + pr_info("error: cannot get MTD device\n"); return err; } if (mtd->writesize == 1) { - printk(PRINT_PREF "not NAND flash, assume page size is 512 " + pr_info("not NAND flash, assume page size is 512 " "bytes.\n"); pgsize = 512; } else @@ -328,7 +328,7 @@ static int __init mtd_speedtest_init(void) ebcnt = tmp; pgcnt = mtd->erasesize / pgsize; - printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, " + pr_info("MTD device size %llu, eraseblock size %u, " "page size %u, count of eraseblocks %u, pages per " "eraseblock %u, OOB size %u\n", (unsigned long long)mtd->size, mtd->erasesize, @@ -340,7 +340,7 @@ static int __init mtd_speedtest_init(void) err = -ENOMEM; iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); if (!iobuf) { - printk(PRINT_PREF "error: cannot allocate memory\n"); + pr_info("error: cannot allocate memory\n"); goto out; } @@ -355,7 +355,7 @@ static int __init mtd_speedtest_init(void) goto out; /* Write all eraseblocks, 1 eraseblock at a time */ - printk(PRINT_PREF "testing eraseblock write speed\n"); + pr_info("testing eraseblock write speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -367,10 +367,10 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "eraseblock write speed is %ld KiB/s\n", speed); + pr_info("eraseblock write speed is %ld KiB/s\n", speed); /* Read all eraseblocks, 1 eraseblock at a time */ - printk(PRINT_PREF "testing eraseblock read speed\n"); + pr_info("testing eraseblock read speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -382,14 +382,14 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "eraseblock read speed is %ld KiB/s\n", speed); + pr_info("eraseblock read speed is %ld KiB/s\n", speed); err = erase_whole_device(); if (err) goto out; /* Write all eraseblocks, 1 page at a time */ - printk(PRINT_PREF "testing page write speed\n"); + pr_info("testing page write speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -401,10 +401,10 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "page write speed is %ld KiB/s\n", speed); + pr_info("page write speed is %ld KiB/s\n", speed); /* Read all eraseblocks, 1 page at a time */ - printk(PRINT_PREF "testing page read speed\n"); + pr_info("testing page read speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -416,14 +416,14 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "page read speed is %ld KiB/s\n", speed); + pr_info("page read speed is %ld KiB/s\n", speed); err = erase_whole_device(); if (err) goto out; /* Write all eraseblocks, 2 pages at a time */ - printk(PRINT_PREF "testing 2 page write speed\n"); + pr_info("testing 2 page write speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -435,10 +435,10 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "2 page write speed is %ld KiB/s\n", speed); + pr_info("2 page write speed is %ld KiB/s\n", speed); /* Read all eraseblocks, 2 pages at a time */ - printk(PRINT_PREF "testing 2 page read speed\n"); + pr_info("testing 2 page read speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -450,10 +450,10 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "2 page read speed is %ld KiB/s\n", speed); + pr_info("2 page read speed is %ld KiB/s\n", speed); /* Erase all eraseblocks */ - printk(PRINT_PREF "Testing erase speed\n"); + pr_info("Testing erase speed\n"); start_timing(); for (i = 0; i < ebcnt; ++i) { if (bbt[i]) @@ -465,12 +465,12 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "erase speed is %ld KiB/s\n", speed); + pr_info("erase speed is %ld KiB/s\n", speed); /* Multi-block erase all eraseblocks */ for (k = 1; k < 7; k++) { blocks = 1 << k; - printk(PRINT_PREF "Testing %dx multi-block erase speed\n", + pr_info("Testing %dx multi-block erase speed\n", blocks); start_timing(); for (i = 0; i < ebcnt; ) { @@ -489,16 +489,16 @@ static int __init mtd_speedtest_init(void) } stop_timing(); speed = calc_speed(); - printk(PRINT_PREF "%dx multi-block erase speed is %ld KiB/s\n", + pr_info("%dx multi-block erase speed is %ld KiB/s\n", blocks, speed); } - printk(PRINT_PREF "finished\n"); + pr_info("finished\n"); out: kfree(iobuf); kfree(bbt); put_mtd_device(mtd); if (err) - printk(PRINT_PREF "error %d occurred\n", err); + pr_info("error %d occurred\n", err); printk(KERN_INFO "=================================================\n"); return err; }