diff options
-rw-r--r-- | sound/core/hrtimer.c | 9 | ||||
-rw-r--r-- | 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 886be7da989d..f845ecf7e172 100644 --- a/sound/core/hrtimer.c +++ b/sound/core/hrtimer.c | |||
@@ -121,16 +121,9 @@ static struct snd_timer *mytimer; | |||
121 | static int __init snd_hrtimer_init(void) | 121 | static 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; | |||
42 | static int snd_pcsp_create(struct snd_card *card) | 42 | static 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; |