| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2006-2008 Nokia Corporation |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 5 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 6 | | - * the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 11 | | - * more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 14 | | - * this program; see the file COPYING. If not, write to the Free Software |
|---|
| 15 | | - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 16 | 4 | * |
|---|
| 17 | 5 | * Check MTD device read. |
|---|
| 18 | 6 | * |
|---|
| .. | .. |
|---|
| 34 | 22 | static int dev = -EINVAL; |
|---|
| 35 | 23 | module_param(dev, int, S_IRUGO); |
|---|
| 36 | 24 | MODULE_PARM_DESC(dev, "MTD device number to use"); |
|---|
| 25 | + |
|---|
| 26 | +static unsigned int cycles_count = 1; |
|---|
| 27 | +module_param(cycles_count, uint, S_IRUGO); |
|---|
| 28 | +MODULE_PARM_DESC(cycles_count, "how many erase cycles to do " |
|---|
| 29 | + "(infinite by default)"); |
|---|
| 37 | 30 | |
|---|
| 38 | 31 | static struct mtd_info *mtd; |
|---|
| 39 | 32 | static unsigned char *iobuf; |
|---|
| .. | .. |
|---|
| 179 | 172 | |
|---|
| 180 | 173 | /* Read all eraseblocks 1 page at a time */ |
|---|
| 181 | 174 | pr_info("testing page read\n"); |
|---|
| 182 | | - for (i = 0; i < ebcnt; ++i) { |
|---|
| 183 | | - int ret; |
|---|
| 175 | + while (cycles_count--) { |
|---|
| 176 | + pr_info("Number of remaining cycles %d\n", cycles_count); |
|---|
| 177 | + for (i = 0; i < ebcnt; ++i) { |
|---|
| 178 | + int ret; |
|---|
| 184 | 179 | |
|---|
| 185 | | - if (bbt[i]) |
|---|
| 186 | | - continue; |
|---|
| 187 | | - ret = read_eraseblock_by_page(i); |
|---|
| 188 | | - if (ret) { |
|---|
| 189 | | - dump_eraseblock(i); |
|---|
| 190 | | - if (!err) |
|---|
| 180 | + if (bbt[i]) |
|---|
| 181 | + continue; |
|---|
| 182 | + ret = read_eraseblock_by_page(i); |
|---|
| 183 | + if (ret) { |
|---|
| 184 | + dump_eraseblock(i); |
|---|
| 185 | + if (!err) |
|---|
| 186 | + err = ret; |
|---|
| 187 | + } |
|---|
| 188 | + |
|---|
| 189 | + ret = mtdtest_relax(); |
|---|
| 190 | + if (ret) { |
|---|
| 191 | 191 | err = ret; |
|---|
| 192 | | - } |
|---|
| 193 | | - |
|---|
| 194 | | - ret = mtdtest_relax(); |
|---|
| 195 | | - if (ret) { |
|---|
| 196 | | - err = ret; |
|---|
| 197 | | - goto out; |
|---|
| 192 | + goto out; |
|---|
| 193 | + } |
|---|
| 198 | 194 | } |
|---|
| 199 | 195 | } |
|---|
| 200 | 196 | |
|---|