From patchwork Tue Oct 28 11:29:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aya Mahfouz X-Patchwork-Id: 5175811 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 20B759F3ED for ; Tue, 28 Oct 2014 11:51:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43B972024F for ; Tue, 28 Oct 2014 11:51:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0E0CA20172 for ; Tue, 28 Oct 2014 11:51:30 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 26D8326527E; Tue, 28 Oct 2014 12:51:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4176A260478; Tue, 28 Oct 2014 12:41:51 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3A19926007E; Tue, 28 Oct 2014 12:30:32 +0100 (CET) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by alsa0.perex.cz (Postfix) with ESMTP id 3A99526043C for ; Tue, 28 Oct 2014 12:30:00 +0100 (CET) Received: by mail-wi0-f171.google.com with SMTP id hi2so5405166wib.16 for ; Tue, 28 Oct 2014 04:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=nCkbUsZtljSPyXJa5pkmH7/E/u2z29U3VvpvEQCP/TM=; b=pQGY1eJjVQd8l5fQ3/H4jH+iyNReqkTZHHRtQReO1qneGj6zWpkP47YAvjx+t+n7tf 5u4mwtn9ePypa5BylkQCdkqJ9iJmMsXxn9mhbAnDTsrsBnqDcqSonZMeRONcJE4qYBY/ WhNZtWx9l/M19WbdlBbnqgcpfXjOhJsDQF4GeervHh6zpwj8DxSFSn6yCS8EK8D8vOyk Wyc6Ua9fEew3XH9giH0e0x9DoF7y10hNKNjMFoqwIxrDhwHQhGUYfW54vIBYJPBBRWg9 Lsjko87eYIH35OwstT+NeO9UHY9rChNgD10Hv3FXXSGOaYG/ZBAPN3Yq+0kgmFZHtJzw iP7Q== X-Received: by 10.194.187.77 with SMTP id fq13mr3552860wjc.14.1414495799636; Tue, 28 Oct 2014 04:29:59 -0700 (PDT) Received: from localhost.localdomain ([82.201.179.129]) by mx.google.com with ESMTPSA id bq6sm202209wib.1.2014.10.28.04.29.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 04:29:58 -0700 (PDT) Date: Tue, 28 Oct 2014 13:29:56 +0200 From: Aya Mahfouz To: perex@perex.cz, tiwai@suse.de, bhelgaas@google.com, benoit.taine@lip6.fr Message-ID: <20141028112955.GA2365@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Mailman-Approved-At: Tue, 28 Oct 2014 12:41:38 +0100 Cc: opw-kernel@googlegroups.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, arnd@arndb.de Subject: [alsa-devel] [PATCH] sound: pci: pcxhr: convert timeval to ktime_t X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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..3f4607c 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, stop, diff; + + start = 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 = ktime_get(); + diff = ktime_sub(stop, start); 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)), err); #endif } diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c index a584acb..be3c003 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, stop, diff; + + start = 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 = ktime_get(); + diff = ktime_sub(stop, start); 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)), err); #endif return 0; }