aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorVikram Narayanan <vikram186@gmail.com>2012-10-10 13:38:01 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-15 08:37:49 -0500
commite45048a6a232de1dc6978f2f4df6369beafa79c0 (patch)
tree9d41ec65906231cdff4c0665461425a2495f63e8 /drivers/mtd
parentbb9984191ef9ba18a80d96c07919b782bdb65278 (diff)
mtd: tests: mtd_readtest: Replace printk with pr_{info,err}
Use pr_fmt instead of PRINT_PREF macro Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/tests/mtd_readtest.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
index 121aba189cec..ec3efb53826c 100644
--- a/drivers/mtd/tests/mtd_readtest.c
+++ b/drivers/mtd/tests/mtd_readtest.c
@@ -19,6 +19,8 @@
19 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com> 19 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com>
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/init.h> 24#include <linux/init.h>
23#include <linux/module.h> 25#include <linux/module.h>
24#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
@@ -27,8 +29,6 @@
27#include <linux/slab.h> 29#include <linux/slab.h>
28#include <linux/sched.h> 30#include <linux/sched.h>
29 31
30#define PRINT_PREF KERN_INFO "mtd_readtest: "
31
32static int dev = -EINVAL; 32static int dev = -EINVAL;
33module_param(dev, int, S_IRUGO); 33module_param(dev, int, S_IRUGO);
34MODULE_PARM_DESC(dev, "MTD device number to use"); 34MODULE_PARM_DESC(dev, "MTD device number to use");
@@ -56,7 +56,7 @@ static int read_eraseblock_by_page(int ebnum)
56 if (ret == -EUCLEAN) 56 if (ret == -EUCLEAN)
57 ret = 0; 57 ret = 0;
58 if (ret || read != pgsize) { 58 if (ret || read != pgsize) {
59 printk(PRINT_PREF "error: read failed at %#llx\n", 59 pr_err("error: read failed at %#llx\n",
60 (long long)addr); 60 (long long)addr);
61 if (!err) 61 if (!err)
62 err = ret; 62 err = ret;
@@ -77,7 +77,7 @@ static int read_eraseblock_by_page(int ebnum)
77 ret = mtd_read_oob(mtd, addr, &ops); 77 ret = mtd_read_oob(mtd, addr, &ops);
78 if ((ret && !mtd_is_bitflip(ret)) || 78 if ((ret && !mtd_is_bitflip(ret)) ||
79 ops.oobretlen != mtd->oobsize) { 79 ops.oobretlen != mtd->oobsize) {
80 printk(PRINT_PREF "error: read oob failed at " 80 pr_err("error: read oob failed at "
81 "%#llx\n", (long long)addr); 81 "%#llx\n", (long long)addr);
82 if (!err) 82 if (!err)
83 err = ret; 83 err = ret;
@@ -99,7 +99,7 @@ static void dump_eraseblock(int ebnum)
99 char line[128]; 99 char line[128];
100 int pg, oob; 100 int pg, oob;
101 101
102 printk(PRINT_PREF "dumping eraseblock %d\n", ebnum); 102 pr_info("dumping eraseblock %d\n", ebnum);
103 n = mtd->erasesize; 103 n = mtd->erasesize;
104 for (i = 0; i < n;) { 104 for (i = 0; i < n;) {
105 char *p = line; 105 char *p = line;
@@ -112,7 +112,7 @@ static void dump_eraseblock(int ebnum)
112 } 112 }
113 if (!mtd->oobsize) 113 if (!mtd->oobsize)
114 return; 114 return;
115 printk(PRINT_PREF "dumping oob from eraseblock %d\n", ebnum); 115 pr_info("dumping oob from eraseblock %d\n", ebnum);
116 n = mtd->oobsize; 116 n = mtd->oobsize;
117 for (pg = 0, i = 0; pg < pgcnt; pg++) 117 for (pg = 0, i = 0; pg < pgcnt; pg++)
118 for (oob = 0; oob < n;) { 118 for (oob = 0; oob < n;) {
@@ -134,7 +134,7 @@ static int is_block_bad(int ebnum)
134 134
135 ret = mtd_block_isbad(mtd, addr); 135 ret = mtd_block_isbad(mtd, addr);
136 if (ret) 136 if (ret)
137 printk(PRINT_PREF "block %d is bad\n", ebnum); 137 pr_info("block %d is bad\n", ebnum);
138 return ret; 138 return ret;
139} 139}
140 140
@@ -144,21 +144,21 @@ static int scan_for_bad_eraseblocks(void)
144 144
145 bbt = kzalloc(ebcnt, GFP_KERNEL); 145 bbt = kzalloc(ebcnt, GFP_KERNEL);
146 if (!bbt) { 146 if (!bbt) {
147 printk(PRINT_PREF "error: cannot allocate memory\n"); 147 pr_err("error: cannot allocate memory\n");
148 return -ENOMEM; 148 return -ENOMEM;
149 } 149 }
150 150
151 if (!mtd_can_have_bb(mtd)) 151 if (!mtd_can_have_bb(mtd))
152 return 0; 152 return 0;
153 153
154 printk(PRINT_PREF "scanning for bad eraseblocks\n"); 154 pr_info("scanning for bad eraseblocks\n");
155 for (i = 0; i < ebcnt; ++i) { 155 for (i = 0; i < ebcnt; ++i) {
156 bbt[i] = is_block_bad(i) ? 1 : 0; 156 bbt[i] = is_block_bad(i) ? 1 : 0;
157 if (bbt[i]) 157 if (bbt[i])
158 bad += 1; 158 bad += 1;
159 cond_resched(); 159 cond_resched();
160 } 160 }
161 printk(PRINT_PREF "scanned %d eraseblocks, %d are bad\n", i, bad); 161 pr_info("scanned %d eraseblocks, %d are bad\n", i, bad);
162 return 0; 162 return 0;
163} 163}
164 164
@@ -171,21 +171,21 @@ static int __init mtd_readtest_init(void)
171 printk(KERN_INFO "=================================================\n"); 171 printk(KERN_INFO "=================================================\n");
172 172
173 if (dev < 0) { 173 if (dev < 0) {
174 printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n"); 174 pr_info("Please specify a valid mtd-device via module paramter\n");
175 return -EINVAL; 175 return -EINVAL;
176 } 176 }
177 177
178 printk(PRINT_PREF "MTD device: %d\n", dev); 178 pr_info("MTD device: %d\n", dev);
179 179
180 mtd = get_mtd_device(NULL, dev); 180 mtd = get_mtd_device(NULL, dev);
181 if (IS_ERR(mtd)) { 181 if (IS_ERR(mtd)) {
182 err = PTR_ERR(mtd); 182 err = PTR_ERR(mtd);
183 printk(PRINT_PREF "error: Cannot get MTD device\n"); 183 pr_err("error: Cannot get MTD device\n");
184 return err; 184 return err;
185 } 185 }
186 186
187 if (mtd->writesize == 1) { 187 if (mtd->writesize == 1) {
188 printk(PRINT_PREF "not NAND flash, assume page size is 512 " 188 pr_info("not NAND flash, assume page size is 512 "
189 "bytes.\n"); 189 "bytes.\n");
190 pgsize = 512; 190 pgsize = 512;
191 } else 191 } else
@@ -196,7 +196,7 @@ static int __init mtd_readtest_init(void)
196 ebcnt = tmp; 196 ebcnt = tmp;
197 pgcnt = mtd->erasesize / pgsize; 197 pgcnt = mtd->erasesize / pgsize;
198 198
199 printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, " 199 pr_info("MTD device size %llu, eraseblock size %u, "
200 "page size %u, count of eraseblocks %u, pages per " 200 "page size %u, count of eraseblocks %u, pages per "
201 "eraseblock %u, OOB size %u\n", 201 "eraseblock %u, OOB size %u\n",
202 (unsigned long long)mtd->size, mtd->erasesize, 202 (unsigned long long)mtd->size, mtd->erasesize,
@@ -205,12 +205,12 @@ static int __init mtd_readtest_init(void)
205 err = -ENOMEM; 205 err = -ENOMEM;
206 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); 206 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
207 if (!iobuf) { 207 if (!iobuf) {
208 printk(PRINT_PREF "error: cannot allocate memory\n"); 208 pr_err("error: cannot allocate memory\n");
209 goto out; 209 goto out;
210 } 210 }
211 iobuf1 = kmalloc(mtd->erasesize, GFP_KERNEL); 211 iobuf1 = kmalloc(mtd->erasesize, GFP_KERNEL);
212 if (!iobuf1) { 212 if (!iobuf1) {
213 printk(PRINT_PREF "error: cannot allocate memory\n"); 213 pr_err("error: cannot allocate memory\n");
214 goto out; 214 goto out;
215 } 215 }
216 216
@@ -219,7 +219,7 @@ static int __init mtd_readtest_init(void)
219 goto out; 219 goto out;
220 220
221 /* Read all eraseblocks 1 page at a time */ 221 /* Read all eraseblocks 1 page at a time */
222 printk(PRINT_PREF "testing page read\n"); 222 pr_info("testing page read\n");
223 for (i = 0; i < ebcnt; ++i) { 223 for (i = 0; i < ebcnt; ++i) {
224 int ret; 224 int ret;
225 225
@@ -235,9 +235,9 @@ static int __init mtd_readtest_init(void)
235 } 235 }
236 236
237 if (err) 237 if (err)
238 printk(PRINT_PREF "finished with errors\n"); 238 pr_info("finished with errors\n");
239 else 239 else
240 printk(PRINT_PREF "finished\n"); 240 pr_info("finished\n");
241 241
242out: 242out:
243 243
@@ -246,7 +246,7 @@ out:
246 kfree(bbt); 246 kfree(bbt);
247 put_mtd_device(mtd); 247 put_mtd_device(mtd);
248 if (err) 248 if (err)
249 printk(PRINT_PREF "error %d occurred\n", err); 249 pr_info("error %d occurred\n", err);
250 printk(KERN_INFO "=================================================\n"); 250 printk(KERN_INFO "=================================================\n");
251 return err; 251 return err;
252} 252}