Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1463507

[RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

From zijun_hu <zijun_hu@zoho.com>
Newsgroups linux.kernel
Subject [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope
Date 2016-08-16 09:50 +0200
Message-ID <s6Hii-c3-29@gated-at.bofh.it> (permalink)
References <s6G2R-7Xd-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: zijun_hu <zijun_hu@htc.com>

move out get_count_order[_long]() definitions from scope limited
by macro __KERNEL__

it not only make both functions available in wider region regardless
of whether __KERNEL__ is defined but also keep original region for
get_count_order() before the recent commit c513b4cd2fe9
("mm-vmalloc-fix-align-value-calculation-error-v2-fix-fix") 

Signed-off-by: zijun_hu <zijun_hu@htc.com>
---
 this patch is based on the newest mmotm/linux-next tree and can
 be applied directly

 include/linux/bitops.h | 52 +++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 6f202c8fe4a6..a83c822c35c2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -181,6 +181,32 @@ static inline unsigned fls_long(unsigned long l)
 	return fls64(l);
 }
 
+static inline int get_count_order(unsigned int count)
+{
+	int order;
+
+	order = fls(count) - 1;
+	if (count & (count - 1))
+		order++;
+	return order;
+}
+
+/**
+ * get_count_order_long - get order after rounding @l up to power of 2
+ * @l: parameter
+ *
+ * it is same as get_count_order() but with long type parameter
+ */
+static inline int get_count_order_long(unsigned long l)
+{
+	if (l == 0UL)
+		return -1;
+	else if (l & (l - 1UL))
+		return (int)fls_long(l);
+	else
+		return (int)fls_long(l) - 1;
+}
+
 /**
  * __ffs64 - find first set bit in a 64 bit word
  * @word: The 64 bit word
@@ -233,32 +259,6 @@ static inline unsigned long __ffs64(u64 word)
 })
 #endif
 
-static inline int get_count_order(unsigned int count)
-{
-	int order;
-
-	order = fls(count) - 1;
-	if (count & (count - 1))
-		order++;
-	return order;
-}
-
-/**
- * get_count_order_long - get order after rounding @l up to power of 2
- * @l: parameter
- *
- * it is same as get_count_order() but with long type parameter
- */
-static inline int get_count_order_long(unsigned long l)
-{
-	if (l == 0UL)
-		return -1;
-	else if (l & (l - 1UL))
-		return (int)fls_long(l);
-	else
-		return (int)fls_long(l) - 1;
-}
-
 #ifndef find_last_bit
 /**
  * find_last_bit - find the last set bit in a memory region
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-16 08:30 +0200
  Re: [PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope Stephen Rothwell <sfr@canb.auug.org.au> - 2016-08-16 09:00 +0200
    Re: [PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-16 09:30 +0200
  [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-16 09:50 +0200
    Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-17 19:30 +0200
      Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-18 02:00 +0200
        Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-18 02:20 +0200
          Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-18 02:30 +0200
            Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-18 03:00 +0200
        Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-18 03:10 +0200

csiph-web