Commit 1b1050cd authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide

Pull IDE fixlet from David Miller:
 "Just a y2038 fix to the pdc202xx_new IDE driver"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
  ide: pdc202xx_new: Replace timeval with ktime_t
parents b0f85fa1 353b39d1
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/ktime.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -243,13 +244,13 @@ static long read_counter(u32 dma_base) ...@@ -243,13 +244,13 @@ static long read_counter(u32 dma_base)
*/ */
static long detect_pll_input_clock(unsigned long 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 start_count, end_count;
long pll_input, usec_elapsed; long pll_input, usec_elapsed;
u8 scr1; u8 scr1;
start_count = read_counter(dma_base); start_count = read_counter(dma_base);
do_gettimeofday(&start_time); start_time = ktime_get();
/* Start the test mode */ /* Start the test mode */
outb(0x01, dma_base + 0x01); outb(0x01, dma_base + 0x01);
...@@ -261,7 +262,7 @@ static long detect_pll_input_clock(unsigned long dma_base) ...@@ -261,7 +262,7 @@ static long detect_pll_input_clock(unsigned long dma_base)
mdelay(10); mdelay(10);
end_count = read_counter(dma_base); end_count = read_counter(dma_base);
do_gettimeofday(&end_time); end_time = ktime_get();
/* Stop the test mode */ /* Stop the test mode */
outb(0x01, dma_base + 0x01); outb(0x01, dma_base + 0x01);
...@@ -273,8 +274,7 @@ static long detect_pll_input_clock(unsigned long dma_base) ...@@ -273,8 +274,7 @@ static long detect_pll_input_clock(unsigned long dma_base)
* Calculate the input clock in Hz * Calculate the input clock in Hz
* (the clock counter is 30 bit wide and counts down) * (the clock counter is 30 bit wide and counts down)
*/ */
usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + usec_elapsed = ktime_us_delta(end_time, start_time);
(end_time.tv_usec - start_time.tv_usec);
pll_input = ((start_count - end_count) & 0x3fffffff) / 10 * pll_input = ((start_count - end_count) & 0x3fffffff) / 10 *
(10000000 / usec_elapsed); (10000000 / usec_elapsed);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment