Lines Matching refs:max_elems
63 static inline int pvrdma_idx_valid(__u32 idx, __u32 max_elems) in pvrdma_idx_valid() argument
66 return (idx & ~((max_elems << 1) - 1)) == 0; in pvrdma_idx_valid()
69 static inline __s32 pvrdma_idx(atomic_t *var, __u32 max_elems) in pvrdma_idx() argument
73 if (pvrdma_idx_valid(idx, max_elems)) in pvrdma_idx()
74 return idx & (max_elems - 1); in pvrdma_idx()
78 static inline void pvrdma_idx_ring_inc(atomic_t *var, __u32 max_elems) in pvrdma_idx_ring_inc() argument
82 idx &= (max_elems << 1) - 1; /* Modulo size, flip gen. */ in pvrdma_idx_ring_inc()
87 __u32 max_elems, __u32 *out_tail) in pvrdma_idx_ring_has_space() argument
92 if (pvrdma_idx_valid(tail, max_elems) && in pvrdma_idx_ring_has_space()
93 pvrdma_idx_valid(head, max_elems)) { in pvrdma_idx_ring_has_space()
94 *out_tail = tail & (max_elems - 1); in pvrdma_idx_ring_has_space()
95 return tail != (head ^ max_elems); in pvrdma_idx_ring_has_space()
101 __u32 max_elems, __u32 *out_head) in pvrdma_idx_ring_has_data() argument
106 if (pvrdma_idx_valid(tail, max_elems) && in pvrdma_idx_ring_has_data()
107 pvrdma_idx_valid(head, max_elems)) { in pvrdma_idx_ring_has_data()
108 *out_head = head & (max_elems - 1); in pvrdma_idx_ring_has_data()