• Home
  • Raw
  • Download

Lines Matching refs:hdl

940 static inline int handler_set_err(struct v4l2_ctrl_handler *hdl, int err)  in handler_set_err()  argument
942 if (hdl->error == 0) in handler_set_err()
943 hdl->error = err; in handler_set_err()
948 int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_handler_init_class() argument
952 mutex_init(&hdl->_lock); in v4l2_ctrl_handler_init_class()
953 hdl->lock = &hdl->_lock; in v4l2_ctrl_handler_init_class()
954 lockdep_set_class_and_name(hdl->lock, key, name); in v4l2_ctrl_handler_init_class()
955 INIT_LIST_HEAD(&hdl->ctrls); in v4l2_ctrl_handler_init_class()
956 INIT_LIST_HEAD(&hdl->ctrl_refs); in v4l2_ctrl_handler_init_class()
957 hdl->nr_of_buckets = 1 + nr_of_controls_hint / 8; in v4l2_ctrl_handler_init_class()
958 hdl->buckets = kvmalloc_array(hdl->nr_of_buckets, in v4l2_ctrl_handler_init_class()
959 sizeof(hdl->buckets[0]), in v4l2_ctrl_handler_init_class()
961 hdl->error = hdl->buckets ? 0 : -ENOMEM; in v4l2_ctrl_handler_init_class()
962 v4l2_ctrl_handler_init_request(hdl); in v4l2_ctrl_handler_init_class()
963 return hdl->error; in v4l2_ctrl_handler_init_class()
968 void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) in v4l2_ctrl_handler_free() argument
974 if (hdl == NULL || hdl->buckets == NULL) in v4l2_ctrl_handler_free()
977 v4l2_ctrl_handler_free_request(hdl); in v4l2_ctrl_handler_free()
979 mutex_lock(hdl->lock); in v4l2_ctrl_handler_free()
981 list_for_each_entry_safe(ref, next_ref, &hdl->ctrl_refs, node) { in v4l2_ctrl_handler_free()
986 list_for_each_entry_safe(ctrl, next_ctrl, &hdl->ctrls, node) { in v4l2_ctrl_handler_free()
992 kvfree(hdl->buckets); in v4l2_ctrl_handler_free()
993 hdl->buckets = NULL; in v4l2_ctrl_handler_free()
994 hdl->cached = NULL; in v4l2_ctrl_handler_free()
995 hdl->error = 0; in v4l2_ctrl_handler_free()
996 mutex_unlock(hdl->lock); in v4l2_ctrl_handler_free()
997 mutex_destroy(&hdl->_lock); in v4l2_ctrl_handler_free()
1008 struct v4l2_ctrl_handler *hdl, u32 id) in find_private_ref() argument
1013 list_for_each_entry(ref, &hdl->ctrl_refs, node) { in find_private_ref()
1029 struct v4l2_ctrl_ref *find_ref(struct v4l2_ctrl_handler *hdl, u32 id) in find_ref() argument
1038 return find_private_ref(hdl, id); in find_ref()
1039 bucket = id % hdl->nr_of_buckets; in find_ref()
1042 if (hdl->cached && hdl->cached->ctrl->id == id) in find_ref()
1043 return hdl->cached; in find_ref()
1046 ref = hdl->buckets ? hdl->buckets[bucket] : NULL; in find_ref()
1051 hdl->cached = ref; /* cache it! */ in find_ref()
1056 struct v4l2_ctrl_ref *find_ref_lock(struct v4l2_ctrl_handler *hdl, u32 id) in find_ref_lock() argument
1060 if (hdl) { in find_ref_lock()
1061 mutex_lock(hdl->lock); in find_ref_lock()
1062 ref = find_ref(hdl, id); in find_ref_lock()
1063 mutex_unlock(hdl->lock); in find_ref_lock()
1069 struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id) in v4l2_ctrl_find() argument
1071 struct v4l2_ctrl_ref *ref = find_ref_lock(hdl, id); in v4l2_ctrl_find()
1078 int handler_new_ref(struct v4l2_ctrl_handler *hdl, in handler_new_ref() argument
1087 int bucket = id % hdl->nr_of_buckets; /* which bucket to use */ in handler_new_ref()
1098 id != class_ctrl && find_ref_lock(hdl, class_ctrl) == NULL) in handler_new_ref()
1099 if (!v4l2_ctrl_new_std(hdl, NULL, class_ctrl, 0, 0, 0, 0)) in handler_new_ref()
1100 return hdl->error; in handler_new_ref()
1102 if (hdl->error) in handler_new_ref()
1103 return hdl->error; in handler_new_ref()
1109 return handler_set_err(hdl, -ENOMEM); in handler_new_ref()
1117 mutex_lock(hdl->lock); in handler_new_ref()
1123 if (list_empty(&hdl->ctrl_refs) || id > node2id(hdl->ctrl_refs.prev)) { in handler_new_ref()
1124 list_add_tail(&new_ref->node, &hdl->ctrl_refs); in handler_new_ref()
1129 list_for_each_entry(ref, &hdl->ctrl_refs, node) { in handler_new_ref()
1143 new_ref->next = hdl->buckets[bucket]; in handler_new_ref()
1144 hdl->buckets[bucket] = new_ref; in handler_new_ref()
1147 if (ctrl->handler == hdl) { in handler_new_ref()
1158 mutex_unlock(hdl->lock); in handler_new_ref()
1163 static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new() argument
1183 if (hdl->error) in v4l2_ctrl_new()
1277 handler_set_err(hdl, -ERANGE); in v4l2_ctrl_new()
1282 handler_set_err(hdl, err); in v4l2_ctrl_new()
1288 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new()
1309 handler_set_err(hdl, -ENOMEM); in v4l2_ctrl_new()
1315 ctrl->handler = hdl; in v4l2_ctrl_new()
1361 if (handler_new_ref(hdl, ctrl, NULL, false, false)) { in v4l2_ctrl_new()
1365 mutex_lock(hdl->lock); in v4l2_ctrl_new()
1366 list_add_tail(&ctrl->node, &hdl->ctrls); in v4l2_ctrl_new()
1367 mutex_unlock(hdl->lock); in v4l2_ctrl_new()
1371 struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_custom() argument
1399 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_custom()
1403 ctrl = v4l2_ctrl_new(hdl, cfg->ops, cfg->type_ops, cfg->id, name, in v4l2_ctrl_new_custom()
1415 struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_std() argument
1427 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_std()
1430 return v4l2_ctrl_new(hdl, ops, NULL, id, name, type, in v4l2_ctrl_new_std()
1437 struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_std_menu() argument
1460 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_std_menu()
1463 return v4l2_ctrl_new(hdl, ops, NULL, id, name, type, in v4l2_ctrl_new_std_menu()
1470 struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_std_menu_items() argument
1486 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_std_menu_items()
1492 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_std_menu_items()
1495 return v4l2_ctrl_new(hdl, ops, NULL, id, name, type, in v4l2_ctrl_new_std_menu_items()
1503 struct v4l2_ctrl *v4l2_ctrl_new_std_compound(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_std_compound() argument
1514 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_std_compound()
1517 return v4l2_ctrl_new(hdl, ops, NULL, id, name, type, in v4l2_ctrl_new_std_compound()
1524 struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_int_menu() argument
1538 handler_set_err(hdl, -EINVAL); in v4l2_ctrl_new_int_menu()
1541 return v4l2_ctrl_new(hdl, ops, NULL, id, name, type, in v4l2_ctrl_new_int_menu()
1548 int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_add_handler() argument
1557 if (!hdl || !add || hdl == add) in v4l2_ctrl_add_handler()
1559 if (hdl->error) in v4l2_ctrl_add_handler()
1560 return hdl->error; in v4l2_ctrl_add_handler()
1574 ret = handler_new_ref(hdl, ctrl, NULL, from_other_dev, false); in v4l2_ctrl_add_handler()
1816 int __v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) in __v4l2_ctrl_handler_setup() argument
1821 if (hdl == NULL) in __v4l2_ctrl_handler_setup()
1824 lockdep_assert_held(hdl->lock); in __v4l2_ctrl_handler_setup()
1826 list_for_each_entry(ctrl, &hdl->ctrls, node) in __v4l2_ctrl_handler_setup()
1829 list_for_each_entry(ctrl, &hdl->ctrls, node) { in __v4l2_ctrl_handler_setup()
1855 int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) in v4l2_ctrl_handler_setup() argument
1859 if (hdl == NULL) in v4l2_ctrl_handler_setup()
1862 mutex_lock(hdl->lock); in v4l2_ctrl_handler_setup()
1863 ret = __v4l2_ctrl_handler_setup(hdl); in v4l2_ctrl_handler_setup()
1864 mutex_unlock(hdl->lock); in v4l2_ctrl_handler_setup()
1897 void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_handler_log_status() argument
1904 if (!hdl) in v4l2_ctrl_handler_log_status()
1911 mutex_lock(hdl->lock); in v4l2_ctrl_handler_log_status()
1912 list_for_each_entry(ctrl, &hdl->ctrls, node) in v4l2_ctrl_handler_log_status()
1915 mutex_unlock(hdl->lock); in v4l2_ctrl_handler_log_status()
1919 int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl, in v4l2_ctrl_new_fwnode_properties() argument
1939 if (!v4l2_ctrl_new_std_menu(hdl, ctrl_ops, in v4l2_ctrl_new_fwnode_properties()
1943 return hdl->error; in v4l2_ctrl_new_fwnode_properties()
1947 if (!v4l2_ctrl_new_std(hdl, ctrl_ops, in v4l2_ctrl_new_fwnode_properties()
1951 return hdl->error; in v4l2_ctrl_new_fwnode_properties()
1954 return hdl->error; in v4l2_ctrl_new_fwnode_properties()