Lines Matching refs:ref

1446 static bool req_alloc_array(struct v4l2_ctrl_ref *ref, u32 elems)  in req_alloc_array()  argument
1450 if (elems == ref->p_req_array_alloc_elems) in req_alloc_array()
1452 if (ref->ctrl->is_dyn_array && in req_alloc_array()
1453 elems < ref->p_req_array_alloc_elems) in req_alloc_array()
1456 tmp = kvmalloc(elems * ref->ctrl->elem_size, GFP_KERNEL); in req_alloc_array()
1459 ref->p_req_array_enomem = true; in req_alloc_array()
1462 ref->p_req_array_enomem = false; in req_alloc_array()
1463 kvfree(ref->p_req.p); in req_alloc_array()
1464 ref->p_req.p = tmp; in req_alloc_array()
1465 ref->p_req_array_alloc_elems = elems; in req_alloc_array()
1470 void new_to_req(struct v4l2_ctrl_ref *ref) in new_to_req() argument
1474 if (!ref) in new_to_req()
1477 ctrl = ref->ctrl; in new_to_req()
1478 if (ctrl->is_array && !req_alloc_array(ref, ctrl->new_elems)) in new_to_req()
1481 ref->p_req_elems = ctrl->new_elems; in new_to_req()
1482 ptr_to_ptr(ctrl, ctrl->p_new, ref->p_req, ref->p_req_elems); in new_to_req()
1483 ref->p_req_valid = true; in new_to_req()
1487 void cur_to_req(struct v4l2_ctrl_ref *ref) in cur_to_req() argument
1491 if (!ref) in cur_to_req()
1494 ctrl = ref->ctrl; in cur_to_req()
1495 if (ctrl->is_array && !req_alloc_array(ref, ctrl->elems)) in cur_to_req()
1498 ref->p_req_elems = ctrl->elems; in cur_to_req()
1499 ptr_to_ptr(ctrl, ctrl->p_cur, ref->p_req, ctrl->elems); in cur_to_req()
1500 ref->p_req_valid = true; in cur_to_req()
1504 int req_to_new(struct v4l2_ctrl_ref *ref) in req_to_new() argument
1508 if (!ref) in req_to_new()
1511 ctrl = ref->ctrl; in req_to_new()
1517 if (!ref->p_req_valid) { in req_to_new()
1526 ptr_to_ptr(ctrl, ref->p_req, ctrl->p_new, ctrl->new_elems); in req_to_new()
1531 if (WARN_ON(!ref->p_req_array_alloc_elems)) in req_to_new()
1535 ref->p_req_elems != ctrl->p_array_alloc_elems) in req_to_new()
1545 if (ref->p_req_elems > ctrl->p_array_alloc_elems) { in req_to_new()
1546 unsigned int sz = ref->p_req_elems * ctrl->elem_size; in req_to_new()
1557 ctrl->p_array_alloc_elems = ref->p_req_elems; in req_to_new()
1561 ctrl->new_elems = ref->p_req_elems; in req_to_new()
1562 ptr_to_ptr(ctrl, ref->p_req, ctrl->p_new, ctrl->new_elems); in req_to_new()
1636 struct v4l2_ctrl_ref *ref, *next_ref; in v4l2_ctrl_handler_free() local
1650 list_for_each_entry_safe(ref, next_ref, &hdl->ctrl_refs, node) { in v4l2_ctrl_handler_free()
1651 list_del(&ref->node); in v4l2_ctrl_handler_free()
1652 if (ref->p_req_array_alloc_elems) in v4l2_ctrl_handler_free()
1653 kvfree(ref->p_req.p); in v4l2_ctrl_handler_free()
1654 kfree(ref); in v4l2_ctrl_handler_free()
1683 struct v4l2_ctrl_ref *ref; in find_private_ref() local
1686 list_for_each_entry(ref, &hdl->ctrl_refs, node) { in find_private_ref()
1689 if (V4L2_CTRL_ID2WHICH(ref->ctrl->id) == V4L2_CTRL_CLASS_USER && in find_private_ref()
1690 V4L2_CTRL_DRIVER_PRIV(ref->ctrl->id)) { in find_private_ref()
1691 if (!ref->ctrl->is_int) in find_private_ref()
1694 return ref; in find_private_ref()
1704 struct v4l2_ctrl_ref *ref; in find_ref() local
1719 ref = hdl->buckets ? hdl->buckets[bucket] : NULL; in find_ref()
1720 while (ref && ref->ctrl->id != id) in find_ref()
1721 ref = ref->next; in find_ref()
1723 if (ref) in find_ref()
1724 hdl->cached = ref; /* cache it! */ in find_ref()
1725 return ref; in find_ref()
1731 struct v4l2_ctrl_ref *ref = NULL; in find_ref_lock() local
1735 ref = find_ref(hdl, id); in find_ref_lock()
1738 return ref; in find_ref_lock()
1744 struct v4l2_ctrl_ref *ref = find_ref_lock(hdl, id); in v4l2_ctrl_find() local
1746 return ref ? ref->ctrl : NULL; in v4l2_ctrl_find()
1756 struct v4l2_ctrl_ref *ref; in handler_new_ref() local
1802 list_for_each_entry(ref, &hdl->ctrl_refs, node) { in handler_new_ref()
1803 if (ref->ctrl->id < id) in handler_new_ref()
1806 if (ref->ctrl->id == id) { in handler_new_ref()
1810 list_add(&new_ref->node, ref->node.prev); in handler_new_ref()
2314 struct v4l2_ctrl_ref *ref; in v4l2_ctrl_add_handler() local
2323 list_for_each_entry(ref, &add->ctrl_refs, node) { in v4l2_ctrl_add_handler()
2324 struct v4l2_ctrl *ctrl = ref->ctrl; in v4l2_ctrl_add_handler()