• Home
  • Raw
  • Download

Lines Matching refs:count

67 	atomic_long_set(&sem->count, LDSEM_UNLOCKED);  in __init_ldsem()
78 long adjust, count; in __ldsem_wake_readers() local
86 count = atomic_long_add_return(adjust, &sem->count); in __ldsem_wake_readers()
88 if (count > 0) in __ldsem_wake_readers()
90 if (atomic_long_try_cmpxchg(&sem->count, &count, count - adjust)) in __ldsem_wake_readers()
110 long count = atomic_long_add_return(LDSEM_ACTIVE_BIAS, &sem->count); in writer_trylock() local
112 if ((count & LDSEM_ACTIVE_MASK) == LDSEM_ACTIVE_BIAS) in writer_trylock()
114 if (atomic_long_try_cmpxchg(&sem->count, &count, count - LDSEM_ACTIVE_BIAS)) in writer_trylock()
156 down_read_failed(struct ld_semaphore *sem, long count, long timeout) in down_read_failed() argument
170 if (atomic_long_try_cmpxchg(&sem->count, &count, count + adjust)) { in down_read_failed()
171 count += adjust; in down_read_failed()
174 if (count > 0) { in down_read_failed()
187 if ((count & LDSEM_ACTIVE_MASK) == 0) in down_read_failed()
213 atomic_long_add_return(-LDSEM_WAIT_BIAS, &sem->count); in down_read_failed()
230 down_write_failed(struct ld_semaphore *sem, long count, long timeout) in down_write_failed() argument
245 if (atomic_long_try_cmpxchg(&sem->count, &count, count + adjust)) in down_write_failed()
247 if ((count & LDSEM_ACTIVE_MASK) == LDSEM_ACTIVE_BIAS) { in down_write_failed()
271 atomic_long_add_return(-LDSEM_WAIT_BIAS, &sem->count); in down_write_failed()
298 long count; in __ldsem_down_read_nested() local
302 count = atomic_long_add_return(LDSEM_READ_BIAS, &sem->count); in __ldsem_down_read_nested()
303 if (count <= 0) { in __ldsem_down_read_nested()
305 if (!down_read_failed(sem, count, timeout)) { in __ldsem_down_read_nested()
317 long count; in __ldsem_down_write_nested() local
321 count = atomic_long_add_return(LDSEM_WRITE_BIAS, &sem->count); in __ldsem_down_write_nested()
322 if ((count & LDSEM_ACTIVE_MASK) != LDSEM_ACTIVE_BIAS) { in __ldsem_down_write_nested()
324 if (!down_write_failed(sem, count, timeout)) { in __ldsem_down_write_nested()
348 long count = atomic_long_read(&sem->count); in ldsem_down_read_trylock() local
350 while (count >= 0) { in ldsem_down_read_trylock()
351 if (atomic_long_try_cmpxchg(&sem->count, &count, count + LDSEM_READ_BIAS)) { in ldsem_down_read_trylock()
374 long count = atomic_long_read(&sem->count); in ldsem_down_write_trylock() local
376 while ((count & LDSEM_ACTIVE_MASK) == 0) { in ldsem_down_write_trylock()
377 if (atomic_long_try_cmpxchg(&sem->count, &count, count + LDSEM_WRITE_BIAS)) { in ldsem_down_write_trylock()
391 long count; in ldsem_up_read() local
395 count = atomic_long_add_return(-LDSEM_READ_BIAS, &sem->count); in ldsem_up_read()
396 if (count < 0 && (count & LDSEM_ACTIVE_MASK) == 0) in ldsem_up_read()
405 long count; in ldsem_up_write() local
409 count = atomic_long_add_return(-LDSEM_WRITE_BIAS, &sem->count); in ldsem_up_write()
410 if (count < 0) in ldsem_up_write()