mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
thunderbolt: Add tb_ring_poll_pending()
This helper can be used to figure out whether tb_ring_poll() has a frame to be returned. This can be used without the caller needing to take its own lock. Assisted-by: LLM Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
4d84caebab
commit
de9d89b408
|
|
@ -454,6 +454,25 @@ struct ring_frame *tb_ring_poll(struct tb_ring *ring)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(tb_ring_poll);
|
||||
|
||||
/**
|
||||
* tb_ring_poll_pending() - Does the ring have completed frame
|
||||
* @ring: Ring to check
|
||||
*
|
||||
* Can be used to check whether there is a completed frame in the ring
|
||||
* that next call to tb_ring_poll() returns.
|
||||
*
|
||||
* Return: %true if a completed frame is waiting, %false otherwise.
|
||||
*/
|
||||
bool tb_ring_poll_pending(struct tb_ring *ring)
|
||||
{
|
||||
guard(spinlock_irqsave)(&ring->lock);
|
||||
|
||||
if (!ring->running || ring_empty(ring))
|
||||
return false;
|
||||
return !!(ring->descriptors[ring->tail].flags & RING_DESC_COMPLETED);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tb_ring_poll_pending);
|
||||
|
||||
static void __ring_interrupt_mask(struct tb_ring *ring, bool mask)
|
||||
{
|
||||
int interrupt_index = ring_interrupt_index(ring);
|
||||
|
|
|
|||
|
|
@ -754,6 +754,7 @@ static inline int tb_ring_tx_more(struct tb_ring *ring, struct ring_frame *frame
|
|||
|
||||
/* Used only when the ring is in polling mode */
|
||||
struct ring_frame *tb_ring_poll(struct tb_ring *ring);
|
||||
bool tb_ring_poll_pending(struct tb_ring *ring);
|
||||
void tb_ring_poll_complete(struct tb_ring *ring);
|
||||
|
||||
int tb_ring_throttling(struct tb_ring *ring, unsigned int interval_nsec);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user