treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / wireless / quantenna / qtnfmac / shm_ipc.h
blob52cac5439b03da93d9b575a9e1827b30208923a5
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */
4 #ifndef _QTN_FMAC_SHM_IPC_H_
5 #define _QTN_FMAC_SHM_IPC_H_
7 #include <linux/workqueue.h>
8 #include <linux/completion.h>
9 #include <linux/mutex.h>
10 #include <linux/spinlock.h>
12 #include "shm_ipc_defs.h"
14 #define QTN_SHM_IPC_ACK_TIMEOUT (2 * HZ)
16 struct qtnf_shm_ipc_int {
17 void (*fn)(void *arg);
18 void *arg;
21 struct qtnf_shm_ipc_rx_callback {
22 void (*fn)(void *arg, const u8 __iomem *buf, size_t len);
23 void *arg;
26 enum qtnf_shm_ipc_direction {
27 QTNF_SHM_IPC_OUTBOUND = BIT(0),
28 QTNF_SHM_IPC_INBOUND = BIT(1),
31 struct qtnf_shm_ipc {
32 struct qtnf_shm_ipc_region __iomem *shm_region;
33 enum qtnf_shm_ipc_direction direction;
34 size_t tx_packet_count;
35 size_t rx_packet_count;
37 size_t tx_timeout_count;
39 u8 waiting_for_ack;
41 struct qtnf_shm_ipc_int interrupt;
42 struct qtnf_shm_ipc_rx_callback rx_callback;
44 void (*irq_handler)(struct qtnf_shm_ipc *ipc);
46 struct workqueue_struct *workqueue;
47 struct work_struct irq_work;
48 struct completion tx_completion;
51 int qtnf_shm_ipc_init(struct qtnf_shm_ipc *ipc,
52 enum qtnf_shm_ipc_direction direction,
53 struct qtnf_shm_ipc_region __iomem *shm_region,
54 struct workqueue_struct *workqueue,
55 const struct qtnf_shm_ipc_int *interrupt,
56 const struct qtnf_shm_ipc_rx_callback *rx_callback);
57 void qtnf_shm_ipc_free(struct qtnf_shm_ipc *ipc);
58 int qtnf_shm_ipc_send(struct qtnf_shm_ipc *ipc, const u8 *buf, size_t size);
60 static inline void qtnf_shm_ipc_irq_handler(struct qtnf_shm_ipc *ipc)
62 ipc->irq_handler(ipc);
65 #endif /* _QTN_FMAC_SHM_IPC_H_ */