1 /*
2 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /**
18 * DOC: wlan_hdd_sysfs_suspend_resume.h
19 *
20 * implementation for creating sysfs file crash_inject
21 */
22
23 #ifndef _WLAN_HDD_SYSFS_SUSPEND_RESUME_H
24 #define _WLAN_HDD_SYSFS_SUSPEND_RESUME_H
25
26 #if defined(WLAN_SYSFS) && defined(WLAN_SUSPEND_RESUME_TEST)
27 /**
28 * hdd_sysfs_suspend_create() - API to create wlan_suspend
29 * @adapter: hdd adapter
30 *
31 * this file is created per adapter.
32 * file path: /sys/class/net/wlan_xx/wlan_suspend
33 * (wlan_xx is adapter name)
34 * usage:
35 * echo [arg_0] [arg_1] > wlan_suspend
36 * arg_0 from enum wow_interface_pause
37 * arg_1 from enum wow_resume_trigger
38 *
39 * Return: 0 on success and errno on failure
40 */
41 int hdd_sysfs_suspend_create(struct hdd_adapter *adapter);
42
43 /**
44 * hdd_sysfs_suspend_destroy() -
45 * API to destroy wlan_suspend sys file
46 * @adapter: pointer to adapter
47 *
48 * Return: none
49 */
50 void hdd_sysfs_suspend_destroy(struct hdd_adapter *adapter);
51
52 /**
53 * hdd_sysfs_resume_create() - API to create wlan_resume
54 * @adapter: hdd adapter
55 *
56 * this file is created per adapter.
57 * file path: /sys/class/net/wlan_xx/wlan_resume
58 * (wlan_xx is adapter name)
59 * usage:
60 * echo > wlan_resume
61 *
62 *
63 * Return: 0 on success and errno on failure
64 */
65 int hdd_sysfs_resume_create(struct hdd_adapter *adapter);
66
67 /**
68 * hdd_sysfs_resume_destroy() -
69 * API to destroy wlan_resume sys file
70 * @adapter: pointer to adapter
71 *
72 * Return: none
73 */
74 void hdd_sysfs_resume_destroy(struct hdd_adapter *adapter);
75 #else
76 static inline int
hdd_sysfs_suspend_create(struct hdd_adapter * adapter)77 hdd_sysfs_suspend_create(struct hdd_adapter *adapter)
78 {
79 return 0;
80 }
81
82 static inline void
hdd_sysfs_suspend_destroy(struct hdd_adapter * adapter)83 hdd_sysfs_suspend_destroy(struct hdd_adapter *adapter)
84 {
85 }
86
87 static inline int
hdd_sysfs_resume_create(struct hdd_adapter * adapter)88 hdd_sysfs_resume_create(struct hdd_adapter *adapter)
89 {
90 return 0;
91 }
92
93 static inline void
hdd_sysfs_resume_destroy(struct hdd_adapter * adapter)94 hdd_sysfs_resume_destroy(struct hdd_adapter *adapter)
95 {
96 }
97 #endif
98 #endif /* #ifndef _WLAN_HDD_SYSFS_SUSPEND_RESUME_H */
99