aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEduardo Valentin <eduardo.valentin@ti.com>2013-07-03 15:14:28 -0400
committerEduardo Valentin <eduardo.valentin@ti.com>2013-09-03 09:09:12 -0400
commit0dd88793aacd7c91b9724be7b618bb3f7c25befe (patch)
tree6bd7184103a59823c8f57174cdde7f3e7210de3a /drivers
parent73b5b1d7c5f9348c0fe3a3e4ac5586207d830d54 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/thermal/Kconfig9
-rw-r--r--drivers/thermal/Makefile3
-rw-r--r--drivers/thermal/thermal_core.c255
-rw-r--r--drivers/thermal/thermal_hwmon.c269
-rw-r--r--drivers/thermal/thermal_hwmon.h49
5 files changed, 331 insertions, 254 deletions
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index ae18f025a761..dbfc390330ac 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -17,8 +17,17 @@ if THERMAL
17 17
18config THERMAL_HWMON 18config THERMAL_HWMON
19 bool 19 bool
20 prompt "Expose thermal sensors as hwmon device"
20 depends on HWMON=y || HWMON=THERMAL 21 depends on HWMON=y || HWMON=THERMAL
21 default y 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
23choice 32choice
24 prompt "Default Thermal governor" 33 prompt "Default Thermal governor"
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index c19df7ab2614..584b36319d51 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -5,6 +5,9 @@
5obj-$(CONFIG_THERMAL) += thermal_sys.o 5obj-$(CONFIG_THERMAL) += thermal_sys.o
6thermal_sys-y += thermal_core.o 6thermal_sys-y += thermal_core.o
7 7
8# interface to/from other layers providing sensors
9thermal_sys-$(CONFIG_THERMAL_HWMON) += thermal_hwmon.o
10
8# governors 11# governors
9thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += fair_share.o 12thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += fair_share.o
10thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE) += step_wise.o 13thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE) += step_wise.o
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 1f02e8edb45c..247528bbf00c 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -38,6 +38,7 @@
38#include <net/genetlink.h> 38#include <net/genetlink.h>
39 39
40#include "thermal_core.h" 40#include "thermal_core.h"
41#include "thermal_hwmon.h"
41 42
42MODULE_AUTHOR("Zhang Rui"); 43MODULE_AUTHOR("Zhang Rui");
43MODULE_DESCRIPTION("Generic thermal management sysfs support"); 44MODULE_DESCRIPTION("Generic thermal management sysfs support");
@@ -859,260 +860,6 @@ thermal_cooling_device_trip_point_show(struct device *dev,
859 860
860/* Device management */ 861/* Device management */
861 862
862#if defined(CONFIG_THERMAL_HWMON)
863
864/* hwmon sys I/F */
865#include <linux/hwmon.h>
866
867/* thermal zone devices with the same type share one hwmon device */
868struct thermal_hwmon_device {
869 char type[THERMAL_NAME_LENGTH];
870 struct device *device;
871 int count;
872 struct list_head tz_list;
873 struct list_head node;
874};
875
876struct thermal_hwmon_attr {
877 struct device_attribute attr;
878 char name[16];
879};
880
881/* one temperature input for each thermal zone */
882struct thermal_hwmon_temp {
883 struct list_head hwmon_node;
884 struct thermal_zone_device *tz;
885 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
886 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */
887};
888
889static LIST_HEAD(thermal_hwmon_list);
890
891static ssize_t
892name_show(struct device *dev, struct device_attribute *attr, char *buf)
893{
894 struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev);
895 return sprintf(buf, "%s\n", hwmon->type);
896}
897static DEVICE_ATTR(name, 0444, name_show, NULL);
898
899static ssize_t
900temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
901{
902 long temperature;
903 int ret;
904 struct thermal_hwmon_attr *hwmon_attr
905 = container_of(attr, struct thermal_hwmon_attr, attr);
906 struct thermal_hwmon_temp *temp
907 = container_of(hwmon_attr, struct thermal_hwmon_temp,
908 temp_input);
909 struct thermal_zone_device *tz = temp->tz;
910
911 ret = thermal_zone_get_temp(tz, &temperature);
912
913 if (ret)
914 return ret;
915
916 return sprintf(buf, "%ld\n", temperature);
917}
918
919static ssize_t
920temp_crit_show(struct device *dev, struct device_attribute *attr,
921 char *buf)
922{
923 struct thermal_hwmon_attr *hwmon_attr
924 = container_of(attr, struct thermal_hwmon_attr, attr);
925 struct thermal_hwmon_temp *temp
926 = container_of(hwmon_attr, struct thermal_hwmon_temp,
927 temp_crit);
928 struct thermal_zone_device *tz = temp->tz;
929 long temperature;
930 int ret;
931
932 ret = tz->ops->get_trip_temp(tz, 0, &temperature);
933 if (ret)
934 return ret;
935
936 return sprintf(buf, "%ld\n", temperature);
937}
938
939
940static struct thermal_hwmon_device *
941thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz)
942{
943 struct thermal_hwmon_device *hwmon;
944
945 mutex_lock(&thermal_list_lock);
946 list_for_each_entry(hwmon, &thermal_hwmon_list, node)
947 if (!strcmp(hwmon->type, tz->type)) {
948 mutex_unlock(&thermal_list_lock);
949 return hwmon;
950 }
951 mutex_unlock(&thermal_list_lock);
952
953 return NULL;
954}
955
956/* Find the temperature input matching a given thermal zone */
957static struct thermal_hwmon_temp *
958thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
959 const struct thermal_zone_device *tz)
960{
961 struct thermal_hwmon_temp *temp;
962
963 mutex_lock(&thermal_list_lock);
964 list_for_each_entry(temp, &hwmon->tz_list, hwmon_node)
965 if (temp->tz == tz) {
966 mutex_unlock(&thermal_list_lock);
967 return temp;
968 }
969 mutex_unlock(&thermal_list_lock);
970
971 return NULL;
972}
973
974static int
975thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
976{
977 struct thermal_hwmon_device *hwmon;
978 struct thermal_hwmon_temp *temp;
979 int new_hwmon_device = 1;
980 int result;
981
982 hwmon = thermal_hwmon_lookup_by_type(tz);
983 if (hwmon) {
984 new_hwmon_device = 0;
985 goto register_sys_interface;
986 }
987
988 hwmon = kzalloc(sizeof(struct thermal_hwmon_device), GFP_KERNEL);
989 if (!hwmon)
990 return -ENOMEM;
991
992 INIT_LIST_HEAD(&hwmon->tz_list);
993 strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
994 hwmon->device = hwmon_device_register(NULL);
995 if (IS_ERR(hwmon->device)) {
996 result = PTR_ERR(hwmon->device);
997 goto free_mem;
998 }
999 dev_set_drvdata(hwmon->device, hwmon);
1000 result = device_create_file(hwmon->device, &dev_attr_name);
1001 if (result)
1002 goto free_mem;
1003
1004 register_sys_interface:
1005 temp = kzalloc(sizeof(struct thermal_hwmon_temp), GFP_KERNEL);
1006 if (!temp) {
1007 result = -ENOMEM;
1008 goto unregister_name;
1009 }
1010
1011 temp->tz = tz;
1012 hwmon->count++;
1013
1014 snprintf(temp->temp_input.name, sizeof(temp->temp_input.name),
1015 "temp%d_input", hwmon->count);
1016 temp->temp_input.attr.attr.name = temp->temp_input.name;
1017 temp->temp_input.attr.attr.mode = 0444;
1018 temp->temp_input.attr.show = temp_input_show;
1019 sysfs_attr_init(&temp->temp_input.attr.attr);
1020 result = device_create_file(hwmon->device, &temp->temp_input.attr);
1021 if (result)
1022 goto free_temp_mem;
1023
1024 if (tz->ops->get_crit_temp) {
1025 unsigned long temperature;
1026 if (!tz->ops->get_crit_temp(tz, &temperature)) {
1027 snprintf(temp->temp_crit.name,
1028 sizeof(temp->temp_crit.name),
1029 "temp%d_crit", hwmon->count);
1030 temp->temp_crit.attr.attr.name = temp->temp_crit.name;
1031 temp->temp_crit.attr.attr.mode = 0444;
1032 temp->temp_crit.attr.show = temp_crit_show;
1033 sysfs_attr_init(&temp->temp_crit.attr.attr);
1034 result = device_create_file(hwmon->device,
1035 &temp->temp_crit.attr);
1036 if (result)
1037 goto unregister_input;
1038 }
1039 }
1040
1041 mutex_lock(&thermal_list_lock);
1042 if (new_hwmon_device)
1043 list_add_tail(&hwmon->node, &thermal_hwmon_list);
1044 list_add_tail(&temp->hwmon_node, &hwmon->tz_list);
1045 mutex_unlock(&thermal_list_lock);
1046
1047 return 0;
1048
1049 unregister_input:
1050 device_remove_file(hwmon->device, &temp->temp_input.attr);
1051 free_temp_mem:
1052 kfree(temp);
1053 unregister_name:
1054 if (new_hwmon_device) {
1055 device_remove_file(hwmon->device, &dev_attr_name);
1056 hwmon_device_unregister(hwmon->device);
1057 }
1058 free_mem:
1059 if (new_hwmon_device)
1060 kfree(hwmon);
1061
1062 return result;
1063}
1064
1065static void
1066thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
1067{
1068 struct thermal_hwmon_device *hwmon;
1069 struct thermal_hwmon_temp *temp;
1070
1071 hwmon = thermal_hwmon_lookup_by_type(tz);
1072 if (unlikely(!hwmon)) {
1073 /* Should never happen... */
1074 dev_dbg(&tz->device, "hwmon device lookup failed!\n");
1075 return;
1076 }
1077
1078 temp = thermal_hwmon_lookup_temp(hwmon, tz);
1079 if (unlikely(!temp)) {
1080 /* Should never happen... */
1081 dev_dbg(&tz->device, "temperature input lookup failed!\n");
1082 return;
1083 }
1084
1085 device_remove_file(hwmon->device, &temp->temp_input.attr);
1086 if (tz->ops->get_crit_temp)
1087 device_remove_file(hwmon->device, &temp->temp_crit.attr);
1088
1089 mutex_lock(&thermal_list_lock);
1090 list_del(&temp->hwmon_node);
1091 kfree(temp);
1092 if (!list_empty(&hwmon->tz_list)) {
1093 mutex_unlock(&thermal_list_lock);
1094 return;
1095 }
1096 list_del(&hwmon->node);
1097 mutex_unlock(&thermal_list_lock);
1098
1099 device_remove_file(hwmon->device, &dev_attr_name);
1100 hwmon_device_unregister(hwmon->device);
1101 kfree(hwmon);
1102}
1103#else
1104static int
1105thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
1106{
1107 return 0;
1108}
1109
1110static void
1111thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
1112{
1113}
1114#endif
1115
1116/** 863/**
1117 * thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone 864 * thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone
1118 * @tz: pointer to struct thermal_zone_device 865 * @tz: pointer to struct thermal_zone_device
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
new file mode 100644
index 000000000000..fdb07199d9c2
--- /dev/null
+++ b/drivers/thermal/thermal_hwmon.c
@@ -0,0 +1,269 @@
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 */
36struct 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
44struct thermal_hwmon_attr {
45 struct device_attribute attr;
46 char name[16];
47};
48
49/* one temperature input for each thermal zone */
50struct 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
57static LIST_HEAD(thermal_hwmon_list);
58
59static DEFINE_MUTEX(thermal_hwmon_list_lock);
60
61static ssize_t
62name_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}
67static DEVICE_ATTR(name, 0444, name_show, NULL);
68
69static ssize_t
70temp_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
89static ssize_t
90temp_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
109static struct thermal_hwmon_device *
110thermal_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 */
126static struct thermal_hwmon_temp *
127thermal_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
143int 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
233void 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}
diff --git a/drivers/thermal/thermal_hwmon.h b/drivers/thermal/thermal_hwmon.h
new file mode 100644
index 000000000000..c798fdb2ae43
--- /dev/null
+++ b/drivers/thermal/thermal_hwmon.h
@@ -0,0 +1,49 @@
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
34int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz);
35void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz);
36#else
37static int
38thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
39{
40 return 0;
41}
42
43static void
44thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
45{
46}
47#endif
48
49#endif /* __THERMAL_HWMON_H__ */