linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Georgi Djakov <georgi.djakov@linaro.org>
Cc: mturquette@linaro.org, galak@codeaurora.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 3/3] clk: qcom: Introduce parent_map tables
Date: Thu, 19 Mar 2015 22:37:51 -0700	[thread overview]
Message-ID: <20150320053751.GA12794@codeaurora.org> (raw)
In-Reply-To: <1426753763-8953-4-git-send-email-georgi.djakov@linaro.org>

On 03/19, Georgi Djakov wrote:
> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
> index e20d947db3e5..a946b48f2d82 100644
> --- a/drivers/clk/qcom/common.c
> +++ b/drivers/clk/qcom/common.c
> @@ -43,6 +43,23 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate)
>  }
>  EXPORT_SYMBOL_GPL(qcom_find_freq);
>  
> +int qcom_find_src_index(const struct parent_map *map, u8 src)
> +{
> +	int i = 0;
> +
> +	if (!map)
> +		return -EINVAL;
> +
> +	do {
> +		if (src == map->src)
> +			return i;
> +		i++;
> +	} while (map++);
> +
> +	return -ENOENT;
> +}
> +EXPORT_SYMBOL_GPL(qcom_find_src_index);

Sorry I didn't notice this before, but we don't need/want to have
NULL terminated entries because it requires the first element to
be non-zero for all valid entries and also wastes space in each
parent map array. We already know that a particular clock has N
number of parents and we can query that from the framework, so we
should use __clk_get_num_parents() to figure out how many times
to loop.

> +
>  struct regmap *
>  qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
>  {
> diff --git a/drivers/clk/qcom/gcc-apq8084.c b/drivers/clk/qcom/gcc-apq8084.c
> index e3ef90264214..f75b505a13b8 100644
> --- a/drivers/clk/qcom/gcc-apq8084.c
> +++ b/drivers/clk/qcom/gcc-apq8084.c
> @@ -1263,9 +1271,9 @@ static const struct freq_tbl ftbl_gcc_usb_hsic_clk[] = {
>  	{ }
>  };
>  
> -static u8 usb_hsic_clk_src_map[] = {
> -	[P_XO]		= 0,
> -	[P_GPLL1]	= 4,
> +static const struct parent_map usb_hsic_clk_src_map[] = {
> +	{ P_XO, 0 },
> +	{ P_GPLL1, 4 },
>  };

This doesn't seem to be NULL terminated anyway.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

      reply	other threads:[~2015-03-20  5:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19  8:29 [PATCH v2 0/3] clk: qcom: Introduce parent_map tables Georgi Djakov
2015-03-19  8:29 ` [PATCH v2 1/3] clk: qcom: Fix clk_get_parent function return value Georgi Djakov
2015-03-19  8:29 ` [PATCH v2 2/3] clk: qcom: Do some error handling in configure_bank() Georgi Djakov
2015-03-19  8:29 ` [PATCH v2 3/3] clk: qcom: Introduce parent_map tables Georgi Djakov
2015-03-20  5:37   ` Stephen Boyd [this message]

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=20150320053751.GA12794@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=galak@codeaurora.org \
    --cc=georgi.djakov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@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;
as well as URLs for NNTP newsgroup(s).