mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhi-zhou Zhang <zhizhou.zh@gmail.com>
To: ralf@linux-mips.org, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org
Cc: Zhi-zhou Zhang <zhizhou.zh@gmail.com>
Subject: [PATCH] mips: lib/bitops.c: fix wrong return type
Date: Tue, 12 Mar 2013 21:00:53 +0800	[thread overview]
Message-ID: <1363093253-17595-1-git-send-email-zhizhou.zh@gmail.com> (raw)
In-Reply-To: <n>

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


             reply	other threads:[~2013-03-12 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 13:00 Zhi-zhou Zhang [this message]
2013-03-12 13:54 ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363093253-17595-1-git-send-email-zhizhou.zh@gmail.com \
    --to=zhizhou.zh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®