Lines Matching refs:cdev
193 struct thermal_cooling_device *cdev, int trip) in get_thermal_instance() argument
199 mutex_lock(&cdev->lock); in get_thermal_instance()
202 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in get_thermal_instance()
208 mutex_unlock(&cdev->lock); in get_thermal_instance()
216 struct thermal_cooling_device *cdev, int ret) in print_bind_err_msg() argument
219 tz->type, cdev->type, ret); in print_bind_err_msg()
223 struct thermal_cooling_device *cdev, in __bind() argument
238 ret = thermal_zone_bind_cooling_device(tz, i, cdev, in __bind()
241 print_bind_err_msg(tz, cdev, ret); in __bind()
247 struct thermal_cooling_device *cdev) in __unbind() argument
253 thermal_zone_unbind_cooling_device(tz, i, cdev); in __unbind()
256 static void bind_cdev(struct thermal_cooling_device *cdev) in bind_cdev() argument
269 ret = pos->ops->bind(pos, cdev); in bind_cdev()
271 print_bind_err_msg(pos, cdev, ret); in bind_cdev()
280 if (tzp->tbp[i].cdev || !tzp->tbp[i].match) in bind_cdev()
282 if (tzp->tbp[i].match(pos, cdev)) in bind_cdev()
284 tzp->tbp[i].cdev = cdev; in bind_cdev()
285 __bind(pos, tzp->tbp[i].trip_mask, cdev, in bind_cdev()
319 if (tzp->tbp[i].cdev || !tzp->tbp[i].match) in bind_tz()
323 tzp->tbp[i].cdev = pos; in bind_tz()
720 struct thermal_cooling_device *cdev = NULL; in passive_store() local
734 list_for_each_entry(cdev, &thermal_cdev_list, node) { in passive_store()
735 if (!strncmp("Processor", cdev->type, in passive_store()
738 THERMAL_TRIPS_NONE, cdev, in passive_store()
747 list_for_each_entry(cdev, &thermal_cdev_list, node) { in passive_store()
748 if (!strncmp("Processor", cdev->type, in passive_store()
752 cdev); in passive_store()
851 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_type_show() local
853 return sprintf(buf, "%s\n", cdev->type); in thermal_cooling_device_type_show()
860 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_max_state_show() local
864 ret = cdev->ops->get_max_state(cdev, &state); in thermal_cooling_device_max_state_show()
874 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_cur_state_show() local
878 ret = cdev->ops->get_cur_state(cdev, &state); in thermal_cooling_device_cur_state_show()
889 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_cur_state_store() local
899 result = cdev->ops->set_cur_state(cdev, state); in thermal_cooling_device_cur_state_store()
967 struct thermal_cooling_device *cdev, in thermal_zone_bind_cooling_device() argument
985 if (pos2 == cdev) in thermal_zone_bind_cooling_device()
989 if (tz != pos1 || cdev != pos2) in thermal_zone_bind_cooling_device()
992 ret = cdev->ops->get_max_state(cdev, &max_state); in thermal_zone_bind_cooling_device()
1008 dev->cdev = cdev; in thermal_zone_bind_cooling_device()
1020 sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name); in thermal_zone_bind_cooling_device()
1034 mutex_lock(&cdev->lock); in thermal_zone_bind_cooling_device()
1036 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_bind_cooling_device()
1042 list_add_tail(&dev->cdev_node, &cdev->thermal_instances); in thermal_zone_bind_cooling_device()
1045 mutex_unlock(&cdev->lock); in thermal_zone_bind_cooling_device()
1078 struct thermal_cooling_device *cdev) in thermal_zone_unbind_cooling_device() argument
1083 mutex_lock(&cdev->lock); in thermal_zone_unbind_cooling_device()
1085 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_unbind_cooling_device()
1088 mutex_unlock(&cdev->lock); in thermal_zone_unbind_cooling_device()
1093 mutex_unlock(&cdev->lock); in thermal_zone_unbind_cooling_device()
1110 struct thermal_cooling_device *cdev; in thermal_release() local
1118 cdev = to_cooling_device(dev); in thermal_release()
1119 kfree(cdev); in thermal_release()
1149 struct thermal_cooling_device *cdev; in __thermal_cooling_device_register() local
1160 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); in __thermal_cooling_device_register()
1161 if (!cdev) in __thermal_cooling_device_register()
1164 result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); in __thermal_cooling_device_register()
1166 kfree(cdev); in __thermal_cooling_device_register()
1170 strlcpy(cdev->type, type ? : "", sizeof(cdev->type)); in __thermal_cooling_device_register()
1171 mutex_init(&cdev->lock); in __thermal_cooling_device_register()
1172 INIT_LIST_HEAD(&cdev->thermal_instances); in __thermal_cooling_device_register()
1173 cdev->np = np; in __thermal_cooling_device_register()
1174 cdev->ops = ops; in __thermal_cooling_device_register()
1175 cdev->updated = false; in __thermal_cooling_device_register()
1176 cdev->device.class = &thermal_class; in __thermal_cooling_device_register()
1177 cdev->device.groups = cooling_device_attr_groups; in __thermal_cooling_device_register()
1178 cdev->devdata = devdata; in __thermal_cooling_device_register()
1179 dev_set_name(&cdev->device, "cooling_device%d", cdev->id); in __thermal_cooling_device_register()
1180 result = device_register(&cdev->device); in __thermal_cooling_device_register()
1182 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); in __thermal_cooling_device_register()
1183 kfree(cdev); in __thermal_cooling_device_register()
1189 list_add(&cdev->node, &thermal_cdev_list); in __thermal_cooling_device_register()
1193 bind_cdev(cdev); in __thermal_cooling_device_register()
1201 return cdev; in __thermal_cooling_device_register()
1256 void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) in thermal_cooling_device_unregister() argument
1263 if (!cdev) in thermal_cooling_device_unregister()
1268 if (pos == cdev) in thermal_cooling_device_unregister()
1270 if (pos != cdev) { in thermal_cooling_device_unregister()
1275 list_del(&cdev->node); in thermal_cooling_device_unregister()
1280 tz->ops->unbind(tz, cdev); in thermal_cooling_device_unregister()
1289 if (tzp->tbp[i].cdev == cdev) { in thermal_cooling_device_unregister()
1290 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_cooling_device_unregister()
1291 tzp->tbp[i].cdev = NULL; in thermal_cooling_device_unregister()
1298 if (cdev->type[0]) in thermal_cooling_device_unregister()
1299 device_remove_file(&cdev->device, &dev_attr_cdev_type); in thermal_cooling_device_unregister()
1300 device_remove_file(&cdev->device, &dev_attr_max_state); in thermal_cooling_device_unregister()
1301 device_remove_file(&cdev->device, &dev_attr_cur_state); in thermal_cooling_device_unregister()
1303 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); in thermal_cooling_device_unregister()
1304 device_unregister(&cdev->device); in thermal_cooling_device_unregister()
1309 void thermal_cdev_update(struct thermal_cooling_device *cdev) in thermal_cdev_update() argument
1315 if (cdev->updated) in thermal_cdev_update()
1318 mutex_lock(&cdev->lock); in thermal_cdev_update()
1320 list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { in thermal_cdev_update()
1321 dev_dbg(&cdev->device, "zone%d->target=%lu\n", in thermal_cdev_update()
1328 mutex_unlock(&cdev->lock); in thermal_cdev_update()
1329 cdev->ops->set_cur_state(cdev, target); in thermal_cdev_update()
1330 cdev->updated = true; in thermal_cdev_update()
1331 trace_cdev_update(cdev, target); in thermal_cdev_update()
1332 dev_dbg(&cdev->device, "set to state %lu\n", target); in thermal_cdev_update()
1642 struct thermal_cooling_device *cdev; in thermal_zone_device_unregister() local
1662 list_for_each_entry(cdev, &thermal_cdev_list, node) { in thermal_zone_device_unregister()
1664 tz->ops->unbind(tz, cdev); in thermal_zone_device_unregister()
1672 if (tzp->tbp[i].cdev == cdev) { in thermal_zone_device_unregister()
1673 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_zone_device_unregister()
1674 tzp->tbp[i].cdev = NULL; in thermal_zone_device_unregister()