diff options
Diffstat (limited to 'drivers/mtd/tests/speedtest.c')
| -rw-r--r-- | drivers/mtd/tests/speedtest.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/mtd/tests/speedtest.c b/drivers/mtd/tests/speedtest.c index 0b89418a0888..075bce32caa5 100644 --- a/drivers/mtd/tests/speedtest.c +++ b/drivers/mtd/tests/speedtest.c @@ -1,19 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2007 Nokia Corporation * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; see the file COPYING. If not, write to the Free Software - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * * Test read and write speed of a MTD device. * * Author: Adrian Hunter <adrian.hunter@nokia.com> @@ -59,7 +47,6 @@ static int multiblock_erase(int ebnum, int blocks) loff_t addr = (loff_t)ebnum * mtd->erasesize; memset(&ei, 0, sizeof(struct erase_info)); - ei.mtd = mtd; ei.addr = addr; ei.len = mtd->erasesize * blocks; @@ -70,12 +57,6 @@ static int multiblock_erase(int ebnum, int blocks) return err; } - if (ei.state == MTD_ERASE_FAILED) { - pr_err("some erase error occurred at EB %d," - "blocks %d\n", ebnum, blocks); - return -EIO; - } - return 0; } @@ -179,14 +160,13 @@ static inline void stop_timing(void) static long calc_speed(void) { - uint64_t k; - long ms; + uint64_t k, us; - ms = ktime_ms_delta(finish, start); - if (ms == 0) + us = ktime_us_delta(finish, start); + if (us == 0) return 0; - k = (uint64_t)goodebcnt * (mtd->erasesize / 1024) * 1000; - do_div(k, ms); + k = (uint64_t)goodebcnt * (mtd->erasesize / 1024) * 1000000; + do_div(k, us); return k; } @@ -243,7 +223,7 @@ static int __init mtd_speedtest_init(void) if (!iobuf) goto out; - prandom_bytes(iobuf, mtd->erasesize); + get_random_bytes(iobuf, mtd->erasesize); bbt = kzalloc(ebcnt, GFP_KERNEL); if (!bbt) |
