* [PATCH] ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get
@ 2015-03-12 17:23 John Stultz
2015-03-12 18:16 ` Sergei Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: John Stultz @ 2015-03-12 17:23 UTC (permalink / raw)
To: lkml; +Cc: John Stultz, David S. Miller, Arnd Bergmann, linux-ide
As part of the y2038 cleanups, this patch removes the do_gettimeofday
usage replacing it with ktime_get.
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-ide@vger.kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/ide/pdc202xx_new.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/ide/pdc202xx_new.c b/drivers/ide/pdc202xx_new.c
index df73cbd..94bd05f 100644
--- a/drivers/ide/pdc202xx_new.c
+++ b/drivers/ide/pdc202xx_new.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
+#include <linux/ktime.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/init.h>
@@ -243,13 +244,13 @@ static long read_counter(u32 dma_base)
*/
static long detect_pll_input_clock(unsigned long dma_base)
{
- struct timeval start_time, end_time;
+ ktime_t start_time, end_time;
long start_count, end_count;
long pll_input, usec_elapsed;
u8 scr1;
start_count = read_counter(dma_base);
- do_gettimeofday(&start_time);
+ start_time = ktime_get();
/* Start the test mode */
outb(0x01, dma_base + 0x01);
@@ -261,7 +262,7 @@ static long detect_pll_input_clock(unsigned long dma_base)
mdelay(10);
end_count = read_counter(dma_base);
- do_gettimeofday(&end_time);
+ end_time = ktime_get();
/* Stop the test mode */
outb(0x01, dma_base + 0x01);
@@ -273,8 +274,7 @@ static long detect_pll_input_clock(unsigned long dma_base)
* Calculate the input clock in Hz
* (the clock counter is 30 bit wide and counts down)
*/
- usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
- (end_time.tv_usec - start_time.tv_usec);
+ usec_elapsed = (long)ktime_to_ns(ktime_sub(end_time, start_time))/1000;
pll_input = ((start_count - end_count) & 0x3fffffff) / 10 *
(10000000 / usec_elapsed);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get
2015-03-12 17:23 [PATCH] ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get John Stultz
@ 2015-03-12 18:16 ` Sergei Shtylyov
2015-03-12 18:24 ` John Stultz
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2015-03-12 18:16 UTC (permalink / raw)
To: John Stultz, lkml; +Cc: David S. Miller, Arnd Bergmann, linux-ide
Hello.
On 03/12/2015 08:23 PM, John Stultz wrote:
> As part of the y2038 cleanups, this patch removes the do_gettimeofday
> usage replacing it with ktime_get.
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-ide@vger.kernel.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
> drivers/ide/pdc202xx_new.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> diff --git a/drivers/ide/pdc202xx_new.c b/drivers/ide/pdc202xx_new.c
> index df73cbd..94bd05f 100644
> --- a/drivers/ide/pdc202xx_new.c
> +++ b/drivers/ide/pdc202xx_new.c
[...]
> @@ -273,8 +274,7 @@ static long detect_pll_input_clock(unsigned long dma_base)
> * Calculate the input clock in Hz
> * (the clock counter is 30 bit wide and counts down)
> */
> - usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
> - (end_time.tv_usec - start_time.tv_usec);
> + usec_elapsed = (long)ktime_to_ns(ktime_sub(end_time, start_time))/1000;
Please add spaces around / to be consistent with this file's (and general
kernel) coding style.
> pll_input = ((start_count - end_count) & 0x3fffffff) / 10 *
> (10000000 / usec_elapsed);
>
MBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get
2015-03-12 18:16 ` Sergei Shtylyov
@ 2015-03-12 18:24 ` John Stultz
0 siblings, 0 replies; 3+ messages in thread
From: John Stultz @ 2015-03-12 18:24 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: lkml, David S. Miller, Arnd Bergmann, linux-ide
On Thu, Mar 12, 2015 at 11:16 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 03/12/2015 08:23 PM, John Stultz wrote:
>
>> As part of the y2038 cleanups, this patch removes the do_gettimeofday
>> usage replacing it with ktime_get.
>
>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: linux-ide@vger.kernel.org
>> Signed-off-by: John Stultz <john.stultz@linaro.org>
>> ---
>> drivers/ide/pdc202xx_new.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>
>> diff --git a/drivers/ide/pdc202xx_new.c b/drivers/ide/pdc202xx_new.c
>> index df73cbd..94bd05f 100644
>> --- a/drivers/ide/pdc202xx_new.c
>> +++ b/drivers/ide/pdc202xx_new.c
>
> [...]
>>
>> @@ -273,8 +274,7 @@ static long detect_pll_input_clock(unsigned long
>> dma_base)
>> * Calculate the input clock in Hz
>> * (the clock counter is 30 bit wide and counts down)
>> */
>> - usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
>> - (end_time.tv_usec - start_time.tv_usec);
>> + usec_elapsed = (long)ktime_to_ns(ktime_sub(end_time,
>> start_time))/1000;
>
>
> Please add spaces around / to be consistent with this file's (and general
> kernel) coding style.
Thanks for the review! Will fix in the next iteration.
thanks
-john
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-12 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 17:23 [PATCH] ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get John Stultz
2015-03-12 18:16 ` Sergei Shtylyov
2015-03-12 18:24 ` John Stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox