Re: [PATCH v2 3/3] clk: qcom: Introduce parent_map tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux