linux-hexagon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hexagon: fix return type of ffs()
@ 2013-08-07 13:42 Akinobu Mita
  2013-08-07 13:42 ` [PATCH 2/2] cris: " Akinobu Mita
  2013-08-14 16:06 ` [PATCH 1/2] hexagon: " Richard Kuo
  0 siblings, 2 replies; 3+ messages in thread
From: Akinobu Mita @ 2013-08-07 13:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Akinobu Mita, Mikael Starvik, Jesper Nilsson, linux-cris-kernel,
	Richard Kuo, linux-hexagon, linux-arch

The return type of ffs() is 'int' on all architectures except cris and
hexagon.  This unifies the return type to 'int'.

The problem I'm seeing is that the following line generates a warning
on cris and hexagon because of the mismatch between format '%u' and
return type of ffs().

	printk("bits in OOB size: %u\n",	ffs(ns->geom.oobsz) - 1);

But removing this warning by casting to 'int' looks odd, so I suggest
unifying the return type of ffs() on all architectures.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: linux-cris-kernel@axis.com
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-arch@vger.kernel.org
---
This patch is not compile tested yet, because I couldn't find cross
compiler for hexagon.

 arch/hexagon/include/asm/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h
index 9b1e4af..80e34a6 100644
--- a/arch/hexagon/include/asm/bitops.h
+++ b/arch/hexagon/include/asm/bitops.h
@@ -234,7 +234,7 @@ static inline long fls(int x)
  * the libc and compiler builtin ffs routines, therefore
  * differs in spirit from the above ffz (man ffs).
  */
-static inline long ffs(int x)
+static inline int ffs(int x)
 {
 	int r;
 
-- 
1.8.3.1

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

* [PATCH 2/2] cris: fix return type of ffs()
  2013-08-07 13:42 [PATCH 1/2] hexagon: fix return type of ffs() Akinobu Mita
@ 2013-08-07 13:42 ` Akinobu Mita
  2013-08-14 16:06 ` [PATCH 1/2] hexagon: " Richard Kuo
  1 sibling, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2013-08-07 13:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Akinobu Mita, Mikael Starvik, Jesper Nilsson, linux-cris-kernel,
	Richard Kuo, linux-hexagon, linux-arch

The return type of ffs() is 'int' on all architectures except cris and
hexagon.  This unifies the return type to 'int'.

The problem I'm seeing is that the following line generates a warning
on cris and hexagon because of the mismatch between format '%u' and
return type of ffs().

	printk("bits in OOB size: %u\n",	ffs(ns->geom.oobsz) - 1);

But removing this warning by casting to 'int' looks odd, so I suggest
unifying the return type of ffs() on all architectures.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: linux-cris-kernel@axis.com
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-arch@vger.kernel.org
---
 arch/cris/include/arch-v10/arch/bitops.h | 2 +-
 arch/cris/include/arch-v32/arch/bitops.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/bitops.h b/arch/cris/include/arch-v10/arch/bitops.h
index 03d9cfd..cc37a22 100644
--- a/arch/cris/include/arch-v10/arch/bitops.h
+++ b/arch/cris/include/arch-v10/arch/bitops.h
@@ -65,7 +65,7 @@ static inline unsigned long __ffs(unsigned long word)
  * differs in spirit from the above ffz (man ffs).
  */
 
-static inline unsigned long kernel_ffs(unsigned long w)
+static inline int kernel_ffs(unsigned long w)
 {
 	return w ? cris_swapwbrlz (w) + 1 : 0;
 }
diff --git a/arch/cris/include/arch-v32/arch/bitops.h b/arch/cris/include/arch-v32/arch/bitops.h
index 147689d6..a5d0963 100644
--- a/arch/cris/include/arch-v32/arch/bitops.h
+++ b/arch/cris/include/arch-v32/arch/bitops.h
@@ -55,7 +55,7 @@ __ffs(unsigned long w)
 /*
  * Find First Bit that is set.
  */
-static inline unsigned long
+static inline int
 kernel_ffs(unsigned long w)
 {
 	return w ? cris_swapwbrlz (w) + 1 : 0;
-- 
1.8.3.1

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

* Re: [PATCH 1/2] hexagon: fix return type of ffs()
  2013-08-07 13:42 [PATCH 1/2] hexagon: fix return type of ffs() Akinobu Mita
  2013-08-07 13:42 ` [PATCH 2/2] cris: " Akinobu Mita
@ 2013-08-14 16:06 ` Richard Kuo
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Kuo @ 2013-08-14 16:06 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: linux-kernel, Mikael Starvik, Jesper Nilsson, linux-cris-kernel,
	linux-hexagon, linux-arch

On 08/07/2013 08:42 AM, Akinobu Mita wrote:
> The return type of ffs() is 'int' on all architectures except cris and
> hexagon.  This unifies the return type to 'int'.
>
> The problem I'm seeing is that the following line generates a warning
> on cris and hexagon because of the mismatch between format '%u' and
> return type of ffs().
>
> 	printk("bits in OOB size: %u\n",	ffs(ns->geom.oobsz) - 1);
>
> But removing this warning by casting to 'int' looks odd, so I suggest
> unifying the return type of ffs() on all architectures.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: Mikael Starvik <starvik@axis.com>
> Cc: Jesper Nilsson <jesper.nilsson@axis.com>
> Cc: linux-cris-kernel@axis.com
> Cc: Richard Kuo <rkuo@codeaurora.org>
> Cc: linux-hexagon@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> ---
> This patch is not compile tested yet, because I couldn't find cross
> compiler for hexagon.
>
>   arch/hexagon/include/asm/bitops.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h
> index 9b1e4af..80e34a6 100644
> --- a/arch/hexagon/include/asm/bitops.h
> +++ b/arch/hexagon/include/asm/bitops.h
> @@ -234,7 +234,7 @@ static inline long fls(int x)
>    * the libc and compiler builtin ffs routines, therefore
>    * differs in spirit from the above ffz (man ffs).
>    */
> -static inline long ffs(int x)
> +static inline int ffs(int x)
>   {
>   	int r;
>   

For Hexagon:

Acked-by: Richard Kuo <rkuo@codeaurora.org>

-- 

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

end of thread, other threads:[~2013-08-14 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 13:42 [PATCH 1/2] hexagon: fix return type of ffs() Akinobu Mita
2013-08-07 13:42 ` [PATCH 2/2] cris: " Akinobu Mita
2013-08-14 16:06 ` [PATCH 1/2] hexagon: " Richard Kuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).