Lines Matching defs:hwmon

3  *  thermal_hwmon.c - Generic Thermal Management hwmon support.
15 #include <linux/hwmon.h>
21 /* hwmon sys I/F */
22 /* thermal zone devices with the same type share one hwmon device */
40 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
41 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */
91 struct thermal_hwmon_device *hwmon;
95 list_for_each_entry(hwmon, &thermal_hwmon_list, node) {
98 if (!strcmp(hwmon->type, type)) {
100 return hwmon;
110 thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
116 list_for_each_entry(temp, &hwmon->tz_list, hwmon_node)
134 struct thermal_hwmon_device *hwmon;
139 hwmon = thermal_hwmon_lookup_by_type(tz);
140 if (hwmon) {
145 hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
146 if (!hwmon)
149 INIT_LIST_HEAD(&hwmon->tz_list);
150 strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
151 strreplace(hwmon->type, '-', '_');
152 hwmon->device = hwmon_device_register_with_info(&tz->device, hwmon->type,
153 hwmon, NULL, NULL);
154 if (IS_ERR(hwmon->device)) {
155 result = PTR_ERR(hwmon->device);
167 hwmon->count++;
170 "temp%d_input", hwmon->count);
175 result = device_create_file(hwmon->device, &temp->temp_input.attr);
182 "temp%d_crit", hwmon->count);
187 result = device_create_file(hwmon->device,
195 list_add_tail(&hwmon->node, &thermal_hwmon_list);
196 list_add_tail(&temp->hwmon_node, &hwmon->tz_list);
202 device_remove_file(hwmon->device, &temp->temp_input.attr);
207 hwmon_device_unregister(hwmon->device);
210 kfree(hwmon);
218 struct thermal_hwmon_device *hwmon;
221 hwmon = thermal_hwmon_lookup_by_type(tz);
222 if (unlikely(!hwmon)) {
224 dev_dbg(&tz->device, "hwmon device lookup failed!\n");
228 temp = thermal_hwmon_lookup_temp(hwmon, tz);
235 device_remove_file(hwmon->device, &temp->temp_input.attr);
237 device_remove_file(hwmon->device, &temp->temp_crit.attr);
242 if (!list_empty(&hwmon->tz_list)) {
246 list_del(&hwmon->node);
249 hwmon_device_unregister(hwmon->device);
250 kfree(hwmon);