aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_pdc2027x.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 4d06a5cda987..dca8251b1aea 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -28,6 +28,7 @@
28#include <linux/blkdev.h> 28#include <linux/blkdev.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/ktime.h>
31#include <scsi/scsi.h> 32#include <scsi/scsi.h>
32#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
33#include <scsi/scsi_cmnd.h> 34#include <scsi/scsi_cmnd.h>
@@ -605,7 +606,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
605 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; 606 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR];
606 u32 scr; 607 u32 scr;
607 long start_count, end_count; 608 long start_count, end_count;
608 struct timeval start_time, end_time; 609 ktime_t start_time, end_time;
609 long pll_clock, usec_elapsed; 610 long pll_clock, usec_elapsed;
610 611
611 /* Start the test mode */ 612 /* Start the test mode */
@@ -616,14 +617,14 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
616 617
617 /* Read current counter value */ 618 /* Read current counter value */
618 start_count = pdc_read_counter(host); 619 start_count = pdc_read_counter(host);
619 do_gettimeofday(&start_time); 620 start_time = ktime_get();
620 621
621 /* Let the counter run for 100 ms. */ 622 /* Let the counter run for 100 ms. */
622 mdelay(100); 623 mdelay(100);
623 624
624 /* Read the counter values again */ 625 /* Read the counter values again */
625 end_count = pdc_read_counter(host); 626 end_count = pdc_read_counter(host);
626 do_gettimeofday(&end_time); 627 end_time = ktime_get();
627 628
628 /* Stop the test mode */ 629 /* Stop the test mode */
629 scr = ioread32(mmio_base + PDC_SYS_CTL); 630 scr = ioread32(mmio_base + PDC_SYS_CTL);
@@ -632,8 +633,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
632 ioread32(mmio_base + PDC_SYS_CTL); /* flush */ 633 ioread32(mmio_base + PDC_SYS_CTL); /* flush */
633 634
634 /* calculate the input clock in Hz */ 635 /* calculate the input clock in Hz */
635 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + 636 usec_elapsed = (long) ktime_us_delta(end_time, start_time);
636 (end_time.tv_usec - start_time.tv_usec);
637 637
638 pll_clock = ((start_count - end_count) & 0x3fffffff) / 100 * 638 pll_clock = ((start_count - end_count) & 0x3fffffff) / 100 *
639 (100000000 / usec_elapsed); 639 (100000000 / usec_elapsed);