forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/wireless/ath/ath10k/thermal.c
....@@ -1,17 +1,6 @@
1
+// SPDX-License-Identifier: ISC
12 /*
23 * Copyright (c) 2014-2015 Qualcomm Atheros, Inc.
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.
154 */
165
176 #include <linux/device.h>
....@@ -140,6 +129,9 @@
140129
141130 lockdep_assert_held(&ar->conf_mutex);
142131
132
+ if (!test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map))
133
+ return;
134
+
143135 if (!ar->wmi.ops->gen_pdev_set_quiet_mode)
144136 return;
145137
....@@ -164,6 +156,9 @@
164156 struct thermal_cooling_device *cdev;
165157 struct device *hwmon_dev;
166158 int ret;
159
+
160
+ if (!test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map))
161
+ return 0;
167162
168163 cdev = thermal_cooling_device_register("ath10k_thermal", ar,
169164 &ath10k_thermal_ops);
....@@ -216,6 +211,9 @@
216211
217212 void ath10k_thermal_unregister(struct ath10k *ar)
218213 {
214
+ if (!test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map))
215
+ return;
216
+
219217 sysfs_remove_link(&ar->dev->kobj, "cooling_device");
220218 thermal_cooling_device_unregister(ar->thermal.cdev);
221219 }