Lines Matching refs:hwmon

91 	struct thermal_hwmon_device *hwmon;  in thermal_hwmon_lookup_by_type()  local
95 list_for_each_entry(hwmon, &thermal_hwmon_list, node) { in thermal_hwmon_lookup_by_type()
98 if (!strcmp(hwmon->type, type)) { in thermal_hwmon_lookup_by_type()
100 return hwmon; in thermal_hwmon_lookup_by_type()
110 thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, in thermal_hwmon_lookup_temp() argument
116 list_for_each_entry(temp, &hwmon->tz_list, hwmon_node) in thermal_hwmon_lookup_temp()
134 struct thermal_hwmon_device *hwmon; in thermal_add_hwmon_sysfs() local
139 hwmon = thermal_hwmon_lookup_by_type(tz); in thermal_add_hwmon_sysfs()
140 if (hwmon) { in thermal_add_hwmon_sysfs()
145 hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL); in thermal_add_hwmon_sysfs()
146 if (!hwmon) in thermal_add_hwmon_sysfs()
149 INIT_LIST_HEAD(&hwmon->tz_list); in thermal_add_hwmon_sysfs()
150 strscpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); in thermal_add_hwmon_sysfs()
151 strreplace(hwmon->type, '-', '_'); in thermal_add_hwmon_sysfs()
152 hwmon->device = hwmon_device_register_for_thermal(&tz->device, in thermal_add_hwmon_sysfs()
153 hwmon->type, hwmon); in thermal_add_hwmon_sysfs()
154 if (IS_ERR(hwmon->device)) { in thermal_add_hwmon_sysfs()
155 result = PTR_ERR(hwmon->device); in thermal_add_hwmon_sysfs()
167 hwmon->count++; in thermal_add_hwmon_sysfs()
170 "temp%d_input", hwmon->count); in thermal_add_hwmon_sysfs()
175 result = device_create_file(hwmon->device, &temp->temp_input.attr); in thermal_add_hwmon_sysfs()
182 "temp%d_crit", hwmon->count); in thermal_add_hwmon_sysfs()
187 result = device_create_file(hwmon->device, in thermal_add_hwmon_sysfs()
195 list_add_tail(&hwmon->node, &thermal_hwmon_list); in thermal_add_hwmon_sysfs()
196 list_add_tail(&temp->hwmon_node, &hwmon->tz_list); in thermal_add_hwmon_sysfs()
202 device_remove_file(hwmon->device, &temp->temp_input.attr); in thermal_add_hwmon_sysfs()
207 hwmon_device_unregister(hwmon->device); in thermal_add_hwmon_sysfs()
209 kfree(hwmon); in thermal_add_hwmon_sysfs()
217 struct thermal_hwmon_device *hwmon; in thermal_remove_hwmon_sysfs() local
220 hwmon = thermal_hwmon_lookup_by_type(tz); in thermal_remove_hwmon_sysfs()
221 if (unlikely(!hwmon)) { in thermal_remove_hwmon_sysfs()
227 temp = thermal_hwmon_lookup_temp(hwmon, tz); in thermal_remove_hwmon_sysfs()
234 device_remove_file(hwmon->device, &temp->temp_input.attr); in thermal_remove_hwmon_sysfs()
236 device_remove_file(hwmon->device, &temp->temp_crit.attr); in thermal_remove_hwmon_sysfs()
241 if (!list_empty(&hwmon->tz_list)) { in thermal_remove_hwmon_sysfs()
245 list_del(&hwmon->node); in thermal_remove_hwmon_sysfs()
248 hwmon_device_unregister(hwmon->device); in thermal_remove_hwmon_sysfs()
249 kfree(hwmon); in thermal_remove_hwmon_sysfs()