From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758015AbbDVTGR (ORCPT ); Wed, 22 Apr 2015 15:06:17 -0400 Received: from terminus.zytor.com ([198.137.202.10]:41166 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757517AbbDVTGO (ORCPT ); Wed, 22 Apr 2015 15:06:14 -0400 Date: Wed, 22 Apr 2015 12:05:37 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, preeti@linux.vnet.ibm.com, mingo@kernel.org, mtosatti@redhat.com, fweisbec@gmail.com, perex@perex.cz, viresh.kumar@linaro.org, tiwai@suse.de, peterz@infradead.org Reply-To: tiwai@suse.de, peterz@infradead.org, perex@perex.cz, viresh.kumar@linaro.org, fweisbec@gmail.com, mtosatti@redhat.com, preeti@linux.vnet.ibm.com, mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <20150414203500.799133359@linutronix.de> References: <20150414203500.799133359@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] sound: Use hrtimer_resolution instead of hrtimer_get_res() Git-Commit-ID: 447fbbdc2cd58cdaf410fefef365a9ce38833157 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 447fbbdc2cd58cdaf410fefef365a9ce38833157 Gitweb: http://git.kernel.org/tip/447fbbdc2cd58cdaf410fefef365a9ce38833157 Author: Thomas Gleixner AuthorDate: Tue, 14 Apr 2015 21:08:30 +0000 Committer: Thomas Gleixner CommitDate: Wed, 22 Apr 2015 17:06:48 +0200 sound: Use hrtimer_resolution instead of hrtimer_get_res() No point in converting a timespec now that the value is directly accessible. Get rid of the null check while at it. Resolution is guaranteed to be > 0. Signed-off-by: Thomas Gleixner Acked-by: Takashi Iwai Acked-by: Peter Zijlstra Cc: Preeti U Murthy Cc: Viresh Kumar Cc: Marcelo Tosatti Cc: Frederic Weisbecker Cc: Jaroslav Kysela Cc: alsa-devel@alsa-project.org Link: http://lkml.kernel.org/r/20150414203500.799133359@linutronix.de Signed-off-by: Thomas Gleixner --- sound/core/hrtimer.c | 9 +-------- sound/drivers/pcsp/pcsp.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c index 886be7d..f845ecf 100644 --- a/sound/core/hrtimer.c +++ b/sound/core/hrtimer.c @@ -121,16 +121,9 @@ static struct snd_timer *mytimer; static int __init snd_hrtimer_init(void) { struct snd_timer *timer; - struct timespec tp; int err; - hrtimer_get_res(CLOCK_MONOTONIC, &tp); - if (tp.tv_sec > 0 || !tp.tv_nsec) { - pr_err("snd-hrtimer: Invalid resolution %u.%09u", - (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec); - return -EINVAL; - } - resolution = tp.tv_nsec; + resolution = hrtimer_resolution; /* Create a new timer and set up the fields */ err = snd_timer_global_new("hrtimer", SNDRV_TIMER_GLOBAL_HRTIMER, diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index d9647bd..eb54702 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c @@ -42,16 +42,13 @@ struct snd_pcsp pcsp_chip; static int snd_pcsp_create(struct snd_card *card) { static struct snd_device_ops ops = { }; - struct timespec tp; - int err; - int div, min_div, order; - - hrtimer_get_res(CLOCK_MONOTONIC, &tp); + unsigned int resolution = hrtimer_resolution; + int err, div, min_div, order; if (!nopcm) { - if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { + if (resolution > PCSP_MAX_PERIOD_NS) { printk(KERN_ERR "PCSP: Timer resolution is not sufficient " - "(%linS)\n", tp.tv_nsec); + "(%linS)\n", resolution); printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " "enabled.\n"); printk(KERN_ERR "PCSP: Turned into nopcm mode.\n"); @@ -59,13 +56,13 @@ static int snd_pcsp_create(struct snd_card *card) } } - if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) + if (loops_per_jiffy >= PCSP_MIN_LPJ && resolution <= PCSP_MIN_PERIOD_NS) min_div = MIN_DIV; else min_div = MAX_DIV; #if PCSP_DEBUG printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n", - loops_per_jiffy, min_div, tp.tv_nsec); + loops_per_jiffy, min_div, resolution); #endif div = MAX_DIV / min_div;