Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: hwmon: move hwmon support to single file

In order to improve code organization, this patch
moves the hwmon sysfs support to a file named
thermal_hwmon. This helps to add extra support
for hwmon without scrambling the code.

In order to do this move, the hwmon list head is now
using its own locking. Before, the list used
the global thermal locking. Also, some minor changes
in the code were required, as recommended by checkpatch.pl.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>

+331 -254
+9
drivers/thermal/Kconfig
··· 17 17 18 18 config THERMAL_HWMON 19 19 bool 20 + prompt "Expose thermal sensors as hwmon device" 20 21 depends on HWMON=y || HWMON=THERMAL 21 22 default y 23 + help 24 + In case a sensor is registered with the thermal 25 + framework, this option will also register it 26 + as a hwmon. The sensor will then have the common 27 + hwmon sysfs interface. 28 + 29 + Say 'Y' here if you want all thermal sensors to 30 + have hwmon sysfs interface too. 22 31 23 32 choice 24 33 prompt "Default Thermal governor"
+3
drivers/thermal/Makefile
··· 5 5 obj-$(CONFIG_THERMAL) += thermal_sys.o 6 6 thermal_sys-y += thermal_core.o 7 7 8 + # interface to/from other layers providing sensors 9 + thermal_sys-$(CONFIG_THERMAL_HWMON) += thermal_hwmon.o 10 + 8 11 # governors 9 12 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += fair_share.o 10 13 thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE) += step_wise.o
+1 -254
drivers/thermal/thermal_core.c
··· 38 38 #include <net/genetlink.h> 39 39 40 40 #include "thermal_core.h" 41 + #include "thermal_hwmon.h" 41 42 42 43 MODULE_AUTHOR("Zhang Rui"); 43 44 MODULE_DESCRIPTION("Generic thermal management sysfs support"); ··· 859 858 } 860 859 861 860 /* Device management */ 862 - 863 - #if defined(CONFIG_THERMAL_HWMON) 864 - 865 - /* hwmon sys I/F */ 866 - #include <linux/hwmon.h> 867 - 868 - /* thermal zone devices with the same type share one hwmon device */ 869 - struct thermal_hwmon_device { 870 - char type[THERMAL_NAME_LENGTH]; 871 - struct device *device; 872 - int count; 873 - struct list_head tz_list; 874 - struct list_head node; 875 - }; 876 - 877 - struct thermal_hwmon_attr { 878 - struct device_attribute attr; 879 - char name[16]; 880 - }; 881 - 882 - /* one temperature input for each thermal zone */ 883 - struct thermal_hwmon_temp { 884 - struct list_head hwmon_node; 885 - struct thermal_zone_device *tz; 886 - struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ 887 - struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ 888 - }; 889 - 890 - static LIST_HEAD(thermal_hwmon_list); 891 - 892 - static ssize_t 893 - name_show(struct device *dev, struct device_attribute *attr, char *buf) 894 - { 895 - struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev); 896 - return sprintf(buf, "%s\n", hwmon->type); 897 - } 898 - static DEVICE_ATTR(name, 0444, name_show, NULL); 899 - 900 - static ssize_t 901 - temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) 902 - { 903 - long temperature; 904 - int ret; 905 - struct thermal_hwmon_attr *hwmon_attr 906 - = container_of(attr, struct thermal_hwmon_attr, attr); 907 - struct thermal_hwmon_temp *temp 908 - = container_of(hwmon_attr, struct thermal_hwmon_temp, 909 - temp_input); 910 - struct thermal_zone_device *tz = temp->tz; 911 - 912 - ret = thermal_zone_get_temp(tz, &temperature); 913 - 914 - if (ret) 915 - return ret; 916 - 917 - return sprintf(buf, "%ld\n", temperature); 918 - } 919 - 920 - static ssize_t 921 - temp_crit_show(struct device *dev, struct device_attribute *attr, 922 - char *buf) 923 - { 924 - struct thermal_hwmon_attr *hwmon_attr 925 - = container_of(attr, struct thermal_hwmon_attr, attr); 926 - struct thermal_hwmon_temp *temp 927 - = container_of(hwmon_attr, struct thermal_hwmon_temp, 928 - temp_crit); 929 - struct thermal_zone_device *tz = temp->tz; 930 - long temperature; 931 - int ret; 932 - 933 - ret = tz->ops->get_trip_temp(tz, 0, &temperature); 934 - if (ret) 935 - return ret; 936 - 937 - return sprintf(buf, "%ld\n", temperature); 938 - } 939 - 940 - 941 - static struct thermal_hwmon_device * 942 - thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) 943 - { 944 - struct thermal_hwmon_device *hwmon; 945 - 946 - mutex_lock(&thermal_list_lock); 947 - list_for_each_entry(hwmon, &thermal_hwmon_list, node) 948 - if (!strcmp(hwmon->type, tz->type)) { 949 - mutex_unlock(&thermal_list_lock); 950 - return hwmon; 951 - } 952 - mutex_unlock(&thermal_list_lock); 953 - 954 - return NULL; 955 - } 956 - 957 - /* Find the temperature input matching a given thermal zone */ 958 - static struct thermal_hwmon_temp * 959 - thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, 960 - const struct thermal_zone_device *tz) 961 - { 962 - struct thermal_hwmon_temp *temp; 963 - 964 - mutex_lock(&thermal_list_lock); 965 - list_for_each_entry(temp, &hwmon->tz_list, hwmon_node) 966 - if (temp->tz == tz) { 967 - mutex_unlock(&thermal_list_lock); 968 - return temp; 969 - } 970 - mutex_unlock(&thermal_list_lock); 971 - 972 - return NULL; 973 - } 974 - 975 - static int 976 - thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) 977 - { 978 - struct thermal_hwmon_device *hwmon; 979 - struct thermal_hwmon_temp *temp; 980 - int new_hwmon_device = 1; 981 - int result; 982 - 983 - hwmon = thermal_hwmon_lookup_by_type(tz); 984 - if (hwmon) { 985 - new_hwmon_device = 0; 986 - goto register_sys_interface; 987 - } 988 - 989 - hwmon = kzalloc(sizeof(struct thermal_hwmon_device), GFP_KERNEL); 990 - if (!hwmon) 991 - return -ENOMEM; 992 - 993 - INIT_LIST_HEAD(&hwmon->tz_list); 994 - strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); 995 - hwmon->device = hwmon_device_register(NULL); 996 - if (IS_ERR(hwmon->device)) { 997 - result = PTR_ERR(hwmon->device); 998 - goto free_mem; 999 - } 1000 - dev_set_drvdata(hwmon->device, hwmon); 1001 - result = device_create_file(hwmon->device, &dev_attr_name); 1002 - if (result) 1003 - goto free_mem; 1004 - 1005 - register_sys_interface: 1006 - temp = kzalloc(sizeof(struct thermal_hwmon_temp), GFP_KERNEL); 1007 - if (!temp) { 1008 - result = -ENOMEM; 1009 - goto unregister_name; 1010 - } 1011 - 1012 - temp->tz = tz; 1013 - hwmon->count++; 1014 - 1015 - snprintf(temp->temp_input.name, sizeof(temp->temp_input.name), 1016 - "temp%d_input", hwmon->count); 1017 - temp->temp_input.attr.attr.name = temp->temp_input.name; 1018 - temp->temp_input.attr.attr.mode = 0444; 1019 - temp->temp_input.attr.show = temp_input_show; 1020 - sysfs_attr_init(&temp->temp_input.attr.attr); 1021 - result = device_create_file(hwmon->device, &temp->temp_input.attr); 1022 - if (result) 1023 - goto free_temp_mem; 1024 - 1025 - if (tz->ops->get_crit_temp) { 1026 - unsigned long temperature; 1027 - if (!tz->ops->get_crit_temp(tz, &temperature)) { 1028 - snprintf(temp->temp_crit.name, 1029 - sizeof(temp->temp_crit.name), 1030 - "temp%d_crit", hwmon->count); 1031 - temp->temp_crit.attr.attr.name = temp->temp_crit.name; 1032 - temp->temp_crit.attr.attr.mode = 0444; 1033 - temp->temp_crit.attr.show = temp_crit_show; 1034 - sysfs_attr_init(&temp->temp_crit.attr.attr); 1035 - result = device_create_file(hwmon->device, 1036 - &temp->temp_crit.attr); 1037 - if (result) 1038 - goto unregister_input; 1039 - } 1040 - } 1041 - 1042 - mutex_lock(&thermal_list_lock); 1043 - if (new_hwmon_device) 1044 - list_add_tail(&hwmon->node, &thermal_hwmon_list); 1045 - list_add_tail(&temp->hwmon_node, &hwmon->tz_list); 1046 - mutex_unlock(&thermal_list_lock); 1047 - 1048 - return 0; 1049 - 1050 - unregister_input: 1051 - device_remove_file(hwmon->device, &temp->temp_input.attr); 1052 - free_temp_mem: 1053 - kfree(temp); 1054 - unregister_name: 1055 - if (new_hwmon_device) { 1056 - device_remove_file(hwmon->device, &dev_attr_name); 1057 - hwmon_device_unregister(hwmon->device); 1058 - } 1059 - free_mem: 1060 - if (new_hwmon_device) 1061 - kfree(hwmon); 1062 - 1063 - return result; 1064 - } 1065 - 1066 - static void 1067 - thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) 1068 - { 1069 - struct thermal_hwmon_device *hwmon; 1070 - struct thermal_hwmon_temp *temp; 1071 - 1072 - hwmon = thermal_hwmon_lookup_by_type(tz); 1073 - if (unlikely(!hwmon)) { 1074 - /* Should never happen... */ 1075 - dev_dbg(&tz->device, "hwmon device lookup failed!\n"); 1076 - return; 1077 - } 1078 - 1079 - temp = thermal_hwmon_lookup_temp(hwmon, tz); 1080 - if (unlikely(!temp)) { 1081 - /* Should never happen... */ 1082 - dev_dbg(&tz->device, "temperature input lookup failed!\n"); 1083 - return; 1084 - } 1085 - 1086 - device_remove_file(hwmon->device, &temp->temp_input.attr); 1087 - if (tz->ops->get_crit_temp) 1088 - device_remove_file(hwmon->device, &temp->temp_crit.attr); 1089 - 1090 - mutex_lock(&thermal_list_lock); 1091 - list_del(&temp->hwmon_node); 1092 - kfree(temp); 1093 - if (!list_empty(&hwmon->tz_list)) { 1094 - mutex_unlock(&thermal_list_lock); 1095 - return; 1096 - } 1097 - list_del(&hwmon->node); 1098 - mutex_unlock(&thermal_list_lock); 1099 - 1100 - device_remove_file(hwmon->device, &dev_attr_name); 1101 - hwmon_device_unregister(hwmon->device); 1102 - kfree(hwmon); 1103 - } 1104 - #else 1105 - static int 1106 - thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) 1107 - { 1108 - return 0; 1109 - } 1110 - 1111 - static void 1112 - thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) 1113 - { 1114 - } 1115 - #endif 1116 861 1117 862 /** 1118 863 * thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone
+269
drivers/thermal/thermal_hwmon.c
··· 1 + /* 2 + * thermal_hwmon.c - Generic Thermal Management hwmon support. 3 + * 4 + * Code based on Intel thermal_core.c. Copyrights of the original code: 5 + * Copyright (C) 2008 Intel Corp 6 + * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 7 + * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 8 + * 9 + * Copyright (C) 2013 Texas Instruments 10 + * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com> 11 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 + * 13 + * This program is free software; you can redistribute it and/or modify 14 + * it under the terms of the GNU General Public License as published by 15 + * the Free Software Foundation; version 2 of the License. 16 + * 17 + * This program is distributed in the hope that it will be useful, but 18 + * WITHOUT ANY WARRANTY; without even the implied warranty of 19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 + * General Public License for more details. 21 + * 22 + * You should have received a copy of the GNU General Public License along 23 + * with this program; if not, write to the Free Software Foundation, Inc., 24 + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 25 + * 26 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 + */ 28 + #include <linux/hwmon.h> 29 + #include <linux/thermal.h> 30 + #include <linux/slab.h> 31 + #include <linux/err.h> 32 + #include "thermal_hwmon.h" 33 + 34 + /* hwmon sys I/F */ 35 + /* thermal zone devices with the same type share one hwmon device */ 36 + struct thermal_hwmon_device { 37 + char type[THERMAL_NAME_LENGTH]; 38 + struct device *device; 39 + int count; 40 + struct list_head tz_list; 41 + struct list_head node; 42 + }; 43 + 44 + struct thermal_hwmon_attr { 45 + struct device_attribute attr; 46 + char name[16]; 47 + }; 48 + 49 + /* one temperature input for each thermal zone */ 50 + struct thermal_hwmon_temp { 51 + struct list_head hwmon_node; 52 + struct thermal_zone_device *tz; 53 + struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ 54 + struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ 55 + }; 56 + 57 + static LIST_HEAD(thermal_hwmon_list); 58 + 59 + static DEFINE_MUTEX(thermal_hwmon_list_lock); 60 + 61 + static ssize_t 62 + name_show(struct device *dev, struct device_attribute *attr, char *buf) 63 + { 64 + struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev); 65 + return sprintf(buf, "%s\n", hwmon->type); 66 + } 67 + static DEVICE_ATTR(name, 0444, name_show, NULL); 68 + 69 + static ssize_t 70 + temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) 71 + { 72 + long temperature; 73 + int ret; 74 + struct thermal_hwmon_attr *hwmon_attr 75 + = container_of(attr, struct thermal_hwmon_attr, attr); 76 + struct thermal_hwmon_temp *temp 77 + = container_of(hwmon_attr, struct thermal_hwmon_temp, 78 + temp_input); 79 + struct thermal_zone_device *tz = temp->tz; 80 + 81 + ret = thermal_zone_get_temp(tz, &temperature); 82 + 83 + if (ret) 84 + return ret; 85 + 86 + return sprintf(buf, "%ld\n", temperature); 87 + } 88 + 89 + static ssize_t 90 + temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf) 91 + { 92 + struct thermal_hwmon_attr *hwmon_attr 93 + = container_of(attr, struct thermal_hwmon_attr, attr); 94 + struct thermal_hwmon_temp *temp 95 + = container_of(hwmon_attr, struct thermal_hwmon_temp, 96 + temp_crit); 97 + struct thermal_zone_device *tz = temp->tz; 98 + long temperature; 99 + int ret; 100 + 101 + ret = tz->ops->get_trip_temp(tz, 0, &temperature); 102 + if (ret) 103 + return ret; 104 + 105 + return sprintf(buf, "%ld\n", temperature); 106 + } 107 + 108 + 109 + static struct thermal_hwmon_device * 110 + thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) 111 + { 112 + struct thermal_hwmon_device *hwmon; 113 + 114 + mutex_lock(&thermal_hwmon_list_lock); 115 + list_for_each_entry(hwmon, &thermal_hwmon_list, node) 116 + if (!strcmp(hwmon->type, tz->type)) { 117 + mutex_unlock(&thermal_hwmon_list_lock); 118 + return hwmon; 119 + } 120 + mutex_unlock(&thermal_hwmon_list_lock); 121 + 122 + return NULL; 123 + } 124 + 125 + /* Find the temperature input matching a given thermal zone */ 126 + static struct thermal_hwmon_temp * 127 + thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, 128 + const struct thermal_zone_device *tz) 129 + { 130 + struct thermal_hwmon_temp *temp; 131 + 132 + mutex_lock(&thermal_hwmon_list_lock); 133 + list_for_each_entry(temp, &hwmon->tz_list, hwmon_node) 134 + if (temp->tz == tz) { 135 + mutex_unlock(&thermal_hwmon_list_lock); 136 + return temp; 137 + } 138 + mutex_unlock(&thermal_hwmon_list_lock); 139 + 140 + return NULL; 141 + } 142 + 143 + int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) 144 + { 145 + struct thermal_hwmon_device *hwmon; 146 + struct thermal_hwmon_temp *temp; 147 + int new_hwmon_device = 1; 148 + int result; 149 + 150 + hwmon = thermal_hwmon_lookup_by_type(tz); 151 + if (hwmon) { 152 + new_hwmon_device = 0; 153 + goto register_sys_interface; 154 + } 155 + 156 + hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL); 157 + if (!hwmon) 158 + return -ENOMEM; 159 + 160 + INIT_LIST_HEAD(&hwmon->tz_list); 161 + strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); 162 + hwmon->device = hwmon_device_register(NULL); 163 + if (IS_ERR(hwmon->device)) { 164 + result = PTR_ERR(hwmon->device); 165 + goto free_mem; 166 + } 167 + dev_set_drvdata(hwmon->device, hwmon); 168 + result = device_create_file(hwmon->device, &dev_attr_name); 169 + if (result) 170 + goto free_mem; 171 + 172 + register_sys_interface: 173 + temp = kzalloc(sizeof(*temp), GFP_KERNEL); 174 + if (!temp) { 175 + result = -ENOMEM; 176 + goto unregister_name; 177 + } 178 + 179 + temp->tz = tz; 180 + hwmon->count++; 181 + 182 + snprintf(temp->temp_input.name, sizeof(temp->temp_input.name), 183 + "temp%d_input", hwmon->count); 184 + temp->temp_input.attr.attr.name = temp->temp_input.name; 185 + temp->temp_input.attr.attr.mode = 0444; 186 + temp->temp_input.attr.show = temp_input_show; 187 + sysfs_attr_init(&temp->temp_input.attr.attr); 188 + result = device_create_file(hwmon->device, &temp->temp_input.attr); 189 + if (result) 190 + goto free_temp_mem; 191 + 192 + if (tz->ops->get_crit_temp) { 193 + unsigned long temperature; 194 + if (!tz->ops->get_crit_temp(tz, &temperature)) { 195 + snprintf(temp->temp_crit.name, 196 + sizeof(temp->temp_crit.name), 197 + "temp%d_crit", hwmon->count); 198 + temp->temp_crit.attr.attr.name = temp->temp_crit.name; 199 + temp->temp_crit.attr.attr.mode = 0444; 200 + temp->temp_crit.attr.show = temp_crit_show; 201 + sysfs_attr_init(&temp->temp_crit.attr.attr); 202 + result = device_create_file(hwmon->device, 203 + &temp->temp_crit.attr); 204 + if (result) 205 + goto unregister_input; 206 + } 207 + } 208 + 209 + mutex_lock(&thermal_hwmon_list_lock); 210 + if (new_hwmon_device) 211 + list_add_tail(&hwmon->node, &thermal_hwmon_list); 212 + list_add_tail(&temp->hwmon_node, &hwmon->tz_list); 213 + mutex_unlock(&thermal_hwmon_list_lock); 214 + 215 + return 0; 216 + 217 + unregister_input: 218 + device_remove_file(hwmon->device, &temp->temp_input.attr); 219 + free_temp_mem: 220 + kfree(temp); 221 + unregister_name: 222 + if (new_hwmon_device) { 223 + device_remove_file(hwmon->device, &dev_attr_name); 224 + hwmon_device_unregister(hwmon->device); 225 + } 226 + free_mem: 227 + if (new_hwmon_device) 228 + kfree(hwmon); 229 + 230 + return result; 231 + } 232 + 233 + void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) 234 + { 235 + struct thermal_hwmon_device *hwmon; 236 + struct thermal_hwmon_temp *temp; 237 + 238 + hwmon = thermal_hwmon_lookup_by_type(tz); 239 + if (unlikely(!hwmon)) { 240 + /* Should never happen... */ 241 + dev_dbg(&tz->device, "hwmon device lookup failed!\n"); 242 + return; 243 + } 244 + 245 + temp = thermal_hwmon_lookup_temp(hwmon, tz); 246 + if (unlikely(!temp)) { 247 + /* Should never happen... */ 248 + dev_dbg(&tz->device, "temperature input lookup failed!\n"); 249 + return; 250 + } 251 + 252 + device_remove_file(hwmon->device, &temp->temp_input.attr); 253 + if (tz->ops->get_crit_temp) 254 + device_remove_file(hwmon->device, &temp->temp_crit.attr); 255 + 256 + mutex_lock(&thermal_hwmon_list_lock); 257 + list_del(&temp->hwmon_node); 258 + kfree(temp); 259 + if (!list_empty(&hwmon->tz_list)) { 260 + mutex_unlock(&thermal_hwmon_list_lock); 261 + return; 262 + } 263 + list_del(&hwmon->node); 264 + mutex_unlock(&thermal_hwmon_list_lock); 265 + 266 + device_remove_file(hwmon->device, &dev_attr_name); 267 + hwmon_device_unregister(hwmon->device); 268 + kfree(hwmon); 269 + }
+49
drivers/thermal/thermal_hwmon.h
··· 1 + /* 2 + * thermal_hwmon.h - Generic Thermal Management hwmon support. 3 + * 4 + * Code based on Intel thermal_core.c. Copyrights of the original code: 5 + * Copyright (C) 2008 Intel Corp 6 + * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 7 + * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 8 + * 9 + * Copyright (C) 2013 Texas Instruments 10 + * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com> 11 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 + * 13 + * This program is free software; you can redistribute it and/or modify 14 + * it under the terms of the GNU General Public License as published by 15 + * the Free Software Foundation; version 2 of the License. 16 + * 17 + * This program is distributed in the hope that it will be useful, but 18 + * WITHOUT ANY WARRANTY; without even the implied warranty of 19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 + * General Public License for more details. 21 + * 22 + * You should have received a copy of the GNU General Public License along 23 + * with this program; if not, write to the Free Software Foundation, Inc., 24 + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 25 + * 26 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 + */ 28 + #ifndef __THERMAL_HWMON_H__ 29 + #define __THERMAL_HWMON_H__ 30 + 31 + #include <linux/thermal.h> 32 + 33 + #ifdef CONFIG_THERMAL_HWMON 34 + int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); 35 + void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz); 36 + #else 37 + static int 38 + thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) 39 + { 40 + return 0; 41 + } 42 + 43 + static void 44 + thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) 45 + { 46 + } 47 + #endif 48 + 49 + #endif /* __THERMAL_HWMON_H__ */