1 #ifndef __QCOM_SMEM_STATE__
2 #define __QCOM_SMEM_STATE__
3 
4 #include <linux/errno.h>
5 
6 struct device_node;
7 struct qcom_smem_state;
8 
9 struct qcom_smem_state_ops {
10 	int (*update_bits)(void *, u32, u32);
11 };
12 
13 #ifdef CONFIG_QCOM_SMEM_STATE
14 
15 struct qcom_smem_state *qcom_smem_state_get(struct device *dev, const char *con_id, unsigned *bit);
16 void qcom_smem_state_put(struct qcom_smem_state *);
17 
18 int qcom_smem_state_update_bits(struct qcom_smem_state *state, u32 mask, u32 value);
19 
20 struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, const struct qcom_smem_state_ops *ops, void *data);
21 void qcom_smem_state_unregister(struct qcom_smem_state *state);
22 
23 #else
24 
25 static inline struct qcom_smem_state *qcom_smem_state_get(struct device *dev,
26 	const char *con_id, unsigned *bit)
27 {
28 	return ERR_PTR(-EINVAL);
29 }
30 
31 static inline void qcom_smem_state_put(struct qcom_smem_state *state)
32 {
33 }
34 
35 static inline int qcom_smem_state_update_bits(struct qcom_smem_state *state,
36 	u32 mask, u32 value)
37 {
38 	return -EINVAL;
39 }
40 
41 static inline struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node,
42 	const struct qcom_smem_state_ops *ops, void *data)
43 {
44 	return ERR_PTR(-EINVAL);
45 }
46 
47 static inline void qcom_smem_state_unregister(struct qcom_smem_state *state)
48 {
49 }
50 
51 #endif
52 
53 #endif
54