Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

interconnect: qcom: Move qcom_icc_xlate_extended() to a common file

since there have conflict between two headers icc-rpmh.h and icc-rpm.h,
the function qcom_icc_xlate_extended() is declared in icc-rpmh.h thus
it cannot be used by icc-rpm driver.

Move the function to a new common file icc-common.c so that allow it to
be called by multiple drivers.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220712015929.2789881-3-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>

authored by

Leo Yan and committed by
Georgi Djakov
cb4805b5 2c510f5b

+52 -26
+3
drivers/interconnect/qcom/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 + obj-$(CONFIG_INTERCONNECT_QCOM) += interconnect_qcom.o 4 + 5 + interconnect_qcom-y := icc-common.o 3 6 icc-bcm-voter-objs := bcm-voter.o 4 7 qnoc-msm8916-objs := msm8916.o 5 8 qnoc-msm8939-objs := msm8939.o
+34
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);
+13
drivers/interconnect/qcom/icc-common.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2022 Linaro Ltd. 4 + */ 5 + 6 + #ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__ 7 + #define __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__ 8 + 9 + #include <linux/interconnect-provider.h> 10 + 11 + struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data); 12 + 13 + #endif
+1 -25
drivers/interconnect/qcom/icc-rpmh.c
··· 11 11 #include <linux/slab.h> 12 12 13 13 #include "bcm-voter.h" 14 + #include "icc-common.h" 14 15 #include "icc-rpmh.h" 15 16 16 17 /** ··· 100 99 return 0; 101 100 } 102 101 EXPORT_SYMBOL_GPL(qcom_icc_set); 103 - 104 - struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data) 105 - { 106 - struct icc_node_data *ndata; 107 - struct icc_node *node; 108 - 109 - node = of_icc_xlate_onecell(spec, data); 110 - if (IS_ERR(node)) 111 - return ERR_CAST(node); 112 - 113 - ndata = kzalloc(sizeof(*ndata), GFP_KERNEL); 114 - if (!ndata) 115 - return ERR_PTR(-ENOMEM); 116 - 117 - ndata->node = node; 118 - 119 - if (spec->args_count == 2) 120 - ndata->tag = spec->args[1]; 121 - 122 - if (spec->args_count > 2) 123 - pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np); 124 - 125 - return ndata; 126 - } 127 - EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended); 128 102 129 103 /** 130 104 * qcom_icc_bcm_init - populates bcm aux data and connect qnodes
-1
drivers/interconnect/qcom/icc-rpmh.h
··· 131 131 int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, 132 132 u32 peak_bw, u32 *agg_avg, u32 *agg_peak); 133 133 int qcom_icc_set(struct icc_node *src, struct icc_node *dst); 134 - struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data); 135 134 int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev); 136 135 void qcom_icc_pre_aggregate(struct icc_node *node); 137 136 int qcom_icc_rpmh_probe(struct platform_device *pdev);
+1
drivers/interconnect/qcom/sm8450.c
··· 12 12 #include <dt-bindings/interconnect/qcom,sm8450.h> 13 13 14 14 #include "bcm-voter.h" 15 + #include "icc-common.h" 15 16 #include "icc-rpmh.h" 16 17 #include "sm8450.h" 17 18