Lines Matching refs:path

170 	struct icc_path *path;
173 path = kzalloc(struct_size(path, reqs, num_nodes), GFP_KERNEL);
174 if (!path)
177 path->num_nodes = num_nodes;
181 hlist_add_head(&path->reqs[i].req_node, &node->req_list);
182 path->reqs[i].node = node;
183 path->reqs[i].dev = dev;
184 path->reqs[i].enabled = true;
185 /* reference to previous node was saved during path traversal */
189 return path;
195 struct icc_path *path = ERR_PTR(-EPROBE_DEFER);
222 path = ERR_PTR(-ENOENT);
253 path = path_init(dev, dst, depth);
255 return path;
259 * We want the path to honor all bandwidth requests, so the average and peak
298 static int apply_constraints(struct icc_path *path)
305 for (i = 0; i < path->num_nodes; i++) {
306 next = path->reqs[i].node;
422 struct icc_path **ptr, *path;
428 path = of_icc_get(dev, name);
429 if (!IS_ERR(path)) {
430 *ptr = path;
436 return path;
441 * of_icc_get_by_index() - get a path handle from a DT node based on index
443 * @idx: interconnect path index
445 * This function will search for a path between two endpoints and return an
457 struct icc_path *path;
470 * return a NULL path to skip setting constraints.
512 path = path_find(dev, src_data->node, dst_data->node);
514 if (IS_ERR(path)) {
515 dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
520 icc_set_tag(path, src_data->tag);
522 path->name = kasprintf(GFP_KERNEL, "%s-%s",
524 if (!path->name) {
525 kfree(path);
526 path = ERR_PTR(-ENOMEM);
532 return path;
537 * of_icc_get() - get a path handle from a DT node based on name
539 * @name: interconnect path name
541 * This function will search for a path between two endpoints and return an
563 * return a NULL path to skip setting constraints.
584 * icc_get() - get a path handle between two endpoints
589 * This function will search for a path between two endpoints and return an
599 struct icc_path *path = ERR_PTR(-EPROBE_DEFER);
615 path = path_find(dev, src_node, dst_node);
616 if (IS_ERR(path)) {
617 dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
621 path->name = kasprintf(GFP_KERNEL, "%s-%s", src_node->name, dst_node->name);
622 if (!path->name) {
623 kfree(path);
624 path = ERR_PTR(-ENOMEM);
628 return path;
632 * icc_set_tag() - set an optional tag on a path
633 * @path: the path we want to tag
637 * with a path, so that a different aggregation could be done based on this tag.
639 void icc_set_tag(struct icc_path *path, u32 tag)
643 if (!path)
648 for (i = 0; i < path->num_nodes; i++)
649 path->reqs[i].tag = tag;
656 * icc_get_name() - Get name of the icc path
657 * @path: interconnect path
660 * path.
664 const char *icc_get_name(struct icc_path *path)
666 if (!path)
669 return path->name;
674 * icc_set_bw() - set bandwidth constraints on an interconnect path
675 * @path: interconnect path
680 * in terms of bandwidth for a previously requested path between two endpoints.
682 * path is locked by a mutex to ensure that the set() is completed.
683 * The @path can be NULL when the "interconnects" DT properties is missing,
688 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
695 if (!path)
698 if (WARN_ON(IS_ERR(path) || !path->num_nodes))
703 old_avg = path->reqs[0].avg_bw;
704 old_peak = path->reqs[0].peak_bw;
706 for (i = 0; i < path->num_nodes; i++) {
707 node = path->reqs[i].node;
709 /* update the consumer request for this path */
710 path->reqs[i].avg_bw = avg_bw;
711 path->reqs[i].peak_bw = peak_bw;
716 trace_icc_set_bw(path, node, i, avg_bw, peak_bw);
719 ret = apply_constraints(path);
724 for (i = 0; i < path->num_nodes; i++) {
725 node = path->reqs[i].node;
726 path->reqs[i].avg_bw = old_avg;
727 path->reqs[i].peak_bw = old_peak;
730 apply_constraints(path);
735 trace_icc_set_bw_end(path, ret);
741 static int __icc_enable(struct icc_path *path, bool enable)
745 if (!path)
748 if (WARN_ON(IS_ERR(path) || !path->num_nodes))
753 for (i = 0; i < path->num_nodes; i++)
754 path->reqs[i].enabled = enable;
758 return icc_set_bw(path, path->reqs[0].avg_bw,
759 path->reqs[0].peak_bw);
762 int icc_enable(struct icc_path *path)
764 return __icc_enable(path, true);
768 int icc_disable(struct icc_path *path)
770 return __icc_enable(path, false);
776 * @path: interconnect path
778 * Use this function to release the constraints on a path when the path is
781 void icc_put(struct icc_path *path)
787 if (!path || WARN_ON(IS_ERR(path)))
790 ret = icc_set_bw(path, 0, 0);
795 for (i = 0; i < path->num_nodes; i++) {
796 node = path->reqs[i].node;
797 hlist_del(&path->reqs[i].req_node);
803 kfree_const(path->name);
804 kfree(path);