aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-04-14 17:08:30 -0400
committerThomas Gleixner <tglx@linutronix.de>2015-04-22 11:06:48 -0400
commit447fbbdc2cd58cdaf410fefef365a9ce38833157 (patch)
tree3963eb5fa9e503e924b8ff142b19d017c9daead8
parent1e3176885cce8e0137d6f4072c5910bfa00901ed (diff)
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 <tglx@linutronix.de> Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: alsa-devel@alsa-project.org Link: http://lkml.kernel.org/r/20150414203500.799133359@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--sound/core/hrtimer.c9
-rw-r--r--sound/drivers/pcsp/pcsp.c15
2 files changed, 7 insertions, 17 deletions
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
index 886be7da989d..f845ecf7e172 100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -121,16 +121,9 @@ static struct snd_timer *mytimer;
121static int __init snd_hrtimer_init(void) 121static int __init snd_hrtimer_init(void)
122{ 122{
123 struct snd_timer *timer; 123 struct snd_timer *timer;
124 struct timespec tp;
125 int err; 124 int err;
126 125
127 hrtimer_get_res(CLOCK_MONOTONIC, &tp); 126 resolution = hrtimer_resolution;
128 if (tp.tv_sec > 0 || !tp.tv_nsec) {
129 pr_err("snd-hrtimer: Invalid resolution %u.%09u",
130 (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
131 return -EINVAL;
132 }
133 resolution = tp.tv_nsec;
134 127
135 /* Create a new timer and set up the fields */ 128 /* Create a new timer and set up the fields */
136 err = snd_timer_global_new("hrtimer", SNDRV_TIMER_GLOBAL_HRTIMER, 129 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 d9647bd84d0f..eb54702037cc 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -42,16 +42,13 @@ struct snd_pcsp pcsp_chip;
42static int snd_pcsp_create(struct snd_card *card) 42static int snd_pcsp_create(struct snd_card *card)
43{ 43{
44 static struct snd_device_ops ops = { }; 44 static struct snd_device_ops ops = { };
45 struct timespec tp; 45 unsigned int resolution = hrtimer_resolution;
46 int err; 46 int err, div, min_div, order;
47 int div, min_div, order;
48
49 hrtimer_get_res(CLOCK_MONOTONIC, &tp);
50 47
51 if (!nopcm) { 48 if (!nopcm) {
52 if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { 49 if (resolution > PCSP_MAX_PERIOD_NS) {
53 printk(KERN_ERR "PCSP: Timer resolution is not sufficient " 50 printk(KERN_ERR "PCSP: Timer resolution is not sufficient "
54 "(%linS)\n", tp.tv_nsec); 51 "(%linS)\n", resolution);
55 printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " 52 printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI "
56 "enabled.\n"); 53 "enabled.\n");
57 printk(KERN_ERR "PCSP: Turned into nopcm mode.\n"); 54 printk(KERN_ERR "PCSP: Turned into nopcm mode.\n");
@@ -59,13 +56,13 @@ static int snd_pcsp_create(struct snd_card *card)
59 } 56 }
60 } 57 }
61 58
62 if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) 59 if (loops_per_jiffy >= PCSP_MIN_LPJ && resolution <= PCSP_MIN_PERIOD_NS)
63 min_div = MIN_DIV; 60 min_div = MIN_DIV;
64 else 61 else
65 min_div = MAX_DIV; 62 min_div = MAX_DIV;
66#if PCSP_DEBUG 63#if PCSP_DEBUG
67 printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n", 64 printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n",
68 loops_per_jiffy, min_div, tp.tv_nsec); 65 loops_per_jiffy, min_div, resolution);
69#endif 66#endif
70 67
71 div = MAX_DIV / min_div; 68 div = MAX_DIV / min_div;