thermal_hwmon.c (7ae9fb1b7ecbb5d85d07857943f677fd1a559b18) | thermal_hwmon.c (4a16c190f761cb3a87dcbbf355f91c71ce1f8c0b) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * thermal_hwmon.c - Generic Thermal Management hwmon support. 4 * 5 * Code based on Intel thermal_core.c. Copyrights of the original code: 6 * Copyright (C) 2008 Intel Corp 7 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 8 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> --- 249 unchanged lines hidden (view full) --- 258} 259EXPORT_SYMBOL_GPL(thermal_remove_hwmon_sysfs); 260 261static void devm_thermal_hwmon_release(struct device *dev, void *res) 262{ 263 thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res); 264} 265 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * thermal_hwmon.c - Generic Thermal Management hwmon support. 4 * 5 * Code based on Intel thermal_core.c. Copyrights of the original code: 6 * Copyright (C) 2008 Intel Corp 7 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 8 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> --- 249 unchanged lines hidden (view full) --- 258} 259EXPORT_SYMBOL_GPL(thermal_remove_hwmon_sysfs); 260 261static void devm_thermal_hwmon_release(struct device *dev, void *res) 262{ 263 thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res); 264} 265 |
266int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | 266int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz) |
267{ 268 struct thermal_zone_device **ptr; 269 int ret; 270 271 ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr), 272 GFP_KERNEL); 273 if (!ptr) 274 return -ENOMEM; 275 276 ret = thermal_add_hwmon_sysfs(tz); 277 if (ret) { 278 devres_free(ptr); 279 return ret; 280 } 281 282 *ptr = tz; | 267{ 268 struct thermal_zone_device **ptr; 269 int ret; 270 271 ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr), 272 GFP_KERNEL); 273 if (!ptr) 274 return -ENOMEM; 275 276 ret = thermal_add_hwmon_sysfs(tz); 277 if (ret) { 278 devres_free(ptr); 279 return ret; 280 } 281 282 *ptr = tz; |
283 devres_add(&tz->device, ptr); | 283 devres_add(dev, ptr); |
284 285 return ret; 286} 287EXPORT_SYMBOL_GPL(devm_thermal_add_hwmon_sysfs); 288 289MODULE_IMPORT_NS(HWMON_THERMAL); | 284 285 return ret; 286} 287EXPORT_SYMBOL_GPL(devm_thermal_add_hwmon_sysfs); 288 289MODULE_IMPORT_NS(HWMON_THERMAL); |