Lines Matching refs:hwmon

3  *  thermal_hwmon.c - Generic Thermal Management hwmon support.
15 #include <linux/hwmon.h>
22 /* hwmon sys I/F */
23 /* thermal zone devices with the same type share one hwmon device */
41 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
42 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */
97 struct thermal_hwmon_device *hwmon;
101 list_for_each_entry(hwmon, &thermal_hwmon_list, node) {
104 if (!strcmp(hwmon->type, type)) {
106 return hwmon;
116 thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
122 list_for_each_entry(temp, &hwmon->tz_list, hwmon_node)
140 struct thermal_hwmon_device *hwmon;
145 hwmon = thermal_hwmon_lookup_by_type(tz);
146 if (hwmon) {
151 hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
152 if (!hwmon)
155 INIT_LIST_HEAD(&hwmon->tz_list);
156 strscpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
157 strreplace(hwmon->type, '-', '_');
158 hwmon->device = hwmon_device_register_for_thermal(&tz->device,
159 hwmon->type, hwmon);
160 if (IS_ERR(hwmon->device)) {
161 result = PTR_ERR(hwmon->device);
173 hwmon->count++;
176 "temp%d_input", hwmon->count);
181 result = device_create_file(hwmon->device, &temp->temp_input.attr);
188 "temp%d_crit", hwmon->count);
193 result = device_create_file(hwmon->device,
201 list_add_tail(&hwmon->node, &thermal_hwmon_list);
202 list_add_tail(&temp->hwmon_node, &hwmon->tz_list);
208 device_remove_file(hwmon->device, &temp->temp_input.attr);
213 hwmon_device_unregister(hwmon->device);
215 kfree(hwmon);
223 struct thermal_hwmon_device *hwmon;
226 hwmon = thermal_hwmon_lookup_by_type(tz);
227 if (unlikely(!hwmon)) {
229 dev_dbg(&tz->device, "hwmon device lookup failed!\n");
233 temp = thermal_hwmon_lookup_temp(hwmon, tz);
240 device_remove_file(hwmon->device, &temp->temp_input.attr);
242 device_remove_file(hwmon->device, &temp->temp_crit.attr);
247 if (!list_empty(&hwmon->tz_list)) {
251 list_del(&hwmon->node);
254 hwmon_device_unregister(hwmon->device);
255 kfree(hwmon);
278 dev_warn(dev, "Failed to add hwmon sysfs attributes\n");