Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753638AbaJ1OIs (ORCPT ); Tue, 28 Oct 2014 10:08:48 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47731 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbaJ1OIr (ORCPT ); Tue, 28 Oct 2014 10:08:47 -0400 Date: Tue, 28 Oct 2014 15:08:46 +0100 Message-ID: From: Takashi Iwai To: Aya Mahfouz Cc: perex@perex.cz, bhelgaas@google.com, benoit.taine@lip6.fr, arnd@arndb.de, opw-kernel@googlegroups.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sound: pci: pcxhr: convert timeval to ktime_t In-Reply-To: <20141028122744.GA3772@localhost.localdomain> References: <20141028122744.GA3772@localhost.localdomain> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Tue, 28 Oct 2014 14:27:44 +0200, Aya Mahfouz wrote: > > 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 > Reviewed-by: Arnd Bergmann > --- > v2: changed variables names to avoid redeclaration conflicts. Applied, thanks. Takashi > > sound/pci/pcxhr/pcxhr.c | 10 ++++++---- > sound/pci/pcxhr/pcxhr_core.c | 10 ++++++---- > 2 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c > index b854fc5..7c33c97 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) > int playback_mask = 0; > > #ifdef CONFIG_SND_DEBUG_VERBOSE > - struct timeval my_tv1, my_tv2; > - do_gettimeofday(&my_tv1); > + ktime_t start_time, stop_time, diff_time; > + > + start_time = ktime_get(); > #endif > mutex_lock(&mgr->setup_mutex); > > @@ -823,9 +824,10 @@ static void pcxhr_start_linked_stream(struct pcxhr_mgr *mgr) > mutex_unlock(&mgr->setup_mutex); > > #ifdef CONFIG_SND_DEBUG_VERBOSE > - do_gettimeofday(&my_tv2); > + stop_time = ktime_get(); > + diff_time = ktime_sub(stop_time, start_time); > dev_dbg(&mgr->pci->dev, "***TRIGGER START*** TIME = %ld (err = %x)\n", > - (long)(my_tv2.tv_usec - my_tv1.tv_usec), err); > + (long)(ktime_to_ns(diff_time)), err); > #endif > } > > diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c > index a584acb..181f772 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, > int audio_mask; > > #ifdef CONFIG_SND_DEBUG_VERBOSE > - struct timeval my_tv1, my_tv2; > - do_gettimeofday(&my_tv1); > + ktime_t start_time, stop_time, diff_time; > + > + start_time = ktime_get(); > #endif > audio_mask = (playback_mask | > (capture_mask << PCXHR_PIPE_STATE_CAPTURE_OFFSET)); > @@ -960,9 +961,10 @@ int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask, > return err; > } > #ifdef CONFIG_SND_DEBUG_VERBOSE > - do_gettimeofday(&my_tv2); > + stop_time = ktime_get(); > + diff_time = ktime_sub(stop_time, start_time); > dev_dbg(&mgr->pci->dev, "***SET PIPE STATE*** TIME = %ld (err = %x)\n", > - (long)(my_tv2.tv_usec - my_tv1.tv_usec), err); > + (long)(ktime_to_ns(diff_time)), err); > #endif > return 0; > } > -- > 1.9.3 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/