From patchwork Thu Jun 6 09:37:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 2678391 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 03A41DF23A for ; Thu, 6 Jun 2013 09:39:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkWew-0007eA-G9; Thu, 06 Jun 2013 09:39:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkWem-00030O-Tq; Thu, 06 Jun 2013 09:38:56 +0000 Received: from intranet.asianux.com ([58.214.24.6]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkWej-0002yw-Rq for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2013 09:38:55 +0000 Received: by intranet.asianux.com (Postfix, from userid 103) id CA85C1840251; Thu, 6 Jun 2013 17:38:31 +0800 (CST) X-Spam-Score: -100.8 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on intranet.asianux.com X-Spam-Level: X-Spam-Status: No, score=-100.8 required=5.0 tests=AWL,BAYES_00, RATWARE_GECKO_BUILD,USER_IN_WHITELIST autolearn=no version=3.1.9 Received: from [10.1.0.143] (unknown [219.143.36.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by intranet.asianux.com (Postfix) with ESMTP id 3E5A61840251; Thu, 6 Jun 2013 17:38:30 +0800 (CST) Message-ID: <51B05865.30305@asianux.com> Date: Thu, 06 Jun 2013 17:37:41 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: =?UTF-8?B?VXdlIEtsZWluZS1Lw7ZuaWc=?= , Russell King - ARM Linux , Geert Uytterhoeven Subject: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other References: <51AE8FEF.1020809@asianux.com> <51AE903C.6010806@asianux.com> <51AE909D.9080006@asianux.com> <20130605071915.GK23140@pengutronix.de> <51AF225A.5020703@asianux.com> In-Reply-To: <51AF225A.5020703@asianux.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130606_053854_567805_991F39AF X-CRM114-Status: GOOD ( 13.77 ) X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linux-Arch , linux-m68k , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..83e4d3a 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..817dd70 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size;