diff mbox series

[16/38] ra6w: add if.h

Message ID 20250417135236.52410-17-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/if.h | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 drivers/net/wireless/renesas/ra6w/if.h
diff mbox series

Patch

diff --git a/drivers/net/wireless/renesas/ra6w/if.h b/drivers/net/wireless/renesas/ra6w/if.h
new file mode 100644
index 000000000000..35fc7d2865d4
--- /dev/null
+++ b/drivers/net/wireless/renesas/ra6w/if.h
@@ -0,0 +1,41 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) [2022-2025] Renesas Electronics Corporation and/or its affiliates.
+ */
+
+#ifndef RA6W_IF_H
+#define RA6W_IF_H
+
+struct ra6w_if_ops {
+	int (*read)(struct sdio_func *func, void *data, int len);
+	int (*write)(struct sdio_func *func, void *data, int len);
+};
+
+struct ra6w_if_dev {
+	struct sdio_func *func;
+	bool dev_on_resume;
+};
+
+struct ra6w_if {
+	struct ra6w_core core;
+	struct ra6w_if_dev dev;
+	const struct ra6w_if_ops *ops;
+};
+
+static inline int ra6w_if_read(struct ra6w_if *ifp, void *buf, int len)
+{
+	if (ifp->core.recovery.in_recovery)
+		return -EINPROGRESS;
+
+	return ifp->ops->read(ifp->dev.func, buf, len);
+}
+
+static inline int ra6w_if_write(struct ra6w_if *ifp, void *buf, int len)
+{
+	if (ifp->core.recovery.in_recovery)
+		return -EINPROGRESS;
+
+	return ifp->ops->write(ifp->dev.func, buf, len);
+}
+
+#endif /* RA6W_IF_H */