summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-06-13 09:30:24 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2008-06-13 09:30:24 +1000
commitf2b260ff8353b31ee8089887d5b6cab262332996 (patch)
treecda7cafe2733ab5f83027b775bc3704e3294f783 /include
parent5941429f1fafd0b23b72339b23b0dcc0ca62fa01 (diff)
misc:down_nowait
Deprecate down_trylock() down_trylock() returns 1 on failure, 0 on success. This differs from spin_trylock(), mutex_trylock() and common sense. Or as ocfs2 put it "kernel 1, world 0". Deprecate it and make down_try() the primary function. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
-rw-r--r--include/linux/semaphore.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
index 537b20957ca3..d245e6fade84 100644
--- a/include/linux/semaphore.h
+++ b/include/linux/semaphore.h
@@ -44,22 +44,12 @@ static inline void sema_init(struct semaphore *sem, int val)
extern void down(struct semaphore *sem);
extern int __must_check down_interruptible(struct semaphore *sem);
extern int __must_check down_killable(struct semaphore *sem);
-extern int __must_check down_trylock(struct semaphore *sem);
-extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
-extern void up(struct semaphore *sem);
-
-/**
- * down_try - try to down a semaphore, but don't block
- * @sem: the semaphore
- *
- * This is equivalent to down_trylock(), but has the same return codes as
- * spin_trylock and mutex_trylock: 1 if semaphore acquired, 0 if not.
- *
- * down_trylock() with its confusing return codes will be deprecated
- * soon. It will not be missed.
- */
-static inline int __must_check down_try(struct semaphore *sem)
+extern int __must_check down_try(struct semaphore *sem);
+/* Old down_trylock() returned the opposite of what was expected. */
+static inline int __deprecated down_trylock(struct semaphore *sem)
{
- return !down_trylock(sem);
+ return !down_try(sem);
}
+extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
+extern void up(struct semaphore *sem);
#endif /* __LINUX_SEMAPHORE_H */