[ALSA] is_power_of_2 in rtctimer.c
authorvignesh babu <vignesh.babu@wipro.com>
Thu, 22 Feb 2007 12:23:01 +0000 (13:23 +0100)
committerJaroslav Kysela <perex@suse.cz>
Fri, 11 May 2007 14:55:42 +0000 (16:55 +0200)
Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2

Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/core/rtctimer.c

index 9f7b32e1ccdeb29a7122aaea0f485a0dafa144c5..7cd5e8f5d4cebc2375f7303ce00d48e09046fd96 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/moduleparam.h>
+#include <linux/log2.h>
 #include <sound/core.h>
 #include <sound/timer.h>
 
@@ -129,7 +130,7 @@ static int __init rtctimer_init(void)
        struct snd_timer *timer;
 
        if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
-           (rtctimer_freq & (rtctimer_freq - 1)) != 0) {
+           !is_power_of_2(rtctimer_freq)) {
                snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n",
                           rtctimer_freq);
                return -EINVAL;