From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751870AbcHPG1Z (ORCPT ); Tue, 16 Aug 2016 02:27:25 -0400 Received: from sender153-mail.zoho.com ([74.201.84.153]:21774 "EHLO sender153-mail.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750785AbcHPG1Y (ORCPT ); Tue, 16 Aug 2016 02:27:24 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:subject:to:cc:message-id:date:user-agent:mime-version:content-type; b=aM+Q0oeSRjnLmy72l99hUKfOC+4HnQsXkGdxgDZBsB4pw4S5ZaxKwk5Z6DbkM6WmoYiml0Bb6gEj Ja1X3RAttWj5w3Oxb2SB2diNhlOOWgTvVoaip8nnujtE6PMwPQi2 From: zijun_hu Subject: [PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope To: Andrew Morton Cc: sfr@canb.auug.org.au, linux-kernel@vger.kernel.org Message-ID: <57B2B238.3030709@zoho.com> Date: Tue, 16 Aug 2016 14:27:04 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zijun_hu move out get_count_order[_long]() definitions from scope limited by macro __KERNEL__ Signed-off-by: zijun_hu --- 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