diff mbox series

[22/38] ra6w: add q.h

Message ID 20250417135236.52410-23-oleksandr.savchenko.dn@bp.renesas.com
State New
Headers show
Series wireless: ra6w driver for Renesas IEEE 802.11ax devices | expand

Commit Message

Alexander Savchenko April 17, 2025, 1:52 p.m. UTC
Part of the split. Please, take a look at the cover letter for more details

Reviewed-by: Viktor Barna <viktor.barna.rj@bp.renesas.com>
Reviewed-by: Gal Gur <gal.gur.jx@renesas.com>
Signed-off-by: Alexander Savchenko <oleksandr.savchenko.dn@bp.renesas.com>
---
 drivers/net/wireless/renesas/ra6w/q.h | 39 +++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 drivers/net/wireless/renesas/ra6w/q.h
diff mbox series

Patch

diff --git a/drivers/net/wireless/renesas/ra6w/q.h b/drivers/net/wireless/renesas/ra6w/q.h
new file mode 100644
index 000000000000..5f8a165ae84d
--- /dev/null
+++ b/drivers/net/wireless/renesas/ra6w/q.h
@@ -0,0 +1,39 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) [2022-2025] Renesas Electronics Corporation and/or its affiliates.
+ */
+
+#ifndef RA6W_Q_H
+#define RA6W_Q_H
+
+#include <linux/kernel.h>
+#include <linux/circ_buf.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/completion.h>
+
+struct ra6w_q {
+	size_t max_count;
+	unsigned long head;
+	unsigned long tail;
+	spinlock_t lock;
+	void **buf;
+};
+
+struct ra6w_q_event {
+	atomic_t condition;
+	wait_queue_head_t wait_queue;
+	u32 timeout;
+};
+
+int ra6w_q_init(struct ra6w_q *q, size_t max_count, size_t buf_size);
+bool ra6w_q_empty(struct ra6w_q *q);
+int ra6w_q_push(struct ra6w_q *q, void *buf);
+void *ra6w_q_pop(struct ra6w_q *q);
+void ra6w_q_event_set(struct ra6w_q_event *event, int event_val);
+bool ra6w_q_event_condition(const struct ra6w_q_event *event, int event_mask, int *ret_event);
+int ra6w_q_wait(struct ra6w_q_event *event, int event_mask);
+int ra6w_q_wait_timeout(struct ra6w_q_event *event, int event_mask);
+void ra6w_q_deinit(struct ra6w_q *q);
+
+#endif /* RA6W_Q_H */