Merge tag 'drm-msm-fixes-2022-08-27' of https://gitlab.freedesktop.org/drm/msm into...
[linux-2.6-microblaze.git] / drivers / interconnect / qcom / icc-common.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2022 Linaro Ltd.
4  */
5
6 #include <linux/of.h>
7 #include <linux/slab.h>
8
9 #include "icc-common.h"
10
11 struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data)
12 {
13         struct icc_node_data *ndata;
14         struct icc_node *node;
15
16         node = of_icc_xlate_onecell(spec, data);
17         if (IS_ERR(node))
18                 return ERR_CAST(node);
19
20         ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
21         if (!ndata)
22                 return ERR_PTR(-ENOMEM);
23
24         ndata->node = node;
25
26         if (spec->args_count == 2)
27                 ndata->tag = spec->args[1];
28
29         if (spec->args_count > 2)
30                 pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np);
31
32         return ndata;
33 }
34 EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended);