]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tty/ldsem: Remove unused ldsem_down_write_trylock
authorDr. David Alan Gilbert <linux@treblig.org>
Wed, 22 Jan 2025 01:25:59 +0000 (01:25 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Feb 2025 13:38:42 +0000 (14:38 +0100)
ldsem_down_write_trylock() was added in 2013 by
commit 4898e640caf0 ("tty: Add timed, writer-prioritized rw semaphore")
but hasn't been used.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250122012559.441006-1-linux@treblig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_ldsem.c
include/linux/tty_ldisc.h

index 3be428c1626097465ebbe7f7b598afb6631ace15..4e18031a5ca3dc0b3eb969f501d1039c6b2bcfdf 100644 (file)
@@ -366,23 +366,6 @@ int __sched ldsem_down_write(struct ld_semaphore *sem, long timeout)
        return __ldsem_down_write_nested(sem, 0, timeout);
 }
 
-/*
- * trylock for writing -- returns 1 if successful, 0 if contention
- */
-int ldsem_down_write_trylock(struct ld_semaphore *sem)
-{
-       long count = atomic_long_read(&sem->count);
-
-       while ((count & LDSEM_ACTIVE_MASK) == 0) {
-               if (atomic_long_try_cmpxchg(&sem->count, &count, count + LDSEM_WRITE_BIAS)) {
-                       rwsem_acquire(&sem->dep_map, 0, 1, _RET_IP_);
-                       lock_acquired(&sem->dep_map, _RET_IP_);
-                       return 1;
-               }
-       }
-       return 0;
-}
-
 /*
  * release a read lock
  */
index af01e89074b2d3fb55c6def86ed5e5966e9a80ff..c5cccc3fc1e8dceb0adb7db5e987c3f2724d4f5a 100644 (file)
@@ -39,7 +39,6 @@ do {                                                          \
 int ldsem_down_read(struct ld_semaphore *sem, long timeout);
 int ldsem_down_read_trylock(struct ld_semaphore *sem);
 int ldsem_down_write(struct ld_semaphore *sem, long timeout);
-int ldsem_down_write_trylock(struct ld_semaphore *sem);
 void ldsem_up_read(struct ld_semaphore *sem);
 void ldsem_up_write(struct ld_semaphore *sem);