[PATCH 6/9] thunderbolt: Add helper to figure size of the ring

Mika Westerberg
2026-04-28T07:22:18Z

Add to common header a function that returns size of the ring. This can
be used in the drivers instead of rolling own version.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
include/linux/thunderbolt.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h
index 1160e0bf5c5b..9df8a356396f 100644
--- a/include/linux/thunderbolt.h
+++ b/include/linux/thunderbolt.h
@@ -641,6 +641,11 @@ static inline size_t tb_ring_frame_size(const struct ring_frame *frame)
return TB_MAX_FRAME_SIZE;
}

+static inline size_t tb_ring_size(const struct tb_ring *ring)
+{
+ return ring->size;
+}
+
struct tb_ring *tb_ring_alloc_tx(struct tb_nhi *nhi, int hop, int size,
unsigned int flags);
struct tb_ring *tb_ring_alloc_rx(struct tb_nhi *nhi, int hop, int size,
--
2.50.1