All of lore.kernel.org
 help / color / mirror / Atom feed
* [kj] is_power_of_2 in drivers/s390/block/dasd_int.h
@ 2007-08-13 13:05 vignesh babu
  2007-08-15 10:10   ` Heiko Carstens
  0 siblings, 1 reply; 3+ messages in thread
From: vignesh babu @ 2007-08-13 13:05 UTC (permalink / raw)
  To: kernel-janitors

Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)

Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
---
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index aeda526..d427dae 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -53,6 +53,7 @@
 #include <linux/genhd.h>
 #include <linux/hdreg.h>
 #include <linux/interrupt.h>
+#include <linux/log2.h>
 #include <asm/ccwdev.h>
 #include <linux/workqueue.h>
 #include <asm/debug.h>
@@ -456,7 +457,7 @@ dasd_free_chunk(struct list_head *chunk_list, void *mem)
 static inline int
 dasd_check_blocksize(int bsize)
 {
-	if (bsize < 512 || bsize > 4096 || (bsize & (bsize - 1)) != 0)
+	if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize))
 		return -EMEDIUMTYPE;
 	return 0;
 }

-- 
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"

_______________________________________________
REMINDER: this mailing list moved to vger.kernel.org and current one will be discontinued soon.
To resubscribe, send email to majordomo@vger.kernel.org with
&quot;subscribe kernel-janitors&quot; in message body and follow instructions.

Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

* Re: [kj] is_power_of_2 in drivers/s390/block/dasd_int.h
  2007-08-13 13:05 [kj] is_power_of_2 in drivers/s390/block/dasd_int.h vignesh babu
@ 2007-08-15 10:10   ` Heiko Carstens
  0 siblings, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2007-08-15 10:10 UTC (permalink / raw)
  To: linux-s390, kernel-janitors

On Mon, Aug 13, 2007 at 06:23:59PM +0530, vignesh babu wrote:
> Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
> 
> Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
> ---
> diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
> index aeda526..d427dae 100644
> --- a/drivers/s390/block/dasd_int.h
> +++ b/drivers/s390/block/dasd_int.h
> @@ -53,6 +53,7 @@
>  #include <linux/genhd.h>
>  #include <linux/hdreg.h>
>  #include <linux/interrupt.h>
> +#include <linux/log2.h>
>  #include <asm/ccwdev.h>
>  #include <linux/workqueue.h>
>  #include <asm/debug.h>
> @@ -456,7 +457,7 @@ dasd_free_chunk(struct list_head *chunk_list, void *mem)
>  static inline int
>  dasd_check_blocksize(int bsize)
>  {
> -	if (bsize < 512 || bsize > 4096 || (bsize & (bsize - 1)) != 0)
> +	if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize))
>  		return -EMEDIUMTYPE;
>  	return 0;
>  }

Added to our patch queue. Thanks.
_______________________________________________
REMINDER: this mailing list moved to vger.kernel.org and current one will be discontinued soon.
To resubscribe, send email to majordomo@vger.kernel.org with
&quot;subscribe kernel-janitors&quot; in message body and follow instructions.

Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

* Re: [kj] is_power_of_2 in drivers/s390/block/dasd_int.h
@ 2007-08-15 10:10   ` Heiko Carstens
  0 siblings, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2007-08-15 10:10 UTC (permalink / raw)
  To: linux-s390, kernel-janitors

On Mon, Aug 13, 2007 at 06:23:59PM +0530, vignesh babu wrote:
> Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
> 
> Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
> ---
> diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
> index aeda526..d427dae 100644
> --- a/drivers/s390/block/dasd_int.h
> +++ b/drivers/s390/block/dasd_int.h
> @@ -53,6 +53,7 @@
>  #include <linux/genhd.h>
>  #include <linux/hdreg.h>
>  #include <linux/interrupt.h>
> +#include <linux/log2.h>
>  #include <asm/ccwdev.h>
>  #include <linux/workqueue.h>
>  #include <asm/debug.h>
> @@ -456,7 +457,7 @@ dasd_free_chunk(struct list_head *chunk_list, void *mem)
>  static inline int
>  dasd_check_blocksize(int bsize)
>  {
> -	if (bsize < 512 || bsize > 4096 || (bsize & (bsize - 1)) != 0)
> +	if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize))
>  		return -EMEDIUMTYPE;
>  	return 0;
>  }

Added to our patch queue. Thanks.

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 13:05 [kj] is_power_of_2 in drivers/s390/block/dasd_int.h vignesh babu
2007-08-15 10:10 ` Heiko Carstens
2007-08-15 10:10   ` Heiko Carstens

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.