From: Hirokazu Takata <takata@linux-m32r.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Matthew Wilcox <matthew@wil.cx>,
takata@linux-m32r.org
Subject: [PATCH] m32r: Revise __raw_read_trylock()
Date: Fri, 22 Sep 2006 15:29:53 +0900 [thread overview]
Message-ID: <swfzmcse7mm.wl%takata@linux-m32r.org> (raw)
Hi,
Matthew Wilcox pointed out that generic__raw_read_trylock() is
unfit for use.
Here is a patch to fix __raw_read_trylock() for m32r.
It is taken from the i386 implementation.
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Cc: Matthew Wilcox <matthew@wil.cx>
---
include/asm-m32r/spinlock.h | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index f94c1a6..78205f0 100644
--- a/include/asm-m32r/spinlock.h
+++ b/include/asm-m32r/spinlock.h
@@ -298,7 +298,15 @@ #endif /* CONFIG_CHIP_M32700_TS1 */
);
}
-#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
+static inline int __raw_read_trylock(raw_rwlock_t *lock)
+{
+ atomic_t *count = (atomic_t*)lock;
+ atomic_dec(count);
+ if (atomic_read(count) >= 0)
+ return 1;
+ atomic_inc(count);
+ return 0;
+}
static inline int __raw_write_trylock(raw_rwlock_t *lock)
{
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project: http://www.linux-m32r.org/
next reply other threads:[~2006-09-22 6:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-22 6:29 Hirokazu Takata [this message]
2006-09-22 7:48 ` Paul Mundt
2006-09-22 11:27 ` Matthew Wilcox
2006-09-25 6:09 ` Paul Mundt
2006-09-24 6:20 ` Matthew Wilcox
2006-09-25 7:47 ` Hirokazu Takata
2006-09-26 21:33 ` Andrew Morton
2006-09-26 22:29 ` Matthew Wilcox
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=swfzmcse7mm.wl%takata@linux-m32r.org \
--to=takata@linux-m32r.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
/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
Powered by JetHome