All of lore.kernel.org
 help / color / mirror / Atom feed
* [kj] is_power_of_2 in drivers/s390/cio
@ 2007-08-13 13:07 vignesh babu
  2007-08-15 10:12   ` Heiko Carstens
  0 siblings, 1 reply; 3+ messages in thread
From: vignesh babu @ 2007-08-13 13:07 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/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 8633dc5..c00ebf4 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/string.h>
+#include <linux/log2.h>
 
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
@@ -1129,7 +1130,7 @@ device_trigger_reprobe(struct subchannel *sch)
 	sch->schib.pmcw.isc = 3;
 	sch->schib.pmcw.csense = 1;
 	sch->schib.pmcw.ena = 0;
-	if ((sch->lpm & (sch->lpm - 1)) != 0)
+	if (!is_power_of_2(sch->lpm))
 		sch->schib.pmcw.mp = 1;
 	sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
 	/* We should also udate ssd info, but this has to wait. */

-- 
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/cio
  2007-08-13 13:07 [kj] is_power_of_2 in drivers/s390/cio vignesh babu
@ 2007-08-15 10:12   ` Heiko Carstens
  0 siblings, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2007-08-15 10:12 UTC (permalink / raw)
  To: linux-s390, kernel-janitors

On Mon, Aug 13, 2007 at 06:25:05PM +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/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
> index 8633dc5..c00ebf4 100644
> --- a/drivers/s390/cio/device_fsm.c
> +++ b/drivers/s390/cio/device_fsm.c
> @@ -12,6 +12,7 @@
>  #include <linux/init.h>
>  #include <linux/jiffies.h>
>  #include <linux/string.h>
> +#include <linux/log2.h>
> 
>  #include <asm/ccwdev.h>
>  #include <asm/cio.h>
> @@ -1129,7 +1130,7 @@ device_trigger_reprobe(struct subchannel *sch)
>  	sch->schib.pmcw.isc = 3;
>  	sch->schib.pmcw.csense = 1;
>  	sch->schib.pmcw.ena = 0;
> -	if ((sch->lpm & (sch->lpm - 1)) != 0)
> +	if (!is_power_of_2(sch->lpm))
>  		sch->schib.pmcw.mp = 1;
>  	sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
>  	/* We should also udate ssd info, but this has to wait. */

This changes the path taken if sch->lpm = 0. Therefore NOT applied.
_______________________________________________
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/cio
@ 2007-08-15 10:12   ` Heiko Carstens
  0 siblings, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2007-08-15 10:12 UTC (permalink / raw)
  To: linux-s390, kernel-janitors

On Mon, Aug 13, 2007 at 06:25:05PM +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/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
> index 8633dc5..c00ebf4 100644
> --- a/drivers/s390/cio/device_fsm.c
> +++ b/drivers/s390/cio/device_fsm.c
> @@ -12,6 +12,7 @@
>  #include <linux/init.h>
>  #include <linux/jiffies.h>
>  #include <linux/string.h>
> +#include <linux/log2.h>
> 
>  #include <asm/ccwdev.h>
>  #include <asm/cio.h>
> @@ -1129,7 +1130,7 @@ device_trigger_reprobe(struct subchannel *sch)
>  	sch->schib.pmcw.isc = 3;
>  	sch->schib.pmcw.csense = 1;
>  	sch->schib.pmcw.ena = 0;
> -	if ((sch->lpm & (sch->lpm - 1)) != 0)
> +	if (!is_power_of_2(sch->lpm))
>  		sch->schib.pmcw.mp = 1;
>  	sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
>  	/* We should also udate ssd info, but this has to wait. */

This changes the path taken if sch->lpm == 0. Therefore NOT applied.

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

end of thread, other threads:[~2007-08-15 10:12 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:07 [kj] is_power_of_2 in drivers/s390/cio vignesh babu
2007-08-15 10:12 ` Heiko Carstens
2007-08-15 10:12   ` 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.