devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Leo Yan <leo.yan@linaro.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Georgi Djakov <djakov@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/5] interconnect: qcom: Move qcom_icc_xlate_extended() to a common file
Date: Wed, 27 Apr 2022 00:00:24 +0300	[thread overview]
Message-ID: <e7a8ce84-3029-ea90-628b-1072bd49baf4@linaro.org> (raw)
In-Reply-To: <20220416154013.1357444-3-leo.yan@linaro.org>

On 16/04/2022 18:40, Leo Yan wrote:
> 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>

> ---
>   drivers/interconnect/qcom/Makefile     |  3 +++
>   drivers/interconnect/qcom/icc-common.c | 34 ++++++++++++++++++++++++++
>   drivers/interconnect/qcom/icc-common.h | 13 ++++++++++
>   drivers/interconnect/qcom/icc-rpmh.c   | 26 +-------------------
>   drivers/interconnect/qcom/icc-rpmh.h   |  1 -
>   drivers/interconnect/qcom/sm8450.c     |  1 +
>   6 files changed, 52 insertions(+), 26 deletions(-)
>   create mode 100644 drivers/interconnect/qcom/icc-common.c
>   create mode 100644 drivers/interconnect/qcom/icc-common.h
> 
> diff --git a/drivers/interconnect/qcom/Makefile b/drivers/interconnect/qcom/Makefile
> index ceae9bb566c6..bbb3d6daaad1 100644
> --- a/drivers/interconnect/qcom/Makefile
> +++ b/drivers/interconnect/qcom/Makefile
> @@ -1,5 +1,8 @@
>   # SPDX-License-Identifier: GPL-2.0
>   
> +obj-$(CONFIG_INTERCONNECT_QCOM) += interconnect_qcom.o
> +
> +interconnect_qcom-y			:= icc-common.o
>   icc-bcm-voter-objs			:= bcm-voter.o
>   qnoc-msm8916-objs			:= msm8916.o
>   qnoc-msm8939-objs			:= msm8939.o
> diff --git a/drivers/interconnect/qcom/icc-common.c b/drivers/interconnect/qcom/icc-common.c
> new file mode 100644
> index 000000000000..0822ce207b5d
> --- /dev/null
> +++ b/drivers/interconnect/qcom/icc-common.c
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2022 Linaro Ltd.
> + */
> +
> +#include <linux/of.h>
> +#include <linux/slab.h>
> +
> +#include "icc-common.h"
> +
> +struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data)
> +{
> +	struct icc_node_data *ndata;
> +	struct icc_node *node;
> +
> +	node = of_icc_xlate_onecell(spec, data);
> +	if (IS_ERR(node))
> +		return ERR_CAST(node);
> +
> +	ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
> +	if (!ndata)
> +		return ERR_PTR(-ENOMEM);
> +
> +	ndata->node = node;
> +
> +	if (spec->args_count == 2)
> +		ndata->tag = spec->args[1];
> +
> +	if (spec->args_count > 2)
> +		pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np);
> +
> +	return ndata;
> +}
> +EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended);
> diff --git a/drivers/interconnect/qcom/icc-common.h b/drivers/interconnect/qcom/icc-common.h
> new file mode 100644
> index 000000000000..33bb2c38dff3
> --- /dev/null
> +++ b/drivers/interconnect/qcom/icc-common.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2022 Linaro Ltd.
> + */
> +
> +#ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__
> +#define __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__
> +
> +#include <linux/interconnect-provider.h>

If it's just for the sake of the function prototype, you can replace 
#include with forward declarations of two used structures:

struct icc_node_data;
struct of_phandle_args;

> +
> +struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data);
> +
> +#endif
> diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
> index 2c8e12549804..9a0ac85d2a84 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.c
> +++ b/drivers/interconnect/qcom/icc-rpmh.c
> @@ -11,6 +11,7 @@
>   #include <linux/slab.h>
>   
>   #include "bcm-voter.h"
> +#include "icc-common.h"
>   #include "icc-rpmh.h"
>   
>   /**
> @@ -100,31 +101,6 @@ int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
>   }
>   EXPORT_SYMBOL_GPL(qcom_icc_set);
>   
> -struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data)
> -{
> -	struct icc_node_data *ndata;
> -	struct icc_node *node;
> -
> -	node = of_icc_xlate_onecell(spec, data);
> -	if (IS_ERR(node))
> -		return ERR_CAST(node);
> -
> -	ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
> -	if (!ndata)
> -		return ERR_PTR(-ENOMEM);
> -
> -	ndata->node = node;
> -
> -	if (spec->args_count == 2)
> -		ndata->tag = spec->args[1];
> -
> -	if (spec->args_count > 2)
> -		pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np);
> -
> -	return ndata;
> -}
> -EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended);
> -
>   /**
>    * qcom_icc_bcm_init - populates bcm aux data and connect qnodes
>    * @bcm: bcm to be initialized
> diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
> index 4bfc060529ba..84acc540a5f7 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.h
> +++ b/drivers/interconnect/qcom/icc-rpmh.h
> @@ -131,7 +131,6 @@ struct qcom_icc_desc {
>   int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
>   		       u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
>   int qcom_icc_set(struct icc_node *src, struct icc_node *dst);
> -struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data);
>   int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev);
>   void qcom_icc_pre_aggregate(struct icc_node *node);
>   int qcom_icc_rpmh_probe(struct platform_device *pdev);
> diff --git a/drivers/interconnect/qcom/sm8450.c b/drivers/interconnect/qcom/sm8450.c
> index 8d99ee6421df..23045cf17e37 100644
> --- a/drivers/interconnect/qcom/sm8450.c
> +++ b/drivers/interconnect/qcom/sm8450.c
> @@ -12,6 +12,7 @@
>   #include <dt-bindings/interconnect/qcom,sm8450.h>
>   
>   #include "bcm-voter.h"
> +#include "icc-common.h"
>   #include "icc-rpmh.h"
>   #include "sm8450.h"
>   


-- 
With best wishes
Dmitry

  reply	other threads:[~2022-04-26 21:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16 15:40 [PATCH v1 0/5] interconnect: qcom: icc-rpm: Support voting bucket Leo Yan
2022-04-16 15:40 ` [PATCH v1 1/5] dt-bindings: interconnect: Update property for icc-rpm path tag Leo Yan
2022-04-26 18:59   ` Rob Herring
2022-04-27 14:05     ` Leo Yan
2022-04-16 15:40 ` [PATCH v1 2/5] interconnect: qcom: Move qcom_icc_xlate_extended() to a common file Leo Yan
2022-04-26 21:00   ` Dmitry Baryshkov [this message]
2022-04-27 14:13     ` Leo Yan
2022-04-16 15:40 ` [PATCH v1 3/5] interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended() Leo Yan
2022-04-26 21:00   ` Dmitry Baryshkov
2022-04-16 15:40 ` [PATCH v1 4/5] interconnect: qcom: icc-rpm: Support multiple buckets Leo Yan
2022-04-16 15:40 ` [PATCH v1 5/5] interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values Leo Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7a8ce84-3029-ea90-628b-1072bd49baf4@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djakov@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).