diff options
author | Shraddha Barke <shraddha.6596@gmail.com> | 2015-10-22 16:59:54 +0200 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-10-26 21:23:47 +0100 |
commit | af30c0a00aa0d086a820c2ec75544c07611834d7 (patch) | |
tree | dda7cb78cca78a868a9d6340d307bfee82f806be /drivers/mtd/tests/speedtest.c | |
parent | mtd: fsmc_nand: Add BCH4 SW ECC support for SPEAr600 (diff) | |
download | linux-af30c0a00aa0d086a820c2ec75544c07611834d7.tar.xz linux-af30c0a00aa0d086a820c2ec75544c07611834d7.zip |
mtd: tests: Replace timeval with ktime_t
Changes the 32-bit time type timeval to the 64-bit time type
ktime_t, since 32-bit systems using struct timeval will break in the
year 2038. Correspondingly change do_gettimeofday() to ktime_get()
since ktime_get returns a ktime_t, but do_gettimeofday returns a
struct timeval.Here, ktime_get() is used instead of ktime_get_real()
since ktime_get() uses monotonic clock.
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/tests/speedtest.c')
-rw-r--r-- | drivers/mtd/tests/speedtest.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/tests/speedtest.c b/drivers/mtd/tests/speedtest.c index 5a6f31af06f9..0b89418a0888 100644 --- a/drivers/mtd/tests/speedtest.c +++ b/drivers/mtd/tests/speedtest.c @@ -22,6 +22,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/init.h> +#include <linux/ktime.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/err.h> @@ -49,7 +50,7 @@ static int pgsize; static int ebcnt; static int pgcnt; static int goodebcnt; -static struct timeval start, finish; +static ktime_t start, finish; static int multiblock_erase(int ebnum, int blocks) { @@ -168,12 +169,12 @@ static int read_eraseblock_by_2pages(int ebnum) static inline void start_timing(void) { - do_gettimeofday(&start); + start = ktime_get(); } static inline void stop_timing(void) { - do_gettimeofday(&finish); + finish = ktime_get(); } static long calc_speed(void) @@ -181,8 +182,7 @@ static long calc_speed(void) uint64_t k; long ms; - ms = (finish.tv_sec - start.tv_sec) * 1000 + - (finish.tv_usec - start.tv_usec) / 1000; + ms = ktime_ms_delta(finish, start); if (ms == 0) return 0; k = (uint64_t)goodebcnt * (mtd->erasesize / 1024) * 1000; |