drivers/net/wireless/ath/ath11k/thermal.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/thermal.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/ath11k/thermal.c
Extension
.c
Size
5702 bytes
Lines
231
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (IS_ERR(cdev)) {
			ath11k_err(ab, "failed to setup thermal device result: %ld\n",
				   PTR_ERR(cdev));
			ret = -EINVAL;
			goto err_thermal_destroy;
		}

		ar->thermal.cdev = cdev;

		ret = sysfs_create_link(&ar->hw->wiphy->dev.kobj, &cdev->device.kobj,
					"cooling_device");
		if (ret) {
			ath11k_err(ab, "failed to create cooling device symlink\n");
			goto err_thermal_destroy;
		}

		if (!IS_REACHABLE(CONFIG_HWMON))
			return 0;

		hwmon_dev = devm_hwmon_device_register_with_groups(&ar->hw->wiphy->dev,
								   "ath11k_hwmon", ar,
								   ath11k_hwmon_groups);
		if (IS_ERR(hwmon_dev)) {
			ath11k_err(ar->ab, "failed to register hwmon device: %ld\n",
				   PTR_ERR(hwmon_dev));
			ret = -EINVAL;
			goto err_thermal_destroy;
		}
	}

	return 0;

err_thermal_destroy:
	ath11k_thermal_unregister(ab);
	return ret;
}

void ath11k_thermal_unregister(struct ath11k_base *ab)
{
	struct ath11k *ar;
	struct ath11k_pdev *pdev;
	int i;

	for (i = 0; i < ab->num_radios; i++) {
		pdev = &ab->pdevs[i];
		ar = pdev->ar;
		if (!ar)
			continue;

		sysfs_remove_link(&ar->hw->wiphy->dev.kobj, "cooling_device");
		thermal_cooling_device_unregister(ar->thermal.cdev);
	}
}

Annotation

Implementation Notes