Lines Matching refs:s

71 static inline void __seqcount_init(seqcount_t *s, const char *name,  in __seqcount_init()  argument
77 lockdep_init_map(&s->dep_map, name, key, 0); in __seqcount_init()
78 s->sequence = 0; in __seqcount_init()
90 # define seqcount_init(s) \ argument
93 __seqcount_init((s), #s, &__key); \
96 static inline void seqcount_lockdep_reader_access(const seqcount_t *s) in seqcount_lockdep_reader_access() argument
98 seqcount_t *l = (seqcount_t *)s; in seqcount_lockdep_reader_access()
109 # define seqcount_init(s) __seqcount_init(s, NULL, NULL) argument
175 #define seqcount_LOCKNAME_init(s, _lock, lockname) \ argument
177 seqcount_##lockname##_t *____s = (s); \
182 #define seqcount_raw_spinlock_init(s, lock) seqcount_LOCKNAME_init(s, lock, raw_spinlock) argument
183 #define seqcount_spinlock_init(s, lock) seqcount_LOCKNAME_init(s, lock, spinlock) argument
184 #define seqcount_rwlock_init(s, lock) seqcount_LOCKNAME_init(s, lock, rwlock) argument
185 #define seqcount_mutex_init(s, lock) seqcount_LOCKNAME_init(s, lock, mutex) argument
205 __seqprop_##lockname##_ptr(seqcount_##lockname##_t *s) \
207 return &s->seqcount; \
211 __seqprop_##lockname##_sequence(const seqcount_##lockname##_t *s) \
213 unsigned seq = READ_ONCE(s->seqcount.sequence); \
220 __SEQ_LOCK(lockbase##_unlock(s->lock)); \
226 seq = READ_ONCE(s->seqcount.sequence); \
233 __seqprop_##lockname##_preemptible(const seqcount_##lockname##_t *s) \
243 __seqprop_##lockname##_assert(const seqcount_##lockname##_t *s) \
252 static inline seqcount_t *__seqprop_ptr(seqcount_t *s) in __seqprop_ptr() argument
254 return s; in __seqprop_ptr()
257 static inline unsigned __seqprop_sequence(const seqcount_t *s) in __seqprop_sequence() argument
259 return READ_ONCE(s->sequence); in __seqprop_sequence()
262 static inline bool __seqprop_preemptible(const seqcount_t *s) in __seqprop_preemptible() argument
267 static inline void __seqprop_assert(const seqcount_t *s) in __seqprop_assert() argument
274 …COUNT_LOCKNAME(raw_spinlock, raw_spinlock_t, false, s->lock, raw_spin, raw_spin_lock(s-…
275 SEQCOUNT_LOCKNAME(spinlock, spinlock_t, __SEQ_RT, s->lock, spin, spin_lock(s->l…
276 SEQCOUNT_LOCKNAME(rwlock, rwlock_t, __SEQ_RT, s->lock, read, read_lock(s->l…
277 SEQCOUNT_LOCKNAME(mutex, struct mutex, true, s->lock, mutex, mutex_lock(s->…
296 #define __seqprop_case(s, lockname, prop) \ argument
297 seqcount_##lockname##_t: __seqprop_##lockname##_##prop((void *)(s))
299 #define __seqprop(s, prop) _Generic(*(s), \ argument
300 seqcount_t: __seqprop_##prop((void *)(s)), \
301 __seqprop_case((s), raw_spinlock, prop), \
302 __seqprop_case((s), spinlock, prop), \
303 __seqprop_case((s), rwlock, prop), \
304 __seqprop_case((s), mutex, prop))
306 #define seqprop_ptr(s) __seqprop(s, ptr) argument
307 #define seqprop_sequence(s) __seqprop(s, sequence) argument
308 #define seqprop_preemptible(s) __seqprop(s, preemptible) argument
309 #define seqprop_assert(s) __seqprop(s, assert) argument
325 #define __read_seqcount_begin(s) \ argument
329 while ((__seq = seqprop_sequence(s)) & 1) \
342 #define raw_read_seqcount_begin(s) \ argument
344 unsigned _seq = __read_seqcount_begin(s); \
356 #define read_seqcount_begin(s) \ argument
358 seqcount_lockdep_reader_access(seqprop_ptr(s)); \
359 raw_read_seqcount_begin(s); \
373 #define raw_read_seqcount(s) \ argument
375 unsigned __seq = seqprop_sequence(s); \
399 #define raw_seqcount_begin(s) \ argument
405 raw_read_seqcount(s) & ~1; \
423 #define __read_seqcount_retry(s, start) \ argument
424 do___read_seqcount_retry(seqprop_ptr(s), start)
426 static inline int do___read_seqcount_retry(const seqcount_t *s, unsigned start) in do___read_seqcount_retry() argument
429 return unlikely(READ_ONCE(s->sequence) != start); in do___read_seqcount_retry()
443 #define read_seqcount_retry(s, start) \ argument
444 do_read_seqcount_retry(seqprop_ptr(s), start)
446 static inline int do_read_seqcount_retry(const seqcount_t *s, unsigned start) in do_read_seqcount_retry() argument
449 return do___read_seqcount_retry(s, start); in do_read_seqcount_retry()
458 #define raw_write_seqcount_begin(s) \ argument
460 if (seqprop_preemptible(s)) \
463 do_raw_write_seqcount_begin(seqprop_ptr(s)); \
466 static inline void do_raw_write_seqcount_begin(seqcount_t *s) in do_raw_write_seqcount_begin() argument
469 s->sequence++; in do_raw_write_seqcount_begin()
479 #define raw_write_seqcount_end(s) \ argument
481 do_raw_write_seqcount_end(seqprop_ptr(s)); \
483 if (seqprop_preemptible(s)) \
487 static inline void do_raw_write_seqcount_end(seqcount_t *s) in do_raw_write_seqcount_end() argument
490 s->sequence++; in do_raw_write_seqcount_end()
503 #define write_seqcount_begin_nested(s, subclass) \ argument
505 seqprop_assert(s); \
507 if (seqprop_preemptible(s)) \
510 do_write_seqcount_begin_nested(seqprop_ptr(s), subclass); \
513 static inline void do_write_seqcount_begin_nested(seqcount_t *s, int subclass) in do_write_seqcount_begin_nested() argument
515 seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_); in do_write_seqcount_begin_nested()
516 do_raw_write_seqcount_begin(s); in do_write_seqcount_begin_nested()
529 #define write_seqcount_begin(s) \ argument
531 seqprop_assert(s); \
533 if (seqprop_preemptible(s)) \
536 do_write_seqcount_begin(seqprop_ptr(s)); \
539 static inline void do_write_seqcount_begin(seqcount_t *s) in do_write_seqcount_begin() argument
541 do_write_seqcount_begin_nested(s, 0); in do_write_seqcount_begin()
551 #define write_seqcount_end(s) \ argument
553 do_write_seqcount_end(seqprop_ptr(s)); \
555 if (seqprop_preemptible(s)) \
559 static inline void do_write_seqcount_end(seqcount_t *s) in do_write_seqcount_end() argument
561 seqcount_release(&s->dep_map, _RET_IP_); in do_write_seqcount_end()
562 do_raw_write_seqcount_end(s); in do_write_seqcount_end()
606 #define raw_write_seqcount_barrier(s) \ argument
607 do_raw_write_seqcount_barrier(seqprop_ptr(s))
609 static inline void do_raw_write_seqcount_barrier(seqcount_t *s) in do_raw_write_seqcount_barrier() argument
612 s->sequence++; in do_raw_write_seqcount_barrier()
614 s->sequence++; in do_raw_write_seqcount_barrier()
626 #define write_seqcount_invalidate(s) \ argument
627 do_write_seqcount_invalidate(seqprop_ptr(s))
629 static inline void do_write_seqcount_invalidate(seqcount_t *s) in do_write_seqcount_invalidate() argument
633 s->sequence+=2; in do_write_seqcount_invalidate()
663 #define seqcount_latch_init(s) seqcount_init(&(s)->seqcount) argument
676 static __always_inline unsigned raw_read_seqcount_latch(const seqcount_latch_t *s) in raw_read_seqcount_latch() argument
682 return READ_ONCE(s->seqcount.sequence); in raw_read_seqcount_latch()
693 raw_read_seqcount_latch_retry(const seqcount_latch_t *s, unsigned start) in raw_read_seqcount_latch_retry() argument
696 return unlikely(READ_ONCE(s->seqcount.sequence) != start); in raw_read_seqcount_latch_retry()
780 static inline void raw_write_seqcount_latch(seqcount_latch_t *s) in raw_write_seqcount_latch() argument
783 s->seqcount.sequence++; in raw_write_seqcount_latch()