| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: ISC |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | |
|---|
| 17 | 6 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 140 | 129 | |
|---|
| 141 | 130 | lockdep_assert_held(&ar->conf_mutex); |
|---|
| 142 | 131 | |
|---|
| 132 | + if (!test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) |
|---|
| 133 | + return; |
|---|
| 134 | + |
|---|
| 143 | 135 | if (!ar->wmi.ops->gen_pdev_set_quiet_mode) |
|---|
| 144 | 136 | return; |
|---|
| 145 | 137 | |
|---|
| .. | .. |
|---|
| 164 | 156 | struct thermal_cooling_device *cdev; |
|---|
| 165 | 157 | struct device *hwmon_dev; |
|---|
| 166 | 158 | int ret; |
|---|
| 159 | + |
|---|
| 160 | + if (!test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) |
|---|
| 161 | + return 0; |
|---|
| 167 | 162 | |
|---|
| 168 | 163 | cdev = thermal_cooling_device_register("ath10k_thermal", ar, |
|---|
| 169 | 164 | &ath10k_thermal_ops); |
|---|
| .. | .. |
|---|
| 216 | 211 | |
|---|
| 217 | 212 | void ath10k_thermal_unregister(struct ath10k *ar) |
|---|
| 218 | 213 | { |
|---|
| 214 | + if (!test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) |
|---|
| 215 | + return; |
|---|
| 216 | + |
|---|
| 219 | 217 | sysfs_remove_link(&ar->dev->kobj, "cooling_device"); |
|---|
| 220 | 218 | thermal_cooling_device_unregister(ar->thermal.cdev); |
|---|
| 221 | 219 | } |
|---|