Lines Matching refs:tz
174 int get_tz_trend(struct thermal_zone_device *tz, int trip) in get_tz_trend() argument
178 if (tz->emul_temperature || !tz->ops->get_trend || in get_tz_trend()
179 tz->ops->get_trend(tz, trip, &trend)) { in get_tz_trend()
180 if (tz->temperature > tz->last_temperature) in get_tz_trend()
182 else if (tz->temperature < tz->last_temperature) in get_tz_trend()
192 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *tz, in get_thermal_instance() argument
198 mutex_lock(&tz->lock); in get_thermal_instance()
201 list_for_each_entry(pos, &tz->thermal_instances, tz_node) { in get_thermal_instance()
202 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in get_thermal_instance()
209 mutex_unlock(&tz->lock); in get_thermal_instance()
215 static void print_bind_err_msg(struct thermal_zone_device *tz, in print_bind_err_msg() argument
218 dev_err(&tz->device, "binding zone %s with cdev %s failed:%d\n", in print_bind_err_msg()
219 tz->type, cdev->type, ret); in print_bind_err_msg()
222 static void __bind(struct thermal_zone_device *tz, int mask, in __bind() argument
228 for (i = 0; i < tz->trips; i++) { in __bind()
238 ret = thermal_zone_bind_cooling_device(tz, i, cdev, in __bind()
241 print_bind_err_msg(tz, cdev, ret); in __bind()
246 static void __unbind(struct thermal_zone_device *tz, int mask, in __unbind() argument
251 for (i = 0; i < tz->trips; i++) in __unbind()
253 thermal_zone_unbind_cooling_device(tz, i, cdev); in __unbind()
293 static void bind_tz(struct thermal_zone_device *tz) in bind_tz() argument
297 const struct thermal_zone_params *tzp = tz->tzp; in bind_tz()
299 if (!tzp && !tz->ops->bind) in bind_tz()
305 if (tz->ops->bind) { in bind_tz()
307 ret = tz->ops->bind(tz, pos); in bind_tz()
309 print_bind_err_msg(tz, pos, ret); in bind_tz()
321 if (tzp->tbp[i].match(tz, pos)) in bind_tz()
324 __bind(tz, tzp->tbp[i].trip_mask, pos, in bind_tz()
332 static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, in thermal_zone_device_set_polling() argument
336 mod_delayed_work(system_freezable_wq, &tz->poll_queue, in thermal_zone_device_set_polling()
339 mod_delayed_work(system_freezable_wq, &tz->poll_queue, in thermal_zone_device_set_polling()
342 cancel_delayed_work(&tz->poll_queue); in thermal_zone_device_set_polling()
345 static void monitor_thermal_zone(struct thermal_zone_device *tz) in monitor_thermal_zone() argument
347 mutex_lock(&tz->lock); in monitor_thermal_zone()
349 if (tz->passive) in monitor_thermal_zone()
350 thermal_zone_device_set_polling(tz, tz->passive_delay); in monitor_thermal_zone()
351 else if (tz->polling_delay) in monitor_thermal_zone()
352 thermal_zone_device_set_polling(tz, tz->polling_delay); in monitor_thermal_zone()
354 thermal_zone_device_set_polling(tz, 0); in monitor_thermal_zone()
356 mutex_unlock(&tz->lock); in monitor_thermal_zone()
359 static void handle_non_critical_trips(struct thermal_zone_device *tz, in handle_non_critical_trips() argument
362 tz->governor ? tz->governor->throttle(tz, trip) : in handle_non_critical_trips()
363 def_governor->throttle(tz, trip); in handle_non_critical_trips()
366 static void handle_critical_trips(struct thermal_zone_device *tz, in handle_critical_trips() argument
371 tz->ops->get_trip_temp(tz, trip, &trip_temp); in handle_critical_trips()
374 if (trip_temp <= 0 || tz->temperature < trip_temp) in handle_critical_trips()
377 trace_thermal_zone_trip(tz, trip, trip_type); in handle_critical_trips()
379 if (tz->ops->notify) in handle_critical_trips()
380 tz->ops->notify(tz, trip, trip_type); in handle_critical_trips()
383 dev_emerg(&tz->device, in handle_critical_trips()
385 tz->temperature / 1000); in handle_critical_trips()
390 static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) in handle_thermal_trip() argument
395 if (test_bit(trip, &tz->trips_disabled)) in handle_thermal_trip()
398 tz->ops->get_trip_type(tz, trip, &type); in handle_thermal_trip()
401 handle_critical_trips(tz, trip, type); in handle_thermal_trip()
403 handle_non_critical_trips(tz, trip, type); in handle_thermal_trip()
408 monitor_thermal_zone(tz); in handle_thermal_trip()
421 int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) in thermal_zone_get_temp() argument
430 if (!tz || IS_ERR(tz) || !tz->ops->get_temp) in thermal_zone_get_temp()
433 mutex_lock(&tz->lock); in thermal_zone_get_temp()
435 ret = tz->ops->get_temp(tz, temp); in thermal_zone_get_temp()
437 if (!tz->emul_temperature) in thermal_zone_get_temp()
440 for (count = 0; count < tz->trips; count++) { in thermal_zone_get_temp()
441 ret = tz->ops->get_trip_type(tz, count, &type); in thermal_zone_get_temp()
443 ret = tz->ops->get_trip_temp(tz, count, &crit_temp); in thermal_zone_get_temp()
452 *temp = tz->emul_temperature; in thermal_zone_get_temp()
455 mutex_unlock(&tz->lock); in thermal_zone_get_temp()
461 static void update_temperature(struct thermal_zone_device *tz) in update_temperature() argument
466 ret = thermal_zone_get_temp(tz, &temp); in update_temperature()
469 dev_warn(&tz->device, in update_temperature()
475 mutex_lock(&tz->lock); in update_temperature()
476 tz->last_temperature = tz->temperature; in update_temperature()
477 tz->temperature = temp; in update_temperature()
478 mutex_unlock(&tz->lock); in update_temperature()
480 trace_thermal_temperature(tz); in update_temperature()
481 if (tz->last_temperature == THERMAL_TEMP_INVALID) in update_temperature()
482 dev_dbg(&tz->device, "last_temperature N/A, current_temperature=%d\n", in update_temperature()
483 tz->temperature); in update_temperature()
485 dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", in update_temperature()
486 tz->last_temperature, tz->temperature); in update_temperature()
489 static void thermal_zone_device_reset(struct thermal_zone_device *tz) in thermal_zone_device_reset() argument
493 tz->temperature = THERMAL_TEMP_INVALID; in thermal_zone_device_reset()
494 tz->passive = 0; in thermal_zone_device_reset()
495 list_for_each_entry(pos, &tz->thermal_instances, tz_node) in thermal_zone_device_reset()
499 void thermal_zone_device_update(struct thermal_zone_device *tz) in thermal_zone_device_update() argument
506 if (!tz->ops->get_temp) in thermal_zone_device_update()
509 update_temperature(tz); in thermal_zone_device_update()
511 for (count = 0; count < tz->trips; count++) in thermal_zone_device_update()
512 handle_thermal_trip(tz, count); in thermal_zone_device_update()
518 struct thermal_zone_device *tz = container_of(work, struct in thermal_zone_device_check() local
521 thermal_zone_device_update(tz); in thermal_zone_device_check()
532 struct thermal_zone_device *tz = to_thermal_zone(dev); in type_show() local
534 return sprintf(buf, "%s\n", tz->type); in type_show()
540 struct thermal_zone_device *tz = to_thermal_zone(dev); in temp_show() local
544 ret = thermal_zone_get_temp(tz, &temperature); in temp_show()
555 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_show() local
559 if (!tz->ops->get_mode) in mode_show()
562 result = tz->ops->get_mode(tz, &mode); in mode_show()
574 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_store() local
577 if (!tz->ops->set_mode) in mode_store()
581 result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED); in mode_store()
583 result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED); in mode_store()
597 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_type_show() local
601 if (!tz->ops->get_trip_type) in trip_point_type_show()
607 result = tz->ops->get_trip_type(tz, trip, &type); in trip_point_type_show()
629 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_store() local
633 if (!tz->ops->set_trip_temp) in trip_point_temp_store()
642 ret = tz->ops->set_trip_temp(tz, trip, temperature); in trip_point_temp_store()
651 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_show() local
655 if (!tz->ops->get_trip_temp) in trip_point_temp_show()
661 ret = tz->ops->get_trip_temp(tz, trip, &temperature); in trip_point_temp_show()
673 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_store() local
677 if (!tz->ops->set_trip_hyst) in trip_point_hyst_store()
691 ret = tz->ops->set_trip_hyst(tz, trip, temperature); in trip_point_hyst_store()
700 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_show() local
704 if (!tz->ops->get_trip_hyst) in trip_point_hyst_show()
710 ret = tz->ops->get_trip_hyst(tz, trip, &temperature); in trip_point_hyst_show()
719 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_store() local
732 if (state && !tz->forced_passive) { in passive_store()
737 thermal_zone_bind_cooling_device(tz, in passive_store()
743 if (!tz->passive_delay) in passive_store()
744 tz->passive_delay = 1000; in passive_store()
745 } else if (!state && tz->forced_passive) { in passive_store()
750 thermal_zone_unbind_cooling_device(tz, in passive_store()
755 tz->passive_delay = 0; in passive_store()
758 tz->forced_passive = state; in passive_store()
760 thermal_zone_device_update(tz); in passive_store()
769 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_show() local
771 return sprintf(buf, "%d\n", tz->forced_passive); in passive_show()
779 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_store() local
786 mutex_lock(&tz->lock); in policy_store()
792 tz->governor = gov; in policy_store()
796 mutex_unlock(&tz->lock); in policy_store()
804 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_show() local
806 return sprintf(buf, "%s\n", tz->governor->name); in policy_show()
814 struct thermal_zone_device *tz = to_thermal_zone(dev); in emul_temp_store() local
821 if (!tz->ops->set_emul_temp) { in emul_temp_store()
822 mutex_lock(&tz->lock); in emul_temp_store()
823 tz->emul_temperature = temperature; in emul_temp_store()
824 mutex_unlock(&tz->lock); in emul_temp_store()
826 ret = tz->ops->set_emul_temp(tz, temperature); in emul_temp_store()
830 thermal_zone_device_update(tz); in emul_temp_store()
965 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, in thermal_zone_bind_cooling_device() argument
977 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) in thermal_zone_bind_cooling_device()
981 if (pos1 == tz) in thermal_zone_bind_cooling_device()
989 if (tz != pos1 || cdev != pos2) in thermal_zone_bind_cooling_device()
1007 dev->tz = tz; in thermal_zone_bind_cooling_device()
1014 result = get_idr(&tz->idr, &tz->lock, &dev->id); in thermal_zone_bind_cooling_device()
1020 sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name); in thermal_zone_bind_cooling_device()
1029 result = device_create_file(&tz->device, &dev->attr); in thermal_zone_bind_cooling_device()
1033 mutex_lock(&tz->lock); in thermal_zone_bind_cooling_device()
1035 list_for_each_entry(pos, &tz->thermal_instances, tz_node) in thermal_zone_bind_cooling_device()
1036 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_bind_cooling_device()
1041 list_add_tail(&dev->tz_node, &tz->thermal_instances); in thermal_zone_bind_cooling_device()
1043 atomic_set(&tz->need_update, 1); in thermal_zone_bind_cooling_device()
1046 mutex_unlock(&tz->lock); in thermal_zone_bind_cooling_device()
1051 device_remove_file(&tz->device, &dev->attr); in thermal_zone_bind_cooling_device()
1053 sysfs_remove_link(&tz->device.kobj, dev->name); in thermal_zone_bind_cooling_device()
1055 release_idr(&tz->idr, &tz->lock, dev->id); in thermal_zone_bind_cooling_device()
1076 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, in thermal_zone_unbind_cooling_device() argument
1082 mutex_lock(&tz->lock); in thermal_zone_unbind_cooling_device()
1084 list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) { in thermal_zone_unbind_cooling_device()
1085 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_unbind_cooling_device()
1089 mutex_unlock(&tz->lock); in thermal_zone_unbind_cooling_device()
1094 mutex_unlock(&tz->lock); in thermal_zone_unbind_cooling_device()
1099 device_remove_file(&tz->device, &pos->attr); in thermal_zone_unbind_cooling_device()
1100 sysfs_remove_link(&tz->device.kobj, pos->name); in thermal_zone_unbind_cooling_device()
1101 release_idr(&tz->idr, &tz->lock, pos->id); in thermal_zone_unbind_cooling_device()
1109 struct thermal_zone_device *tz; in thermal_release() local
1114 tz = to_thermal_zone(dev); in thermal_release()
1115 kfree(tz); in thermal_release()
1260 struct thermal_zone_device *tz; in thermal_cooling_device_unregister() local
1278 list_for_each_entry(tz, &thermal_tz_list, node) { in thermal_cooling_device_unregister()
1279 if (tz->ops->unbind) { in thermal_cooling_device_unregister()
1280 tz->ops->unbind(tz, cdev); in thermal_cooling_device_unregister()
1284 if (!tz->tzp || !tz->tzp->tbp) in thermal_cooling_device_unregister()
1287 tzp = tz->tzp; in thermal_cooling_device_unregister()
1290 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_cooling_device_unregister()
1322 instance->tz->id, instance->target); in thermal_cdev_update()
1348 void thermal_notify_framework(struct thermal_zone_device *tz, int trip) in thermal_notify_framework() argument
1350 handle_thermal_trip(tz, trip); in thermal_notify_framework()
1364 static int create_trip_attrs(struct thermal_zone_device *tz, int mask) in create_trip_attrs() argument
1367 int size = sizeof(struct thermal_attr) * tz->trips; in create_trip_attrs()
1369 tz->trip_type_attrs = kzalloc(size, GFP_KERNEL); in create_trip_attrs()
1370 if (!tz->trip_type_attrs) in create_trip_attrs()
1373 tz->trip_temp_attrs = kzalloc(size, GFP_KERNEL); in create_trip_attrs()
1374 if (!tz->trip_temp_attrs) { in create_trip_attrs()
1375 kfree(tz->trip_type_attrs); in create_trip_attrs()
1379 if (tz->ops->get_trip_hyst) { in create_trip_attrs()
1380 tz->trip_hyst_attrs = kzalloc(size, GFP_KERNEL); in create_trip_attrs()
1381 if (!tz->trip_hyst_attrs) { in create_trip_attrs()
1382 kfree(tz->trip_type_attrs); in create_trip_attrs()
1383 kfree(tz->trip_temp_attrs); in create_trip_attrs()
1389 for (indx = 0; indx < tz->trips; indx++) { in create_trip_attrs()
1391 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
1394 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr); in create_trip_attrs()
1395 tz->trip_type_attrs[indx].attr.attr.name = in create_trip_attrs()
1396 tz->trip_type_attrs[indx].name; in create_trip_attrs()
1397 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
1398 tz->trip_type_attrs[indx].attr.show = trip_point_type_show; in create_trip_attrs()
1400 device_create_file(&tz->device, in create_trip_attrs()
1401 &tz->trip_type_attrs[indx].attr); in create_trip_attrs()
1404 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
1407 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr); in create_trip_attrs()
1408 tz->trip_temp_attrs[indx].attr.attr.name = in create_trip_attrs()
1409 tz->trip_temp_attrs[indx].name; in create_trip_attrs()
1410 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
1411 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; in create_trip_attrs()
1413 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
1414 tz->trip_temp_attrs[indx].attr.store = in create_trip_attrs()
1418 device_create_file(&tz->device, in create_trip_attrs()
1419 &tz->trip_temp_attrs[indx].attr); in create_trip_attrs()
1422 if (!tz->ops->get_trip_hyst) in create_trip_attrs()
1424 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
1427 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr); in create_trip_attrs()
1428 tz->trip_hyst_attrs[indx].attr.attr.name = in create_trip_attrs()
1429 tz->trip_hyst_attrs[indx].name; in create_trip_attrs()
1430 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
1431 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; in create_trip_attrs()
1432 if (tz->ops->set_trip_hyst) { in create_trip_attrs()
1433 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
1434 tz->trip_hyst_attrs[indx].attr.store = in create_trip_attrs()
1438 device_create_file(&tz->device, in create_trip_attrs()
1439 &tz->trip_hyst_attrs[indx].attr); in create_trip_attrs()
1444 static void remove_trip_attrs(struct thermal_zone_device *tz) in remove_trip_attrs() argument
1448 for (indx = 0; indx < tz->trips; indx++) { in remove_trip_attrs()
1449 device_remove_file(&tz->device, in remove_trip_attrs()
1450 &tz->trip_type_attrs[indx].attr); in remove_trip_attrs()
1451 device_remove_file(&tz->device, in remove_trip_attrs()
1452 &tz->trip_temp_attrs[indx].attr); in remove_trip_attrs()
1453 if (tz->ops->get_trip_hyst) in remove_trip_attrs()
1454 device_remove_file(&tz->device, in remove_trip_attrs()
1455 &tz->trip_hyst_attrs[indx].attr); in remove_trip_attrs()
1457 kfree(tz->trip_type_attrs); in remove_trip_attrs()
1458 kfree(tz->trip_temp_attrs); in remove_trip_attrs()
1459 kfree(tz->trip_hyst_attrs); in remove_trip_attrs()
1492 struct thermal_zone_device *tz; in thermal_zone_device_register() local
1511 tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); in thermal_zone_device_register()
1512 if (!tz) in thermal_zone_device_register()
1515 INIT_LIST_HEAD(&tz->thermal_instances); in thermal_zone_device_register()
1516 idr_init(&tz->idr); in thermal_zone_device_register()
1517 mutex_init(&tz->lock); in thermal_zone_device_register()
1518 result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); in thermal_zone_device_register()
1520 kfree(tz); in thermal_zone_device_register()
1524 strlcpy(tz->type, type ? : "", sizeof(tz->type)); in thermal_zone_device_register()
1525 tz->ops = ops; in thermal_zone_device_register()
1526 tz->tzp = tzp; in thermal_zone_device_register()
1527 tz->device.class = &thermal_class; in thermal_zone_device_register()
1528 tz->devdata = devdata; in thermal_zone_device_register()
1529 tz->trips = trips; in thermal_zone_device_register()
1530 tz->passive_delay = passive_delay; in thermal_zone_device_register()
1531 tz->polling_delay = polling_delay; in thermal_zone_device_register()
1533 atomic_set(&tz->need_update, 1); in thermal_zone_device_register()
1535 dev_set_name(&tz->device, "thermal_zone%d", tz->id); in thermal_zone_device_register()
1536 result = device_register(&tz->device); in thermal_zone_device_register()
1538 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); in thermal_zone_device_register()
1539 kfree(tz); in thermal_zone_device_register()
1545 result = device_create_file(&tz->device, &dev_attr_type); in thermal_zone_device_register()
1550 result = device_create_file(&tz->device, &dev_attr_temp); in thermal_zone_device_register()
1555 result = device_create_file(&tz->device, &dev_attr_mode); in thermal_zone_device_register()
1560 result = create_trip_attrs(tz, mask); in thermal_zone_device_register()
1565 if (tz->ops->get_trip_type(tz, count, &trip_type)) in thermal_zone_device_register()
1566 set_bit(count, &tz->trips_disabled); in thermal_zone_device_register()
1569 if (tz->ops->get_trip_temp(tz, count, &trip_temp)) in thermal_zone_device_register()
1570 set_bit(count, &tz->trips_disabled); in thermal_zone_device_register()
1573 set_bit(count, &tz->trips_disabled); in thermal_zone_device_register()
1577 result = device_create_file(&tz->device, &dev_attr_passive); in thermal_zone_device_register()
1583 result = device_create_file(&tz->device, &dev_attr_emul_temp); in thermal_zone_device_register()
1588 result = device_create_file(&tz->device, &dev_attr_policy); in thermal_zone_device_register()
1595 if (tz->tzp) in thermal_zone_device_register()
1596 tz->governor = __find_governor(tz->tzp->governor_name); in thermal_zone_device_register()
1598 tz->governor = def_governor; in thermal_zone_device_register()
1602 if (!tz->tzp || !tz->tzp->no_hwmon) { in thermal_zone_device_register()
1603 result = thermal_add_hwmon_sysfs(tz); in thermal_zone_device_register()
1609 list_add_tail(&tz->node, &thermal_tz_list); in thermal_zone_device_register()
1613 bind_tz(tz); in thermal_zone_device_register()
1615 INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check); in thermal_zone_device_register()
1617 if (!tz->ops->get_temp) in thermal_zone_device_register()
1618 thermal_zone_device_set_polling(tz, 0); in thermal_zone_device_register()
1620 thermal_zone_device_reset(tz); in thermal_zone_device_register()
1622 if (atomic_cmpxchg(&tz->need_update, 1, 0)) in thermal_zone_device_register()
1623 thermal_zone_device_update(tz); in thermal_zone_device_register()
1625 return tz; in thermal_zone_device_register()
1628 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); in thermal_zone_device_register()
1629 device_unregister(&tz->device); in thermal_zone_device_register()
1638 void thermal_zone_device_unregister(struct thermal_zone_device *tz) in thermal_zone_device_unregister() argument
1645 if (!tz) in thermal_zone_device_unregister()
1648 tzp = tz->tzp; in thermal_zone_device_unregister()
1652 if (pos == tz) in thermal_zone_device_unregister()
1654 if (pos != tz) { in thermal_zone_device_unregister()
1659 list_del(&tz->node); in thermal_zone_device_unregister()
1663 if (tz->ops->unbind) { in thermal_zone_device_unregister()
1664 tz->ops->unbind(tz, cdev); in thermal_zone_device_unregister()
1673 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_zone_device_unregister()
1681 thermal_zone_device_set_polling(tz, 0); in thermal_zone_device_unregister()
1683 if (tz->type[0]) in thermal_zone_device_unregister()
1684 device_remove_file(&tz->device, &dev_attr_type); in thermal_zone_device_unregister()
1685 device_remove_file(&tz->device, &dev_attr_temp); in thermal_zone_device_unregister()
1686 if (tz->ops->get_mode) in thermal_zone_device_unregister()
1687 device_remove_file(&tz->device, &dev_attr_mode); in thermal_zone_device_unregister()
1688 device_remove_file(&tz->device, &dev_attr_policy); in thermal_zone_device_unregister()
1689 remove_trip_attrs(tz); in thermal_zone_device_unregister()
1690 tz->governor = NULL; in thermal_zone_device_unregister()
1692 thermal_remove_hwmon_sysfs(tz); in thermal_zone_device_unregister()
1693 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); in thermal_zone_device_unregister()
1694 idr_destroy(&tz->idr); in thermal_zone_device_unregister()
1695 mutex_destroy(&tz->lock); in thermal_zone_device_unregister()
1696 device_unregister(&tz->device); in thermal_zone_device_unregister()
1753 int thermal_generate_netlink_event(struct thermal_zone_device *tz, in thermal_generate_netlink_event() argument
1764 if (!tz) in thermal_generate_netlink_event()
1801 thermal_event->orig = tz->id; in thermal_generate_netlink_event()
1810 dev_err(&tz->device, "Failed to send netlink event:%d", result); in thermal_generate_netlink_event()
1860 struct thermal_zone_device *tz; in thermal_pm_notify() local
1872 list_for_each_entry(tz, &thermal_tz_list, node) { in thermal_pm_notify()
1873 thermal_zone_device_reset(tz); in thermal_pm_notify()
1874 thermal_zone_device_update(tz); in thermal_pm_notify()