public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/ARM: fix ARMs __ffs() to conform to avoid warning with NO_BOOTMEM
@ 2013-12-14  0:38 Santosh Shilimkar
  2013-12-20 22:39 ` Santosh Shilimkar
  0 siblings, 1 reply; 4+ messages in thread
From: Santosh Shilimkar @ 2013-12-14  0:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, Santosh Shilimkar, Andrew Morton, Russell King

Building ARM with NO_BOOTMEM generates below warning.

mm/nobootmem.c: In function _____free_pages_memory___:
mm/nobootmem.c:88:11: warning: comparison of distinct pointer types lacks a cast

	order = min(MAX_ORDER - 1UL, __ffs(start));

ARM's __ffs() differs from other architectures in that it ends up being
an int, whereas almost everyone else is unsigned long.

So fix ARMs __ffs() to conform to other architectures. Suggested by
Russell King <linux@arm.linux.org.uk>

Some more details in below thread -
	https://lkml.org/lkml/2013/12/9/807

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 arch/arm/include/asm/bitops.h |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index e691ec9..5f41d81 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -270,10 +270,25 @@ static inline int fls(int x)
 	return ret;
 }
 
-#define __fls(x) (fls(x) - 1)
-#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
-#define __ffs(x) (ffs(x) - 1)
-#define ffz(x) __ffs( ~(x) )
+static inline unsigned long __fls(unsigned long x)
+{
+	return fls(x) - 1;
+}
+
+static inline int ffs(int x)
+{
+	return fls(x & -x);
+}
+
+static inline unsigned long __ffs(unsigned long x)
+{
+	return ffs(x) - 1;
+}
+
+static inline unsigned long ffz(unsigned long x)
+{
+	return __ffs(~x);
+}
 
 #endif
 
-- 
1.7.9.5


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

* Re: [PATCH] mm/ARM: fix ARMs __ffs() to conform to avoid warning with NO_BOOTMEM
  2013-12-14  0:38 [PATCH] mm/ARM: fix ARMs __ffs() to conform to avoid warning with NO_BOOTMEM Santosh Shilimkar
@ 2013-12-20 22:39 ` Santosh Shilimkar
  2013-12-20 22:55   ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Santosh Shilimkar @ 2013-12-20 22:39 UTC (permalink / raw)
  To: Russell King
  Cc: Santosh Shilimkar, linux-kernel, linux-arm-kernel, Andrew Morton

Russell,

On Friday 13 December 2013 07:38 PM, Santosh Shilimkar wrote:
> Building ARM with NO_BOOTMEM generates below warning.
> 
> mm/nobootmem.c: In function _____free_pages_memory___:
> mm/nobootmem.c:88:11: warning: comparison of distinct pointer types lacks a cast
> 
> 	order = min(MAX_ORDER - 1UL, __ffs(start));
> 
> ARM's __ffs() differs from other architectures in that it ends up being
> an int, whereas almost everyone else is unsigned long.
> 
> So fix ARMs __ffs() to conform to other architectures. Suggested by
> Russell King <linux@arm.linux.org.uk>
> 
> Some more details in below thread -
> 	https://lkml.org/lkml/2013/12/9/807
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Russell King <linux@arm.linux.org.uk>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> ---
Is this patch inline with what we discussed off-list ?
If you ack it, it can go into the Andrews tree to kill that one last
warning with the memblock series. Thanks


>  arch/arm/include/asm/bitops.h |   23 +++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
> index e691ec9..5f41d81 100644
> --- a/arch/arm/include/asm/bitops.h
> +++ b/arch/arm/include/asm/bitops.h
> @@ -270,10 +270,25 @@ static inline int fls(int x)
>  	return ret;
>  }
>  
> -#define __fls(x) (fls(x) - 1)
> -#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
> -#define __ffs(x) (ffs(x) - 1)
> -#define ffz(x) __ffs( ~(x) )
> +static inline unsigned long __fls(unsigned long x)
> +{
> +	return fls(x) - 1;
> +}
> +
> +static inline int ffs(int x)
> +{
> +	return fls(x & -x);
> +}
> +
> +static inline unsigned long __ffs(unsigned long x)
> +{
> +	return ffs(x) - 1;
> +}
> +
> +static inline unsigned long ffz(unsigned long x)
> +{
> +	return __ffs(~x);
> +}
>  
>  #endif
>  
> 


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

* Re: [PATCH] mm/ARM: fix ARMs __ffs() to conform to avoid warning with NO_BOOTMEM
  2013-12-20 22:39 ` Santosh Shilimkar
@ 2013-12-20 22:55   ` Russell King - ARM Linux
  2013-12-20 23:05     ` Santosh Shilimkar
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2013-12-20 22:55 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: linux-kernel, linux-arm-kernel, Andrew Morton

On Fri, Dec 20, 2013 at 05:39:25PM -0500, Santosh Shilimkar wrote:
> Russell,
> 
> On Friday 13 December 2013 07:38 PM, Santosh Shilimkar wrote:
> > Building ARM with NO_BOOTMEM generates below warning.
> > 
> > mm/nobootmem.c: In function _____free_pages_memory___:
> > mm/nobootmem.c:88:11: warning: comparison of distinct pointer types lacks a cast
> > 
> > 	order = min(MAX_ORDER - 1UL, __ffs(start));
> > 
> > ARM's __ffs() differs from other architectures in that it ends up being
> > an int, whereas almost everyone else is unsigned long.
> > 
> > So fix ARMs __ffs() to conform to other architectures. Suggested by
> > Russell King <linux@arm.linux.org.uk>
> > 
> > Some more details in below thread -
> > 	https://lkml.org/lkml/2013/12/9/807
> > 
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Russell King <linux@arm.linux.org.uk>
> > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> > ---
> Is this patch inline with what we discussed off-list ?

It is.

> If you ack it, it can go into the Andrews tree to kill that one last
> warning with the memblock series. Thanks

Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>

Please note that I'm rather busy at the moment dealing with a complete
change in networking here (I've not read much in the way of email over
the last couple of days).  Also note that my Internet connection is
highly unstable and experiencing a large amount of packet loss due to
this wonderful thing called "FTTC"... which when working properly only
gives me around 5Mbps.

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

* Re: [PATCH] mm/ARM: fix ARMs __ffs() to conform to avoid warning with NO_BOOTMEM
  2013-12-20 22:55   ` Russell King - ARM Linux
@ 2013-12-20 23:05     ` Santosh Shilimkar
  0 siblings, 0 replies; 4+ messages in thread
From: Santosh Shilimkar @ 2013-12-20 23:05 UTC (permalink / raw)
  To: Russell King - ARM Linux, Andrew Morton; +Cc: linux-kernel, linux-arm-kernel

On Friday 20 December 2013 05:55 PM, Russell King - ARM Linux wrote:
> On Fri, Dec 20, 2013 at 05:39:25PM -0500, Santosh Shilimkar wrote:
>> Russell,
>>
>> On Friday 13 December 2013 07:38 PM, Santosh Shilimkar wrote:
>>> Building ARM with NO_BOOTMEM generates below warning.
>>>
>>> mm/nobootmem.c: In function _____free_pages_memory___:
>>> mm/nobootmem.c:88:11: warning: comparison of distinct pointer types lacks a cast
>>>
>>> 	order = min(MAX_ORDER - 1UL, __ffs(start));
>>>
>>> ARM's __ffs() differs from other architectures in that it ends up being
>>> an int, whereas almost everyone else is unsigned long.
>>>
>>> So fix ARMs __ffs() to conform to other architectures. Suggested by
>>> Russell King <linux@arm.linux.org.uk>
>>>
>>> Some more details in below thread -
>>> 	https://lkml.org/lkml/2013/12/9/807
>>>
>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>> Cc: Russell King <linux@arm.linux.org.uk>
>>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>> ---
>> Is this patch inline with what we discussed off-list ?
> 
> It is.
> 
>> If you ack it, it can go into the Andrews tree to kill that one last
>> warning with the memblock series. Thanks
> 
> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
>
Great !!
 
Andrew,
Can you please pick the $subject patch as well in your
mm tree ? Thanks

regards,
Santosh

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

end of thread, other threads:[~2013-12-20 23:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-14  0:38 [PATCH] mm/ARM: fix ARMs __ffs() to conform to avoid warning with NO_BOOTMEM Santosh Shilimkar
2013-12-20 22:39 ` Santosh Shilimkar
2013-12-20 22:55   ` Russell King - ARM Linux
2013-12-20 23:05     ` Santosh Shilimkar

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