aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAya Mahfouz <mahfouz.saif.elyazal@gmail.com>2014-10-28 08:27:44 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-28 10:07:25 -0400
commit326f0480b7f8504c4f594c4f36ab7874e17780bc (patch)
tree1b44805bde641b1141c64a61cfc89d3f917c6bde
parent66797f36fd17e8975f4a3449aed895cda952c0ce (diff)
ALSA: pcxhr: convert timeval to ktime_t
This patch is concerned with migrating the time variables in the pcxhr module found in the sound driver. The changes are concerend with the y2038 problem where timeval will overflow in the year 2038. ktime_t was used instead of timeval to get the wall time. The difference is displayed now in nanoseconds instead of microseconds. Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/pcxhr/pcxhr.c10
-rw-r--r--sound/pci/pcxhr/pcxhr_core.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index b854fc5e01f5..7c33c973dbd5 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -711,8 +711,9 @@ static void pcxhr_start_linked_stream(struct pcxhr_mgr *mgr)
711 int playback_mask = 0; 711 int playback_mask = 0;
712 712
713#ifdef CONFIG_SND_DEBUG_VERBOSE 713#ifdef CONFIG_SND_DEBUG_VERBOSE
714 struct timeval my_tv1, my_tv2; 714 ktime_t start_time, stop_time, diff_time;
715 do_gettimeofday(&my_tv1); 715
716 start_time = ktime_get();
716#endif 717#endif
717 mutex_lock(&mgr->setup_mutex); 718 mutex_lock(&mgr->setup_mutex);
718 719
@@ -823,9 +824,10 @@ static void pcxhr_start_linked_stream(struct pcxhr_mgr *mgr)
823 mutex_unlock(&mgr->setup_mutex); 824 mutex_unlock(&mgr->setup_mutex);
824 825
825#ifdef CONFIG_SND_DEBUG_VERBOSE 826#ifdef CONFIG_SND_DEBUG_VERBOSE
826 do_gettimeofday(&my_tv2); 827 stop_time = ktime_get();
828 diff_time = ktime_sub(stop_time, start_time);
827 dev_dbg(&mgr->pci->dev, "***TRIGGER START*** TIME = %ld (err = %x)\n", 829 dev_dbg(&mgr->pci->dev, "***TRIGGER START*** TIME = %ld (err = %x)\n",
828 (long)(my_tv2.tv_usec - my_tv1.tv_usec), err); 830 (long)(ktime_to_ns(diff_time)), err);
829#endif 831#endif
830} 832}
831 833
diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c
index a584acb61c00..181f7729d409 100644
--- a/sound/pci/pcxhr/pcxhr_core.c
+++ b/sound/pci/pcxhr/pcxhr_core.c
@@ -910,8 +910,9 @@ int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask,
910 int audio_mask; 910 int audio_mask;
911 911
912#ifdef CONFIG_SND_DEBUG_VERBOSE 912#ifdef CONFIG_SND_DEBUG_VERBOSE
913 struct timeval my_tv1, my_tv2; 913 ktime_t start_time, stop_time, diff_time;
914 do_gettimeofday(&my_tv1); 914
915 start_time = ktime_get();
915#endif 916#endif
916 audio_mask = (playback_mask | 917 audio_mask = (playback_mask |
917 (capture_mask << PCXHR_PIPE_STATE_CAPTURE_OFFSET)); 918 (capture_mask << PCXHR_PIPE_STATE_CAPTURE_OFFSET));
@@ -960,9 +961,10 @@ int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask,
960 return err; 961 return err;
961 } 962 }
962#ifdef CONFIG_SND_DEBUG_VERBOSE 963#ifdef CONFIG_SND_DEBUG_VERBOSE
963 do_gettimeofday(&my_tv2); 964 stop_time = ktime_get();
965 diff_time = ktime_sub(stop_time, start_time);
964 dev_dbg(&mgr->pci->dev, "***SET PIPE STATE*** TIME = %ld (err = %x)\n", 966 dev_dbg(&mgr->pci->dev, "***SET PIPE STATE*** TIME = %ld (err = %x)\n",
965 (long)(my_tv2.tv_usec - my_tv1.tv_usec), err); 967 (long)(ktime_to_ns(diff_time)), err);
966#endif 968#endif
967 return 0; 969 return 0;
968} 970}