From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpH0o-0003lX-5l for linux-mtd@lists.infradead.org; Thu, 22 Oct 2015 14:38:39 +0000 From: Arnd Bergmann To: y2038@lists.linaro.org Cc: Shraddha Barke , outreachy-kernel@googlegroups.com, David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org Subject: Re: [Y2038] [PATCH v2] mtd: tests: Replace timeval with ktime_t Date: Thu, 22 Oct 2015 16:37:50 +0200 Message-ID: <5015706.z4SiC6myD8@wuerfel> In-Reply-To: <1445524379-14541-1-git-send-email-shraddha.6596@gmail.com> References: <1445524379-14541-1-git-send-email-shraddha.6596@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thursday 22 October 2015 20:02:59 Shraddha Barke wrote: > 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 Reviewed-by: Arnd Bergmann I've added Brian and the linux-mtd list to Cc as well here. It's take a little practice to get the right people out of the output of scripts/get_maintainer.pl. In this case, you sent the patch only to David Woodhouse. However, Brian Norris currently does most of the work of picking up patches, and you should always include the mailing lists on Cc as well. Please re-send with my 'Reviewed-by' tag added. > --- > Changes in v2- > Make commit message clearer. > > drivers/mtd/tests/speedtest.c | 10 +++++----- > drivers/mtd/tests/torturetest.c | 10 +++++----- > 2 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/mtd/tests/speedtest.c b/drivers/mtd/tests/speedtest.c > index 5a6f31a..0b89418 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 > +#include > #include > #include > #include > @@ -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; > diff --git a/drivers/mtd/tests/torturetest.c b/drivers/mtd/tests/torturetest.c > index e5d6e6d..93c2729 100644 > --- a/drivers/mtd/tests/torturetest.c > +++ b/drivers/mtd/tests/torturetest.c > @@ -26,6 +26,7 @@ > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > #include > +#include > #include > #include > #include > @@ -79,18 +80,18 @@ static unsigned char *check_buf; > static unsigned int erase_cycles; > > static int pgsize; > -static struct timeval start, finish; > +static ktime_t start, finish; > > static void report_corrupt(unsigned char *read, unsigned char *written); > > static inline void start_timing(void) > { > - do_gettimeofday(&start); > + start = ktime_get(); > } > > static inline void stop_timing(void) > { > - do_gettimeofday(&finish); > + finish = ktime_get(); > } > > /* > @@ -333,8 +334,7 @@ static int __init tort_init(void) > long ms; > > stop_timing(); > - ms = (finish.tv_sec - start.tv_sec) * 1000 + > - (finish.tv_usec - start.tv_usec) / 1000; > + ms = ktime_ms_delta(finish, start); > pr_info("%08u erase cycles done, took %lu " > "milliseconds (%lu seconds)\n", > erase_cycles, ms, ms / 1000); >