aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-06-11 19:59:15 -0400
committerTakashi Iwai <tiwai@suse.de>2014-06-12 06:58:41 -0400
commit2afe8be85c2c79fc574c0d322ab60921d5deed43 (patch)
tree484833cf4f0e6424553878c1977ec2a6fcb96a2b /sound
parent26204e048d2ee0c65e0539f7cc2b66f845a19a41 (diff)
ALSA: intel8x0: Use ktime and ktime_get()
do_posix_clock_monotonic_gettime() is a leftover from the initial posix timer implementation which maps to ktime_get_ts() and returns the monotonic time in a timespec. Use ktime based ktime_get() and use the ktime_delta_us() function to calculate the delta instead of open coding the timespec math. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/intel8x0.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 68340d7df76d..c91860e0a28d 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2779,7 +2779,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2779 unsigned long port; 2779 unsigned long port;
2780 unsigned long pos, pos1, t; 2780 unsigned long pos, pos1, t;
2781 int civ, timeout = 1000, attempt = 1; 2781 int civ, timeout = 1000, attempt = 1;
2782 struct timespec start_time, stop_time; 2782 ktime_t start_time, stop_time;
2783 2783
2784 if (chip->ac97_bus->clock != 48000) 2784 if (chip->ac97_bus->clock != 48000)
2785 return; /* specified in module option */ 2785 return; /* specified in module option */
@@ -2813,7 +2813,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2813 iputbyte(chip, port + ICH_REG_OFF_CR, ICH_IOCE); 2813 iputbyte(chip, port + ICH_REG_OFF_CR, ICH_IOCE);
2814 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); 2814 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot);
2815 } 2815 }
2816 do_posix_clock_monotonic_gettime(&start_time); 2816 start_time = ktime_get();
2817 spin_unlock_irq(&chip->reg_lock); 2817 spin_unlock_irq(&chip->reg_lock);
2818 msleep(50); 2818 msleep(50);
2819 spin_lock_irq(&chip->reg_lock); 2819 spin_lock_irq(&chip->reg_lock);
@@ -2837,7 +2837,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2837 pos += ichdev->position; 2837 pos += ichdev->position;
2838 } 2838 }
2839 chip->in_measurement = 0; 2839 chip->in_measurement = 0;
2840 do_posix_clock_monotonic_gettime(&stop_time); 2840 stop_time = ktime_get();
2841 /* stop */ 2841 /* stop */
2842 if (chip->device_type == DEVICE_ALI) { 2842 if (chip->device_type == DEVICE_ALI) {
2843 iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); 2843 iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16));
@@ -2865,9 +2865,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2865 } 2865 }
2866 2866
2867 pos /= 4; 2867 pos /= 4;
2868 t = stop_time.tv_sec - start_time.tv_sec; 2868 t = ktime_us_delta(stop_time, start_time);
2869 t *= 1000000;
2870 t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000;
2871 dev_info(chip->card->dev, 2869 dev_info(chip->card->dev,
2872 "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); 2870 "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos);
2873 if (t == 0) { 2871 if (t == 0) {