Commit 62e96a1caab86e0d3688d59fcb6f682cc52d4917

Authored by vignesh babu
Committed by Jaroslav Kysela
1 parent ac519028a4

[ALSA] is_power_of_2 in rtctimer.c

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>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

sound/core/rtctimer.c
... ... @@ -24,6 +24,7 @@
24 24 #include <linux/init.h>
25 25 #include <linux/interrupt.h>
26 26 #include <linux/moduleparam.h>
  27 +#include <linux/log2.h>
27 28 #include <sound/core.h>
28 29 #include <sound/timer.h>
29 30  
... ... @@ -129,7 +130,7 @@
129 130 struct snd_timer *timer;
130 131  
131 132 if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
132   - (rtctimer_freq & (rtctimer_freq - 1)) != 0) {
  133 + !is_power_of_2(rtctimer_freq)) {
133 134 snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n",
134 135 rtctimer_freq);
135 136 return -EINVAL;