mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Replace conditional test with is_power_of_2().
@ 2009-04-24 12:59 Robert P. J. Day
  0 siblings, 0 replies; only message in thread
From: Robert P. J. Day @ 2009-04-24 12:59 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Andrew Morton


Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

  yes, i know the word "tachnique" is misspelled there.  that's not
part of this patch so i'm not fixing it here.


diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index bc41ad0..04a1748 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -74,7 +74,7 @@ struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock)
 	 * round up to the next power of 2, since our 'let the indices
 	 * wrap' tachnique works only in this case.
 	 */
-	if (size & (size - 1)) {
+	if (!is_power_of_2(size)) {
 		BUG_ON(size > 0x80000000);
 		size = roundup_pow_of_two(size);
 	}

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-24 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 12:59 [PATCH] Replace conditional test with is_power_of_2() Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®