ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get
PATCH 1/1 ide: pdc202xxx_new: Remove do_gettimeofday() usage for ktime_get
As part of the y2038 cleanups, this patch removes the do_gettimeofday usage replacing it with ktime_get.
--- drivers/ide/pdc202xx_new.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/ide/pdc202xx_new.c +5 -5
@@ -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);
Signature · 1 line
1.9.1
Hello.
Quoted 15 lines · John Stultz
As part of the y2038 cleanups, this patch removes the
do_gettimeofdayusage replacing it withktime_get.Cc "David S. Miller" <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/ide/pdc202xx_new.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/ide/pdc202xx_new.c +0
-0
[...]
drivers/ide/pdc202xx_new.c static long detect_pll_input_clock(unsigned long dma_base) · line 277
Quoted 7 lines
drivers/ide/pdc202xx_new.c +1
-2@@ -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.
drivers/ide/pdc202xx_new.c static long detect_pll_input_clock(unsigned long dma_base) · line 280
Quoted 3 lines
drivers/ide/pdc202xx_new.c +0
-0pll_input = ((start_count - end_count) &0x3fffffff ) /10 * (10000000 / usec_elapsed);
MBR, Sergei
Quoted 24 lines · Sergei Shtylyov
Hello.
Quoted 17 lines · John Stultz
As part of the y2038 cleanups, this patch removes the
do_gettimeofdayusage replacing it withktime_get.Cc "David S. Miller" <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/ide/pdc202xx_new.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/ide/pdc202xx_new.c +0
-0[...]
Quoted 1 line
Quoted 13 lines
drivers/ide/pdc202xx_new.c static long detect_pll_input_clock(unsigned long · line 279
Quoted 9 lines
drivers/ide/pdc202xx_new.c +1
-2@@ -273,8 +274,7 @@ static long detect_pll_input_clock(unsigned longdma_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