summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-09-27 15:57:24 +0200
committerJaroslav Kysela <perex@suse.cz>2005-11-04 13:16:48 +0100
commitd9ad1bdd6d72606a59cdc07e571fbe695e32f271 (patch)
treea5a702fc2db1e8079bad25b42d818e2f7636232f /sound/core
parentadf25df1be2e3843f786a2562202c7897bbd149d (diff)
downloadop-kernel-dev-d9ad1bdd6d72606a59cdc07e571fbe695e32f271.zip
op-kernel-dev-d9ad1bdd6d72606a59cdc07e571fbe695e32f271.tar.gz
[ALSA] rtctimer: optimize module parameter validation
Modules: RTC timer driver The check whether rtctimer_freq is a power of two can be done easier with a simple bit operation. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/rtctimer.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
index 85627db..8762ff8 100644
--- a/sound/core/rtctimer.c
+++ b/sound/core/rtctimer.c
@@ -119,16 +119,11 @@ static void rtctimer_interrupt(void *private_data)
*/
static int __init rtctimer_init(void)
{
- int order, err;
+ int err;
snd_timer_t *timer;
- if (rtctimer_freq < 2 || rtctimer_freq > 8192) {
- snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
- return -EINVAL;
- }
- for (order = 1; rtctimer_freq > order; order <<= 1)
- ;
- if (rtctimer_freq != order) {
+ if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
+ (rtctimer_freq & (rtctimer_freq - 1)) != 0) {
snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
return -EINVAL;
}
OpenPOWER on IntegriCloud