From d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 11 Dec 2023 02:45:28 +0000 Subject: [PATCH] add boot partition size --- kernel/drivers/thermal/thermal_hwmon.c | 36 +++++++++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-) diff --git a/kernel/drivers/thermal/thermal_hwmon.c b/kernel/drivers/thermal/thermal_hwmon.c index dd5d8ee..8b92e00 100644 --- a/kernel/drivers/thermal/thermal_hwmon.c +++ b/kernel/drivers/thermal/thermal_hwmon.c @@ -10,10 +10,12 @@ * Copyright (C) 2013 Texas Instruments * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com> */ -#include <linux/hwmon.h> -#include <linux/thermal.h> -#include <linux/slab.h> #include <linux/err.h> +#include <linux/export.h> +#include <linux/hwmon.h> +#include <linux/slab.h> +#include <linux/thermal.h> + #include "thermal_hwmon.h" /* hwmon sys I/F */ @@ -248,3 +250,31 @@ kfree(hwmon); } EXPORT_SYMBOL_GPL(thermal_remove_hwmon_sysfs); + +static void devm_thermal_hwmon_release(struct device *dev, void *res) +{ + thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res); +} + +int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) +{ + struct thermal_zone_device **ptr; + int ret; + + ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return -ENOMEM; + + ret = thermal_add_hwmon_sysfs(tz); + if (ret) { + devres_free(ptr); + return ret; + } + + *ptr = tz; + devres_add(&tz->device, ptr); + + return ret; +} +EXPORT_SYMBOL_GPL(devm_thermal_add_hwmon_sysfs); -- Gitblit v1.6.2