linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: lib/bitops.c: fix wrong return type
@ 2013-03-12 13:00 Zhi-zhou Zhang
  2013-03-12 13:54 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Zhi-zhou Zhang @ 2013-03-12 13:00 UTC (permalink / raw)
  To: ralf, linux-mips, linux-kernel; +Cc: Zhi-zhou Zhang

Here should return 64-bit types rather than 32-bit types. Or we
may get wrong return value if high 32-bit isn't equal to zero.

Signed-off-by: Zhi-zhou Zhang <zhizhou.zh@gmail.com>
---
 arch/mips/include/asm/bitops.h |    8 ++++----
 arch/mips/lib/bitops.c         |   10 ++++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 71305a8..7502601 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -51,13 +51,13 @@
 void __mips_set_bit(unsigned long nr, volatile unsigned long *addr);
 void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr);
 void __mips_change_bit(unsigned long nr, volatile unsigned long *addr);
-int __mips_test_and_set_bit(unsigned long nr,
+unsigned long __mips_test_and_set_bit(unsigned long nr,
 			    volatile unsigned long *addr);
-int __mips_test_and_set_bit_lock(unsigned long nr,
+unsigned long __mips_test_and_set_bit_lock(unsigned long nr,
 				 volatile unsigned long *addr);
-int __mips_test_and_clear_bit(unsigned long nr,
+unsigned long __mips_test_and_clear_bit(unsigned long nr,
 			      volatile unsigned long *addr);
-int __mips_test_and_change_bit(unsigned long nr,
+unsigned long __mips_test_and_change_bit(unsigned long nr,
 			       volatile unsigned long *addr);
 
 
diff --git a/arch/mips/lib/bitops.c b/arch/mips/lib/bitops.c
index 81f1dcf..f8d14fc 100644
--- a/arch/mips/lib/bitops.c
+++ b/arch/mips/lib/bitops.c
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(__mips_change_bit);
  * @nr: Bit to set
  * @addr: Address to count from
  */
-int __mips_test_and_set_bit(unsigned long nr,
+unsigned long __mips_test_and_set_bit(unsigned long nr,
 			    volatile unsigned long *addr)
 {
 	volatile unsigned long *a = addr;
@@ -109,7 +109,7 @@ EXPORT_SYMBOL(__mips_test_and_set_bit);
  * @nr: Bit to set
  * @addr: Address to count from
  */
-int __mips_test_and_set_bit_lock(unsigned long nr,
+unsigned long __mips_test_and_set_bit_lock(unsigned long nr,
 				 volatile unsigned long *addr)
 {
 	volatile unsigned long *a = addr;
@@ -135,7 +135,8 @@ EXPORT_SYMBOL(__mips_test_and_set_bit_lock);
  * @nr: Bit to clear
  * @addr: Address to count from
  */
-int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
+unsigned long __mips_test_and_clear_bit(unsigned long nr,
+				volatile unsigned long *addr)
 {
 	volatile unsigned long *a = addr;
 	unsigned bit = nr & SZLONG_MASK;
@@ -160,7 +161,8 @@ EXPORT_SYMBOL(__mips_test_and_clear_bit);
  * @nr: Bit to change
  * @addr: Address to count from
  */
-int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
+unsigned long __mips_test_and_change_bit(unsigned long nr,
+				volatile unsigned long *addr)
 {
 	volatile unsigned long *a = addr;
 	unsigned bit = nr & SZLONG_MASK;
-- 
1.7.9.5


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

* Re: [PATCH] mips: lib/bitops.c: fix wrong return type
  2013-03-12 13:00 [PATCH] mips: lib/bitops.c: fix wrong return type Zhi-zhou Zhang
@ 2013-03-12 13:54 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2013-03-12 13:54 UTC (permalink / raw)
  To: Zhi-zhou Zhang; +Cc: linux-mips, linux-kernel

On Tue, Mar 12, 2013 at 09:00:53PM +0800, Zhi-zhou Zhang wrote:

> Here should return 64-bit types rather than 32-bit types. Or we
> may get wrong return value if high 32-bit isn't equal to zero.

David Daney's patch which I've applied not two hours before you posted
this patch solves the same issue though a different way.  So I'm just
going to drop this patch.

Thanks anyway!

  Ralf

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

end of thread, other threads:[~2013-03-12 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12 13:00 [PATCH] mips: lib/bitops.c: fix wrong return type Zhi-zhou Zhang
2013-03-12 13:54 ` Ralf Baechle

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).