xref: /wlan-driver/qcacld-3.0/core/pld/src/pld_internal.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef __PLD_COMMON_I_H__
21 #define __PLD_COMMON_I_H__
22 
23 #include "pld_common.h"
24 
25 struct dev_node {
26 	struct device *dev;
27 	struct device *ifdev;
28 	struct list_head list;
29 	enum pld_bus_type bus_type;
30 };
31 
32 struct pld_context {
33 	struct pld_driver_ops *ops;
34 	spinlock_t pld_lock;
35 	struct list_head dev_list;
36 	uint32_t pld_driver_state;
37 	uint8_t mode;
38 };
39 
40 /**
41  * pld_get_global_context() - Get global context of PLD
42  *
43  * Return: PLD global context
44  */
45 struct pld_context *pld_get_global_context(void);
46 
47 /**
48  * pld_add_dev() - Add dev node to global context
49  * @pld_context: PLD global context
50  * @dev: device
51  * @ifdev: interface device
52  * @type: Bus type
53  *
54  * Return: 0 for success
55  *         Non zero failure code for errors
56  */
57 int pld_add_dev(struct pld_context *pld_context,
58 		struct device *dev, struct device *ifdev,
59 		enum pld_bus_type type);
60 
61 /**
62  * pld_del_dev() - Delete dev node from global context
63  * @pld_context: PLD global context
64  * @dev: device
65  *
66  * Return: void
67  */
68 void pld_del_dev(struct pld_context *pld_context,
69 		 struct device *dev);
70 
71 #endif
72