Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty/ldsem: Remove unused ldsem_down_write_trylock

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>

authored by

Dr. David Alan Gilbert and committed by
Greg Kroah-Hartman
42e128c9 f0c8814c

-18
-17
drivers/tty/tty_ldsem.c
··· 367 367 } 368 368 369 369 /* 370 - * trylock for writing -- returns 1 if successful, 0 if contention 371 - */ 372 - int ldsem_down_write_trylock(struct ld_semaphore *sem) 373 - { 374 - long count = atomic_long_read(&sem->count); 375 - 376 - while ((count & LDSEM_ACTIVE_MASK) == 0) { 377 - if (atomic_long_try_cmpxchg(&sem->count, &count, count + LDSEM_WRITE_BIAS)) { 378 - rwsem_acquire(&sem->dep_map, 0, 1, _RET_IP_); 379 - lock_acquired(&sem->dep_map, _RET_IP_); 380 - return 1; 381 - } 382 - } 383 - return 0; 384 - } 385 - 386 - /* 387 370 * release a read lock 388 371 */ 389 372 void ldsem_up_read(struct ld_semaphore *sem)
-1
include/linux/tty_ldisc.h
··· 39 39 int ldsem_down_read(struct ld_semaphore *sem, long timeout); 40 40 int ldsem_down_read_trylock(struct ld_semaphore *sem); 41 41 int ldsem_down_write(struct ld_semaphore *sem, long timeout); 42 - int ldsem_down_write_trylock(struct ld_semaphore *sem); 43 42 void ldsem_up_read(struct ld_semaphore *sem); 44 43 void ldsem_up_write(struct ld_semaphore *sem); 45 44