lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 19 Mar 2015 22:37:51 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Georgi Djakov <georgi.djakov@...aro.org>
Cc:	mturquette@...aro.org, galak@...eaurora.org,
	linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH v2 3/3] clk: qcom: Introduce parent_map tables

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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ