All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [KJ] [PATCH][RESEND] is_power_of_2 in rtc
@ 2007-02-20 15:10 Håkon Løvdal
  0 siblings, 0 replies; 2+ messages in thread
From: Håkon Løvdal @ 2007-02-20 15:10 UTC (permalink / raw)
  To: kernel-janitors

On 19/02/07, Vignesh Babu BM <vignesh.babu@wipro.com> wrote:>                 /* check for power of 2 */>> -               if ((arg & (arg-1)) != 0 || arg < 1) {> +               if (!is_power_of_2(arg)) {>                         ret = -EINVAL;>                         goto exit;>                 }
The comment is no longer necessary since the information it providednow also is present directly in the code (which of course is very good).
BR Håkon Løvdal
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [KJ]  [PATCH][RESEND] is_power_of_2 in rtc
@ 2007-02-19  9:12 Vignesh Babu BM
  0 siblings, 0 replies; 2+ messages in thread
From: Vignesh Babu BM @ 2007-02-19  9:12 UTC (permalink / raw)
  To: kernel-janitors


Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2...resent to fix a change in the logic


Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
--- 
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index f406a2b..212ec32 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -20,6 +20,7 @@
 #include <linux/rtc.h>
 #include <linux/bcd.h>
 #include <linux/clk.h>
+#include <linux/log2.h>
 
 #include <asm/hardware.h>
 #include <asm/uaccess.h>
@@ -311,7 +312,7 @@ static int s3c_rtc_ioctl(struct device *dev,
 	case RTC_IRQP_SET:
 		/* check for power of 2 */
 
-		if ((arg & (arg-1)) != 0 || arg < 1) {
+		if (!is_power_of_2(arg)) {
 			ret = -EINVAL;
 			goto exit;
 		}

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-20 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20 15:10 [KJ] [PATCH][RESEND] is_power_of_2 in rtc Håkon Løvdal
  -- strict thread matches above, loose matches on Subject: below --
2007-02-19  9:12 Vignesh Babu BM

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.