Lines Matching defs:cdev

588 	struct thermal_cooling_device *cdev = to_cooling_device(dev);
590 return sprintf(buf, "%s\n", cdev->type);
596 struct thermal_cooling_device *cdev = to_cooling_device(dev);
598 return sprintf(buf, "%ld\n", cdev->max_state);
604 struct thermal_cooling_device *cdev = to_cooling_device(dev);
608 ret = cdev->ops->get_cur_state(cdev, &state);
618 struct thermal_cooling_device *cdev = to_cooling_device(dev);
629 if (state > cdev->max_state)
632 mutex_lock(&cdev->lock);
634 result = cdev->ops->set_cur_state(cdev, state);
636 thermal_cooling_device_stats_update(cdev, state);
638 mutex_unlock(&cdev->lock);
684 void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
687 struct cooling_dev_stats *stats = cdev->stats;
689 lockdep_assert_held(&cdev->lock);
700 stats->trans_table[stats->state * (cdev->max_state + 1) + new_state]++;
711 struct thermal_cooling_device *cdev = to_cooling_device(dev);
715 mutex_lock(&cdev->lock);
717 stats = cdev->stats;
726 mutex_unlock(&cdev->lock);
735 struct thermal_cooling_device *cdev = to_cooling_device(dev);
740 mutex_lock(&cdev->lock);
742 stats = cdev->stats;
750 for (i = 0; i <= cdev->max_state; i++) {
757 mutex_unlock(&cdev->lock);
766 struct thermal_cooling_device *cdev = to_cooling_device(dev);
770 mutex_lock(&cdev->lock);
772 stats = cdev->stats;
776 states = cdev->max_state + 1;
791 mutex_unlock(&cdev->lock);
799 struct thermal_cooling_device *cdev = to_cooling_device(dev);
804 mutex_lock(&cdev->lock);
806 stats = cdev->stats;
814 for (i = 0; i <= cdev->max_state; i++) {
826 for (i = 0; i <= cdev->max_state; i++) {
832 for (j = 0; j <= cdev->max_state; j++) {
836 stats->trans_table[i * (cdev->max_state + 1) + j]);
849 mutex_unlock(&cdev->lock);
872 static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
877 unsigned long states = cdev->max_state + 1;
890 cdev->stats = stats;
903 static void cooling_device_stats_destroy(struct thermal_cooling_device *cdev)
905 kfree(cdev->stats);
906 cdev->stats = NULL;
912 cooling_device_stats_setup(struct thermal_cooling_device *cdev) {}
914 cooling_device_stats_destroy(struct thermal_cooling_device *cdev) {}
918 void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *cdev)
920 cooling_device_stats_setup(cdev);
921 cdev->device.groups = cooling_device_attr_groups;
924 void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev)
926 cooling_device_stats_destroy(cdev);
929 void thermal_cooling_device_stats_reinit(struct thermal_cooling_device *cdev)
931 lockdep_assert_held(&cdev->lock);
933 cooling_device_stats_destroy(cdev);
934 cooling_device_stats_setup(cdev);