Lines Matching refs:hwmon
64 struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev); in name_show() local
65 return sprintf(buf, "%s\n", hwmon->type); in name_show()
112 struct thermal_hwmon_device *hwmon; in thermal_hwmon_lookup_by_type() local
115 list_for_each_entry(hwmon, &thermal_hwmon_list, node) in thermal_hwmon_lookup_by_type()
116 if (!strcmp(hwmon->type, tz->type)) { in thermal_hwmon_lookup_by_type()
118 return hwmon; in thermal_hwmon_lookup_by_type()
127 thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, in thermal_hwmon_lookup_temp() argument
133 list_for_each_entry(temp, &hwmon->tz_list, hwmon_node) in thermal_hwmon_lookup_temp()
151 struct thermal_hwmon_device *hwmon; in thermal_add_hwmon_sysfs() local
156 hwmon = thermal_hwmon_lookup_by_type(tz); in thermal_add_hwmon_sysfs()
157 if (hwmon) { in thermal_add_hwmon_sysfs()
162 hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL); in thermal_add_hwmon_sysfs()
163 if (!hwmon) in thermal_add_hwmon_sysfs()
166 INIT_LIST_HEAD(&hwmon->tz_list); in thermal_add_hwmon_sysfs()
167 strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); in thermal_add_hwmon_sysfs()
168 hwmon->device = hwmon_device_register(NULL); in thermal_add_hwmon_sysfs()
169 if (IS_ERR(hwmon->device)) { in thermal_add_hwmon_sysfs()
170 result = PTR_ERR(hwmon->device); in thermal_add_hwmon_sysfs()
173 dev_set_drvdata(hwmon->device, hwmon); in thermal_add_hwmon_sysfs()
174 result = device_create_file(hwmon->device, &dev_attr_name); in thermal_add_hwmon_sysfs()
186 hwmon->count++; in thermal_add_hwmon_sysfs()
189 "temp%d_input", hwmon->count); in thermal_add_hwmon_sysfs()
194 result = device_create_file(hwmon->device, &temp->temp_input.attr); in thermal_add_hwmon_sysfs()
201 "temp%d_crit", hwmon->count); in thermal_add_hwmon_sysfs()
206 result = device_create_file(hwmon->device, in thermal_add_hwmon_sysfs()
214 list_add_tail(&hwmon->node, &thermal_hwmon_list); in thermal_add_hwmon_sysfs()
215 list_add_tail(&temp->hwmon_node, &hwmon->tz_list); in thermal_add_hwmon_sysfs()
221 device_remove_file(hwmon->device, &temp->temp_input.attr); in thermal_add_hwmon_sysfs()
226 device_remove_file(hwmon->device, &dev_attr_name); in thermal_add_hwmon_sysfs()
227 hwmon_device_unregister(hwmon->device); in thermal_add_hwmon_sysfs()
231 kfree(hwmon); in thermal_add_hwmon_sysfs()
238 struct thermal_hwmon_device *hwmon; in thermal_remove_hwmon_sysfs() local
241 hwmon = thermal_hwmon_lookup_by_type(tz); in thermal_remove_hwmon_sysfs()
242 if (unlikely(!hwmon)) { in thermal_remove_hwmon_sysfs()
248 temp = thermal_hwmon_lookup_temp(hwmon, tz); in thermal_remove_hwmon_sysfs()
255 device_remove_file(hwmon->device, &temp->temp_input.attr); in thermal_remove_hwmon_sysfs()
257 device_remove_file(hwmon->device, &temp->temp_crit.attr); in thermal_remove_hwmon_sysfs()
262 if (!list_empty(&hwmon->tz_list)) { in thermal_remove_hwmon_sysfs()
266 list_del(&hwmon->node); in thermal_remove_hwmon_sysfs()
269 device_remove_file(hwmon->device, &dev_attr_name); in thermal_remove_hwmon_sysfs()
270 hwmon_device_unregister(hwmon->device); in thermal_remove_hwmon_sysfs()
271 kfree(hwmon); in thermal_remove_hwmon_sysfs()