public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Andy Gross <agross@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Taniya Das <tdas@codeaurora.org>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH 1/2] clk: qcom: use common code for qcom_cc_probe_by_index
Date: Fri, 16 Jul 2021 18:29:20 -0500	[thread overview]
Message-ID: <YPIWUOw6AyFHP+QZ@yoga> (raw)
In-Reply-To: <20210710140130.1176657-2-dmitry.baryshkov@linaro.org>

On Sat 10 Jul 09:01 CDT 2021, Dmitry Baryshkov wrote:

> Rewrite qcom_cc_map and qcom_cc_probe_by_index to use (new)
> qcom_cc_map_by_index, removing code duplication and opening a way to
> have more common code in qcom_cc_map*.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/clk/qcom/common.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
> index 60d2a78d1395..ed7c516a597a 100644
> --- a/drivers/clk/qcom/common.c
> +++ b/drivers/clk/qcom/common.c
> @@ -69,20 +69,26 @@ int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src)
>  }
>  EXPORT_SYMBOL_GPL(qcom_find_src_index);
>  
> -struct regmap *
> -qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
> +static struct regmap *
> +qcom_cc_map_by_index(struct platform_device *pdev, const struct qcom_cc_desc *desc, int index)
>  {
>  	void __iomem *base;
>  	struct resource *res;
>  	struct device *dev = &pdev->dev;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, index);
>  	base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(base))
>  		return ERR_CAST(base);
>  
>  	return devm_regmap_init_mmio(dev, base, desc->config);
>  }
> +
> +struct regmap *
> +qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
> +{
> +	return qcom_cc_map_by_index(pdev, desc, 0);
> +}
>  EXPORT_SYMBOL_GPL(qcom_cc_map);
>  
>  void
> @@ -313,15 +319,8 @@ int qcom_cc_probe_by_index(struct platform_device *pdev, int index,
>  			   const struct qcom_cc_desc *desc)
>  {
>  	struct regmap *regmap;
> -	struct resource *res;
> -	void __iomem *base;
> -
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> -	base = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(base))
> -		return -ENOMEM;
>  
> -	regmap = devm_regmap_init_mmio(&pdev->dev, base, desc->config);
> +	regmap = qcom_cc_map_by_index(pdev, desc, index);
>  	if (IS_ERR(regmap))
>  		return PTR_ERR(regmap);
>  
> -- 
> 2.30.2
> 

  reply	other threads:[~2021-07-16 23:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 14:01 [PATCH 0/2] clk: qcom: move pm_clk handling to common code Dmitry Baryshkov
2021-07-10 14:01 ` [PATCH 1/2] clk: qcom: use common code for qcom_cc_probe_by_index Dmitry Baryshkov
2021-07-16 23:29   ` Bjorn Andersson [this message]
2021-07-10 14:01 ` [PATCH 2/2] clk: qcom: move pm_clk functionality into common code Dmitry Baryshkov
2021-07-16 23:26   ` Bjorn Andersson
2021-07-17  7:33     ` Dmitry Baryshkov

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=YPIWUOw6AyFHP+QZ@yoga \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=tdas@codeaurora.org \
    --cc=ulf.hansson@linaro.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