Lines Matching refs:path

172 	struct icc_path *path;  in path_init()  local
175 path = kzalloc(struct_size(path, reqs, num_nodes), GFP_KERNEL); in path_init()
176 if (!path) in path_init()
179 path->num_nodes = num_nodes; in path_init()
185 hlist_add_head(&path->reqs[i].req_node, &node->req_list); in path_init()
186 path->reqs[i].node = node; in path_init()
187 path->reqs[i].dev = dev; in path_init()
188 path->reqs[i].enabled = true; in path_init()
195 return path; in path_init()
201 struct icc_path *path = ERR_PTR(-EPROBE_DEFER); in path_find() local
228 path = ERR_PTR(-ENOENT); in path_find()
259 path = path_init(dev, dst, depth); in path_find()
261 return path; in path_find()
304 static int apply_constraints(struct icc_path *path) in apply_constraints() argument
311 for (i = 0; i < path->num_nodes; i++) { in apply_constraints()
312 next = path->reqs[i].node; in apply_constraints()
428 struct icc_path **ptr, *path; in devm_of_icc_get() local
434 path = of_icc_get(dev, name); in devm_of_icc_get()
435 if (!IS_ERR(path)) { in devm_of_icc_get()
436 *ptr = path; in devm_of_icc_get()
442 return path; in devm_of_icc_get()
463 struct icc_path *path; in of_icc_get_by_index() local
518 path = path_find(dev, src_data->node, dst_data->node); in of_icc_get_by_index()
520 if (IS_ERR(path)) { in of_icc_get_by_index()
521 dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); in of_icc_get_by_index()
526 icc_set_tag(path, src_data->tag); in of_icc_get_by_index()
528 path->name = kasprintf(GFP_KERNEL, "%s-%s", in of_icc_get_by_index()
530 if (!path->name) { in of_icc_get_by_index()
531 kfree(path); in of_icc_get_by_index()
532 path = ERR_PTR(-ENOMEM); in of_icc_get_by_index()
538 return path; in of_icc_get_by_index()
605 struct icc_path *path = ERR_PTR(-EPROBE_DEFER); in icc_get() local
621 path = path_find(dev, src_node, dst_node); in icc_get()
622 if (IS_ERR(path)) { in icc_get()
623 dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); in icc_get()
627 path->name = kasprintf(GFP_KERNEL, "%s-%s", src_node->name, dst_node->name); in icc_get()
628 if (!path->name) { in icc_get()
629 kfree(path); in icc_get()
630 path = ERR_PTR(-ENOMEM); in icc_get()
634 return path; in icc_get()
645 void icc_set_tag(struct icc_path *path, u32 tag) in icc_set_tag() argument
649 if (!path) in icc_set_tag()
654 for (i = 0; i < path->num_nodes; i++) in icc_set_tag()
655 path->reqs[i].tag = tag; in icc_set_tag()
670 const char *icc_get_name(struct icc_path *path) in icc_get_name() argument
672 if (!path) in icc_get_name()
675 return path->name; in icc_get_name()
694 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) in icc_set_bw() argument
701 if (!path) in icc_set_bw()
704 if (WARN_ON(IS_ERR(path) || !path->num_nodes)) in icc_set_bw()
709 old_avg = path->reqs[0].avg_bw; in icc_set_bw()
710 old_peak = path->reqs[0].peak_bw; in icc_set_bw()
712 for (i = 0; i < path->num_nodes; i++) { in icc_set_bw()
713 node = path->reqs[i].node; in icc_set_bw()
716 path->reqs[i].avg_bw = avg_bw; in icc_set_bw()
717 path->reqs[i].peak_bw = peak_bw; in icc_set_bw()
722 trace_icc_set_bw(path, node, i, avg_bw, peak_bw); in icc_set_bw()
725 ret = apply_constraints(path); in icc_set_bw()
730 for (i = 0; i < path->num_nodes; i++) { in icc_set_bw()
731 node = path->reqs[i].node; in icc_set_bw()
732 path->reqs[i].avg_bw = old_avg; in icc_set_bw()
733 path->reqs[i].peak_bw = old_peak; in icc_set_bw()
736 apply_constraints(path); in icc_set_bw()
741 trace_icc_set_bw_end(path, ret); in icc_set_bw()
747 static int __icc_enable(struct icc_path *path, bool enable) in __icc_enable() argument
751 if (!path) in __icc_enable()
754 if (WARN_ON(IS_ERR(path) || !path->num_nodes)) in __icc_enable()
759 for (i = 0; i < path->num_nodes; i++) in __icc_enable()
760 path->reqs[i].enabled = enable; in __icc_enable()
764 return icc_set_bw(path, path->reqs[0].avg_bw, in __icc_enable()
765 path->reqs[0].peak_bw); in __icc_enable()
768 int icc_enable(struct icc_path *path) in icc_enable() argument
770 return __icc_enable(path, true); in icc_enable()
774 int icc_disable(struct icc_path *path) in icc_disable() argument
776 return __icc_enable(path, false); in icc_disable()
787 void icc_put(struct icc_path *path) in icc_put() argument
793 if (!path || WARN_ON(IS_ERR(path))) in icc_put()
796 ret = icc_set_bw(path, 0, 0); in icc_put()
803 for (i = 0; i < path->num_nodes; i++) { in icc_put()
804 node = path->reqs[i].node; in icc_put()
805 hlist_del(&path->reqs[i].req_node); in icc_put()
813 kfree(path->name); in icc_put()
814 kfree(path); in icc_put()